diff --git a/api/api/cat.js b/api/api/cat.js index 14ca5e6f5..82b8403ae 100644 --- a/api/api/cat.js +++ b/api/api/cat.js @@ -34,8 +34,8 @@ /* eslint no-unused-vars: 0 */ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils') -const acceptedQuerystring = ['format', 'local', 'h', 'help', 's', 'v', 'expand_wildcards', 'pretty', 'human', 'error_trace', 'source', 'filter_path', 'bytes', 'master_timeout', 'fields', 'time', 'ts', 'health', 'pri', 'include_unloaded_segments', 'allow_no_match', 'allow_no_datafeeds', 'allow_no_jobs', 'from', 'size', 'full_id', 'include_bootstrap', 'active_only', 'detailed', 'index', 'ignore_unavailable', 'nodes', 'actions', 'parent_task_id'] -const snakeCase = { expandWildcards: 'expand_wildcards', errorTrace: 'error_trace', filterPath: 'filter_path', masterTimeout: 'master_timeout', includeUnloadedSegments: 'include_unloaded_segments', allowNoMatch: 'allow_no_match', allowNoDatafeeds: 'allow_no_datafeeds', allowNoJobs: 'allow_no_jobs', fullId: 'full_id', includeBootstrap: 'include_bootstrap', activeOnly: 'active_only', ignoreUnavailable: 'ignore_unavailable', parentTaskId: 'parent_task_id' } +const acceptedQuerystring = ['format', 'local', 'h', 'help', 's', 'v', 'expand_wildcards', 'pretty', 'human', 'error_trace', 'source', 'filter_path', 'bytes', 'cluster_manager_timeout', 'master_timeout', 'fields', 'time', 'ts', 'health', 'pri', 'include_unloaded_segments', 'allow_no_match', 'allow_no_datafeeds', 'allow_no_jobs', 'from', 'size', 'full_id', 'include_bootstrap', 'active_only', 'detailed', 'index', 'ignore_unavailable', 'nodes', 'actions', 'parent_task_id'] +const snakeCase = { expandWildcards: 'expand_wildcards', errorTrace: 'error_trace', filterPath: 'filter_path', clusterManagerTimeout: 'cluster_manager_timeout', masterTimeout: 'master_timeout', includeUnloadedSegments: 'include_unloaded_segments', allowNoMatch: 'allow_no_match', allowNoDatafeeds: 'allow_no_datafeeds', allowNoJobs: 'allow_no_jobs', fullId: 'full_id', includeBootstrap: 'include_bootstrap', activeOnly: 'active_only', ignoreUnavailable: 'ignore_unavailable', parentTaskId: 'parent_task_id' } function CatApi (transport, ConfigurationError) { this.transport = transport @@ -214,6 +214,29 @@ CatApi.prototype.indices = function catIndicesApi (params, options, callback) { return this.transport.request(request, options, callback) } +CatApi.prototype.cluster_manager = function catClusterManagerApi (params, options, callback) { + ;[params, options, callback] = normalizeArguments(params, options, callback) + + let { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) + + let path = '' + if (method == null) method = 'GET' + path = '/' + '_cat' + '/' + 'cluster_manager' + + // build request object + const request = { + method, + path, + body: null, + querystring + } + + return this.transport.request(request, options, callback) +} + +// cat.master api is deprecated. +// toDo: delete CatApi.prototype.master when cat.master api is removed from OpenSearch CatApi.prototype.master = function catMasterApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) diff --git a/api/api/cluster.js b/api/api/cluster.js index 9a1637625..929216509 100644 --- a/api/api/cluster.js +++ b/api/api/cluster.js @@ -34,8 +34,8 @@ /* eslint no-unused-vars: 0 */ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils') -const acceptedQuerystring = ['include_yes_decisions', 'include_disk_info', 'pretty', 'human', 'error_trace', 'source', 'filter_path', 'timeout', 'master_timeout', 'wait_for_removal', 'local', 'flat_settings', 'include_defaults', 'expand_wildcards', 'level', 'wait_for_active_shards', 'wait_for_nodes', 'wait_for_events', 'wait_for_no_relocating_shards', 'wait_for_no_initializing_shards', 'wait_for_status', 'node_ids', 'node_names', 'create', 'dry_run', 'explain', 'retry_failed', 'metric', 'wait_for_metadata_version', 'wait_for_timeout', 'ignore_unavailable', 'allow_no_indices'] -const snakeCase = { includeYesDecisions: 'include_yes_decisions', includeDiskInfo: 'include_disk_info', errorTrace: 'error_trace', filterPath: 'filter_path', masterTimeout: 'master_timeout', waitForRemoval: 'wait_for_removal', flatSettings: 'flat_settings', includeDefaults: 'include_defaults', expandWildcards: 'expand_wildcards', waitForActiveShards: 'wait_for_active_shards', waitForNodes: 'wait_for_nodes', waitForEvents: 'wait_for_events', waitForNoRelocatingShards: 'wait_for_no_relocating_shards', waitForNoInitializingShards: 'wait_for_no_initializing_shards', waitForStatus: 'wait_for_status', nodeIds: 'node_ids', nodeNames: 'node_names', dryRun: 'dry_run', retryFailed: 'retry_failed', waitForMetadataVersion: 'wait_for_metadata_version', waitForTimeout: 'wait_for_timeout', ignoreUnavailable: 'ignore_unavailable', allowNoIndices: 'allow_no_indices' } +const acceptedQuerystring = ['include_yes_decisions', 'include_disk_info', 'pretty', 'human', 'error_trace', 'source', 'filter_path', 'timeout', 'cluster_manager_timeout', 'master_timeout', 'wait_for_removal', 'local', 'flat_settings', 'include_defaults', 'expand_wildcards', 'level', 'wait_for_active_shards', 'wait_for_nodes', 'wait_for_events', 'wait_for_no_relocating_shards', 'wait_for_no_initializing_shards', 'wait_for_status', 'node_ids', 'node_names', 'create', 'dry_run', 'explain', 'retry_failed', 'metric', 'wait_for_metadata_version', 'wait_for_timeout', 'ignore_unavailable', 'allow_no_indices'] +const snakeCase = { includeYesDecisions: 'include_yes_decisions', includeDiskInfo: 'include_disk_info', errorTrace: 'error_trace', filterPath: 'filter_path', clusterManagerTimeout: 'cluster_manager_timeout', masterTimeout: 'master_timeout', waitForRemoval: 'wait_for_removal', flatSettings: 'flat_settings', includeDefaults: 'include_defaults', expandWildcards: 'expand_wildcards', waitForActiveShards: 'wait_for_active_shards', waitForNodes: 'wait_for_nodes', waitForEvents: 'wait_for_events', waitForNoRelocatingShards: 'wait_for_no_relocating_shards', waitForNoInitializingShards: 'wait_for_no_initializing_shards', waitForStatus: 'wait_for_status', nodeIds: 'node_ids', nodeNames: 'node_names', dryRun: 'dry_run', retryFailed: 'retry_failed', waitForMetadataVersion: 'wait_for_metadata_version', waitForTimeout: 'wait_for_timeout', ignoreUnavailable: 'ignore_unavailable', allowNoIndices: 'allow_no_indices' } function ClusterApi (transport, ConfigurationError) { this.transport = transport diff --git a/api/api/dangling_indices.js b/api/api/dangling_indices.js index ad8459efa..94ede801d 100644 --- a/api/api/dangling_indices.js +++ b/api/api/dangling_indices.js @@ -34,8 +34,8 @@ /* eslint no-unused-vars: 0 */ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils') -const acceptedQuerystring = ['accept_data_loss', 'timeout', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path'] -const snakeCase = { acceptDataLoss: 'accept_data_loss', masterTimeout: 'master_timeout', errorTrace: 'error_trace', filterPath: 'filter_path' } +const acceptedQuerystring = ['accept_data_loss', 'timeout', 'cluster_manager_timeout', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path'] +const snakeCase = { acceptDataLoss: 'accept_data_loss', clusterManagerTimeout: 'cluster_manager_timeout', masterTimeout: 'master_timeout', errorTrace: 'error_trace', filterPath: 'filter_path' } function DanglingIndicesApi (transport, ConfigurationError) { this.transport = transport diff --git a/api/api/delete_script.js b/api/api/delete_script.js index b148d52df..9a1ce9ae2 100644 --- a/api/api/delete_script.js +++ b/api/api/delete_script.js @@ -34,8 +34,8 @@ /* eslint no-unused-vars: 0 */ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils') -const acceptedQuerystring = ['timeout', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path'] -const snakeCase = { masterTimeout: 'master_timeout', errorTrace: 'error_trace', filterPath: 'filter_path' } +const acceptedQuerystring = ['timeout', 'cluster_manager_timeout', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path'] +const snakeCase = { clusterManagerTimeout: 'cluster_manager_timeout', masterTimeout: 'master_timeout', errorTrace: 'error_trace', filterPath: 'filter_path' } function deleteScriptApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) diff --git a/api/api/features.js b/api/api/features.js index 033727894..277baf2ef 100644 --- a/api/api/features.js +++ b/api/api/features.js @@ -34,8 +34,8 @@ /* eslint no-unused-vars: 0 */ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils') -const acceptedQuerystring = ['master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path'] -const snakeCase = { masterTimeout: 'master_timeout', errorTrace: 'error_trace', filterPath: 'filter_path' } +const acceptedQuerystring = ['cluster_manager_timeout', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path'] +const snakeCase = { clusterManagerTimeout: 'cluster_manager_timeout', masterTimeout: 'master_timeout', errorTrace: 'error_trace', filterPath: 'filter_path' } function FeaturesApi (transport, ConfigurationError) { this.transport = transport diff --git a/api/api/get_script.js b/api/api/get_script.js index b50870007..0606e8126 100644 --- a/api/api/get_script.js +++ b/api/api/get_script.js @@ -34,8 +34,8 @@ /* eslint no-unused-vars: 0 */ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils') -const acceptedQuerystring = ['master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path'] -const snakeCase = { masterTimeout: 'master_timeout', errorTrace: 'error_trace', filterPath: 'filter_path' } +const acceptedQuerystring = ['cluster_manager_timeout', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path'] +const snakeCase = { clusterManagerTimeout: 'cluster_manager_timeout', masterTimeout: 'master_timeout', errorTrace: 'error_trace', filterPath: 'filter_path' } function getScriptApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) diff --git a/api/api/indices.js b/api/api/indices.js index 9c74d6614..3303bc44a 100644 --- a/api/api/indices.js +++ b/api/api/indices.js @@ -34,8 +34,8 @@ /* eslint no-unused-vars: 0 */ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils') -const acceptedQuerystring = ['timeout', 'master_timeout', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'pretty', 'human', 'error_trace', 'source', 'filter_path', 'index', 'fielddata', 'fields', 'query', 'request', 'wait_for_active_shards', 'include_type_name', 'run_expensive_tasks', 'flush', 'local', 'flat_settings', 'include_defaults', 'force', 'wait_if_ongoing', 'max_num_segments', 'only_expunge_deletes', 'create', 'cause', 'write_index_only', 'preserve_existing', 'order', 'detailed', 'active_only', 'dry_run', 'verbose', 'status', 'copy_settings', 'completion_fields', 'fielddata_fields', 'groups', 'level', 'types', 'include_segment_file_sizes', 'include_unloaded_segments', 'forbid_closed_indices', 'wait_for_completion', 'only_ancient_segments', 'explain', 'q', 'analyzer', 'analyze_wildcard', 'default_operator', 'df', 'lenient', 'rewrite', 'all_shards'] -const snakeCase = { masterTimeout: 'master_timeout', ignoreUnavailable: 'ignore_unavailable', allowNoIndices: 'allow_no_indices', expandWildcards: 'expand_wildcards', errorTrace: 'error_trace', filterPath: 'filter_path', waitForActiveShards: 'wait_for_active_shards', includeTypeName: 'include_type_name', runExpensiveTasks: 'run_expensive_tasks', flatSettings: 'flat_settings', includeDefaults: 'include_defaults', waitIfOngoing: 'wait_if_ongoing', maxNumSegments: 'max_num_segments', onlyExpungeDeletes: 'only_expunge_deletes', writeIndexOnly: 'write_index_only', preserveExisting: 'preserve_existing', activeOnly: 'active_only', dryRun: 'dry_run', copySettings: 'copy_settings', completionFields: 'completion_fields', fielddataFields: 'fielddata_fields', includeSegmentFileSizes: 'include_segment_file_sizes', includeUnloadedSegments: 'include_unloaded_segments', forbidClosedIndices: 'forbid_closed_indices', waitForCompletion: 'wait_for_completion', onlyAncientSegments: 'only_ancient_segments', analyzeWildcard: 'analyze_wildcard', defaultOperator: 'default_operator', allShards: 'all_shards' } +const acceptedQuerystring = ['cluster_manager_timeout', 'timeout', 'master_timeout', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'pretty', 'human', 'error_trace', 'source', 'filter_path', 'index', 'fielddata', 'fields', 'query', 'request', 'wait_for_active_shards', 'include_type_name', 'run_expensive_tasks', 'flush', 'local', 'flat_settings', 'include_defaults', 'force', 'wait_if_ongoing', 'max_num_segments', 'only_expunge_deletes', 'create', 'cause', 'write_index_only', 'preserve_existing', 'order', 'detailed', 'active_only', 'dry_run', 'verbose', 'status', 'copy_settings', 'completion_fields', 'fielddata_fields', 'groups', 'level', 'types', 'include_segment_file_sizes', 'include_unloaded_segments', 'forbid_closed_indices', 'wait_for_completion', 'only_ancient_segments', 'explain', 'q', 'analyzer', 'analyze_wildcard', 'default_operator', 'df', 'lenient', 'rewrite', 'all_shards'] +const snakeCase = { clusterManagerTimeout: 'cluster_manager_timeout', masterTimeout: 'master_timeout', ignoreUnavailable: 'ignore_unavailable', allowNoIndices: 'allow_no_indices', expandWildcards: 'expand_wildcards', errorTrace: 'error_trace', filterPath: 'filter_path', waitForActiveShards: 'wait_for_active_shards', includeTypeName: 'include_type_name', runExpensiveTasks: 'run_expensive_tasks', flatSettings: 'flat_settings', includeDefaults: 'include_defaults', waitIfOngoing: 'wait_if_ongoing', maxNumSegments: 'max_num_segments', onlyExpungeDeletes: 'only_expunge_deletes', writeIndexOnly: 'write_index_only', preserveExisting: 'preserve_existing', activeOnly: 'active_only', dryRun: 'dry_run', copySettings: 'copy_settings', completionFields: 'completion_fields', fielddataFields: 'fielddata_fields', includeSegmentFileSizes: 'include_segment_file_sizes', includeUnloadedSegments: 'include_unloaded_segments', forbidClosedIndices: 'forbid_closed_indices', waitForCompletion: 'wait_for_completion', onlyAncientSegments: 'only_ancient_segments', analyzeWildcard: 'analyze_wildcard', defaultOperator: 'default_operator', allShards: 'all_shards' } function IndicesApi (transport, ConfigurationError) { this.transport = transport diff --git a/api/api/ingest.js b/api/api/ingest.js index d1325d968..353d3452f 100644 --- a/api/api/ingest.js +++ b/api/api/ingest.js @@ -34,8 +34,8 @@ /* eslint no-unused-vars: 0 */ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils') -const acceptedQuerystring = ['master_timeout', 'timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path', 'summary', 'verbose'] -const snakeCase = { masterTimeout: 'master_timeout', errorTrace: 'error_trace', filterPath: 'filter_path' } +const acceptedQuerystring = ['cluster_manager_timeout', 'master_timeout', 'timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path', 'summary', 'verbose'] +const snakeCase = { clusterManagerTimeout: 'cluster_manager_timeout', masterTimeout: 'master_timeout', errorTrace: 'error_trace', filterPath: 'filter_path' } function IngestApi (transport, ConfigurationError) { this.transport = transport diff --git a/api/api/put_script.js b/api/api/put_script.js index ffe81dbce..9d7fec32c 100644 --- a/api/api/put_script.js +++ b/api/api/put_script.js @@ -34,8 +34,8 @@ /* eslint no-unused-vars: 0 */ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils') -const acceptedQuerystring = ['timeout', 'master_timeout', 'context', 'pretty', 'human', 'error_trace', 'source', 'filter_path'] -const snakeCase = { masterTimeout: 'master_timeout', errorTrace: 'error_trace', filterPath: 'filter_path' } +const acceptedQuerystring = ['cluster_manager_timeout', 'timeout', 'master_timeout', 'context', 'pretty', 'human', 'error_trace', 'source', 'filter_path'] +const snakeCase = { clusterManagerTimeout: 'cluster_manager_timeout', masterTimeout: 'master_timeout', errorTrace: 'error_trace', filterPath: 'filter_path' } function putScriptApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) diff --git a/api/api/snapshot.js b/api/api/snapshot.js index 69460002a..7c94faf59 100644 --- a/api/api/snapshot.js +++ b/api/api/snapshot.js @@ -34,8 +34,8 @@ /* eslint no-unused-vars: 0 */ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils') -const acceptedQuerystring = ['master_timeout', 'timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path', 'wait_for_completion', 'verify', 'ignore_unavailable', 'index_details', 'include_repository', 'verbose', 'local', 'blob_count', 'concurrency', 'read_node_count', 'early_read_node_count', 'seed', 'rare_action_probability', 'max_blob_size', 'max_total_data_size', 'detailed', 'rarely_abort_writes'] -const snakeCase = { masterTimeout: 'master_timeout', errorTrace: 'error_trace', filterPath: 'filter_path', waitForCompletion: 'wait_for_completion', ignoreUnavailable: 'ignore_unavailable', indexDetails: 'index_details', includeRepository: 'include_repository', blobCount: 'blob_count', readNodeCount: 'read_node_count', earlyReadNodeCount: 'early_read_node_count', rareActionProbability: 'rare_action_probability', maxBlobSize: 'max_blob_size', maxTotalDataSize: 'max_total_data_size', rarelyAbortWrites: 'rarely_abort_writes' } +const acceptedQuerystring = ['cluster_manager_timeout', 'master_timeout', 'timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path', 'wait_for_completion', 'verify', 'ignore_unavailable', 'index_details', 'include_repository', 'verbose', 'local', 'blob_count', 'concurrency', 'read_node_count', 'early_read_node_count', 'seed', 'rare_action_probability', 'max_blob_size', 'max_total_data_size', 'detailed', 'rarely_abort_writes'] +const snakeCase = { clusterManagerTimeout: 'cluster_manager_timeout', masterTimeout: 'master_timeout', errorTrace: 'error_trace', filterPath: 'filter_path', waitForCompletion: 'wait_for_completion', ignoreUnavailable: 'ignore_unavailable', indexDetails: 'index_details', includeRepository: 'include_repository', blobCount: 'blob_count', readNodeCount: 'read_node_count', earlyReadNodeCount: 'early_read_node_count', rareActionProbability: 'rare_action_probability', maxBlobSize: 'max_blob_size', maxTotalDataSize: 'max_total_data_size', rarelyAbortWrites: 'rarely_abort_writes' } function SnapshotApi (transport, ConfigurationError) { this.transport = transport diff --git a/api/new.d.ts b/api/new.d.ts index bb4e26cb5..c90c54d22 100644 --- a/api/new.d.ts +++ b/api/new.d.ts @@ -110,6 +110,10 @@ declare class Client { allocation(callback: callbackFn): TransportRequestCallback allocation(params: T.CatAllocationRequest, callback: callbackFn): TransportRequestCallback allocation(params: T.CatAllocationRequest, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback + cluster_manager(params?: T.CatClusterManagerRequest, options?: TransportRequestOptions): TransportRequestPromise> + cluster_manager(callback: callbackFn): TransportRequestCallback + cluster_manager(params: T.CatClusterManagerRequest, callback: callbackFn): TransportRequestCallback + cluster_manager(params: T.CatClusterManagerRequest, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback count(params?: T.CatCountRequest, options?: TransportRequestOptions): TransportRequestPromise> count(callback: callbackFn): TransportRequestCallback count(params: T.CatCountRequest, callback: callbackFn): TransportRequestCallback @@ -130,6 +134,8 @@ declare class Client { indices(callback: callbackFn): TransportRequestCallback indices(params: T.CatIndicesRequest, callback: callbackFn): TransportRequestCallback indices(params: T.CatIndicesRequest, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback + // cat.master api is deprecated. + // toDo: delete cat.master api when it is removed from OpenSearch master(params?: T.CatMasterRequest, options?: TransportRequestOptions): TransportRequestPromise> master(callback: callbackFn): TransportRequestCallback master(params: T.CatMasterRequest, callback: callbackFn): TransportRequestCallback diff --git a/api/opensearch_dashboards.d.ts b/api/opensearch_dashboards.d.ts index 613541b27..c022394d3 100644 --- a/api/opensearch_dashboards.d.ts +++ b/api/opensearch_dashboards.d.ts @@ -93,11 +93,14 @@ import { cat: { aliases(params?: T.CatAliasesRequest, options?: TransportRequestOptions): TransportRequestPromise> allocation(params?: T.CatAllocationRequest, options?: TransportRequestOptions): TransportRequestPromise> + cluster_manager(params?: T.CatClusterManagerRequest, options?: TransportRequestOptions): TransportRequestPromise> count(params?: T.CatCountRequest, options?: TransportRequestOptions): TransportRequestPromise> fielddata(params?: T.CatFielddataRequest, options?: TransportRequestOptions): TransportRequestPromise> health(params?: T.CatHealthRequest, options?: TransportRequestOptions): TransportRequestPromise> help(params?: T.CatHelpRequest, options?: TransportRequestOptions): TransportRequestPromise> indices(params?: T.CatIndicesRequest, options?: TransportRequestOptions): TransportRequestPromise> + // cat.master api is deprecated. + // toDo: delete cat.master api when it is removed from OpenSearch master(params?: T.CatMasterRequest, options?: TransportRequestOptions): TransportRequestPromise> nodeattrs(params?: T.CatNodeAttributesRequest, options?: TransportRequestOptions): TransportRequestPromise> nodes(params?: T.CatNodesRequest, options?: TransportRequestOptions): TransportRequestPromise> diff --git a/api/requestParams.d.ts b/api/requestParams.d.ts index a761c8462..99b72bc74 100644 --- a/api/requestParams.d.ts +++ b/api/requestParams.d.ts @@ -71,6 +71,7 @@ export interface CatAllocation extends Generic { format?: string; bytes?: 'b' | 'k' | 'kb' | 'm' | 'mb' | 'g' | 'gb' | 't' | 'tb' | 'p' | 'pb'; local?: boolean; + cluster_manager_timeout?: string; master_timeout?: string; h?: string | string[]; help?: boolean; @@ -117,6 +118,7 @@ export interface CatIndices extends Generic { format?: string; bytes?: 'b' | 'k' | 'kb' | 'm' | 'mb' | 'g' | 'gb' | 't' | 'tb' | 'p' | 'pb'; local?: boolean; + cluster_manager_timeout?: string; master_timeout?: string; h?: string | string[]; health?: 'green' | 'yellow' | 'red'; @@ -129,9 +131,22 @@ export interface CatIndices extends Generic { expand_wildcards?: 'open' | 'closed' | 'hidden' | 'none' | 'all'; } +export interface CatClusterManager extends Generic { + format?: string; + local?: boolean; + cluster_manager_timeout?: string; + h?: string | string[]; + help?: boolean; + s?: string | string[]; + v?: boolean; +} + +// CatMaster is deprecated. +// toDo: remove CatMaster interface when cat.master api is removed from OpenSearch export interface CatMaster extends Generic { format?: string; local?: boolean; + cluster_manager_timeout?: string; master_timeout?: string; h?: string | string[]; help?: boolean; @@ -142,6 +157,7 @@ export interface CatMaster extends Generic { export interface CatNodeattrs extends Generic { format?: string; local?: boolean; + cluster_manager_timeout?: string; master_timeout?: string; h?: string | string[]; help?: boolean; @@ -154,6 +170,7 @@ export interface CatNodes extends Generic { format?: string; full_id?: boolean; local?: boolean; + cluster_manager_timeout?: string; master_timeout?: string; h?: string | string[]; help?: boolean; @@ -166,6 +183,7 @@ export interface CatNodes extends Generic { export interface CatPendingTasks extends Generic { format?: string; local?: boolean; + cluster_manager_timeout?: string; master_timeout?: string; h?: string | string[]; help?: boolean; @@ -177,6 +195,7 @@ export interface CatPendingTasks extends Generic { export interface CatPlugins extends Generic { format?: string; local?: boolean; + cluster_manager_timeout?: string; master_timeout?: string; h?: string | string[]; help?: boolean; @@ -201,6 +220,7 @@ export interface CatRecovery extends Generic { export interface CatRepositories extends Generic { format?: string; local?: boolean; + cluster_manager_timeout?: string; master_timeout?: string; h?: string | string[]; help?: boolean; @@ -223,6 +243,7 @@ export interface CatShards extends Generic { format?: string; bytes?: 'b' | 'k' | 'kb' | 'm' | 'mb' | 'g' | 'gb' | 't' | 'tb' | 'p' | 'pb'; local?: boolean; + cluster_manager_timeout?: string; master_timeout?: string; h?: string | string[]; help?: boolean; @@ -235,6 +256,7 @@ export interface CatSnapshots extends Generic { repository?: string | string[]; format?: string; ignore_unavailable?: boolean; + cluster_manager_timeout?: string; master_timeout?: string; h?: string | string[]; help?: boolean; @@ -260,6 +282,7 @@ export interface CatTemplates extends Generic { name?: string; format?: string; local?: boolean; + cluster_manager_timeout?: string; master_timeout?: string; h?: string | string[]; help?: boolean; @@ -272,6 +295,7 @@ export interface CatThreadPool extends Generic { format?: string; size?: '' | 'k' | 'm' | 'g' | 't' | 'p'; local?: boolean; + cluster_manager_timeout?: string; master_timeout?: string; h?: string | string[]; help?: boolean; @@ -293,6 +317,7 @@ export interface ClusterAllocationExplain extends Generic { export interface ClusterDeleteComponentTemplate extends Generic { name: string; timeout?: string; + cluster_manager_timeout?: string; master_timeout?: string; } @@ -302,18 +327,21 @@ export interface ClusterDeleteVotingConfigExclusions extends Generic { export interface ClusterExistsComponentTemplate extends Generic { name: string; + cluster_manager_timeout?: string; master_timeout?: string; local?: boolean; } export interface ClusterGetComponentTemplate extends Generic { name?: string | string[]; + cluster_manager_timeout?: string; master_timeout?: string; local?: boolean; } export interface ClusterGetSettings extends Generic { flat_settings?: boolean; + cluster_manager_timeout?: string; master_timeout?: string; timeout?: string; include_defaults?: boolean; @@ -324,6 +352,7 @@ export interface ClusterHealth extends Generic { expand_wildcards?: 'open' | 'closed' | 'hidden' | 'none' | 'all'; level?: 'cluster' | 'indices' | 'shards'; local?: boolean; + cluster_manager_timeout?: string; master_timeout?: string; timeout?: string; wait_for_active_shards?: string; @@ -336,6 +365,7 @@ export interface ClusterHealth extends Generic { export interface ClusterPendingTasks extends Generic { local?: boolean; + cluster_manager_timeout?: string; master_timeout?: string; } @@ -349,12 +379,14 @@ export interface ClusterPutComponentTemplate extends Generic { name: string; create?: boolean; timeout?: string; + cluster_manager_timeout?: string; master_timeout?: string; body: T; } export interface ClusterPutSettings extends Generic { flat_settings?: boolean; + cluster_manager_timeout?: string; master_timeout?: string; timeout?: string; body: T; @@ -368,6 +400,7 @@ export interface ClusterReroute extends Generic { explain?: boolean; retry_failed?: boolean; metric?: string | string[]; + cluster_manager_timeout?: string; master_timeout?: string; timeout?: string; body?: T; @@ -377,6 +410,7 @@ export interface ClusterState extends Generic { index?: string | string[]; metric?: string | string[]; local?: boolean; + cluster_manager_timeout?: string; master_timeout?: string; flat_settings?: boolean; wait_for_metadata_version?: number; @@ -430,6 +464,7 @@ export interface DanglingIndicesDeleteDanglingIndex extends Generic { index_uuid: string; accept_data_loss?: boolean; timeout?: string; + cluster_manager_timeout?: string; master_timeout?: string; } @@ -437,6 +472,7 @@ export interface DanglingIndicesImportDanglingIndex extends Generic { index_uuid: string; accept_data_loss?: boolean; timeout?: string; + cluster_manager_timeout?: string; master_timeout?: string; } @@ -506,6 +542,7 @@ export interface DeleteByQueryRethrottle extends Generic { export interface DeleteScript extends Generic { id: string; timeout?: string; + cluster_manager_timeout?: string; master_timeout?: string; } @@ -566,6 +603,7 @@ export interface Explain extends Generic { } export interface FeaturesGetFeatures extends Generic { + cluster_manager_timeout?: string; master_timeout?: string; } @@ -602,6 +640,7 @@ export interface Get extends Generic { export interface GetScript extends Generic { id: string; + cluster_manager_timeout?: string; master_timeout?: string; } @@ -650,6 +689,7 @@ export interface IndicesAddBlock extends Generic { index: string | string[]; block: string; timeout?: string; + cluster_manager_timeout?: string; master_timeout?: string; ignore_unavailable?: boolean; allow_no_indices?: boolean; @@ -676,6 +716,7 @@ export interface IndicesClone extends Generic { index: string; target: string; timeout?: string; + cluster_manager_timeout?: string; master_timeout?: string; wait_for_active_shards?: string; body?: T; @@ -684,6 +725,7 @@ export interface IndicesClone extends Generic { export interface IndicesClose extends Generic { index: string | string[]; timeout?: string; + cluster_manager_timeout?: string; master_timeout?: string; ignore_unavailable?: boolean; allow_no_indices?: boolean; @@ -696,6 +738,7 @@ export interface IndicesCreate extends Generic { include_type_name?: boolean; wait_for_active_shards?: string; timeout?: string; + cluster_manager_timeout?: string; master_timeout?: string; body?: T; } @@ -703,6 +746,7 @@ export interface IndicesCreate extends Generic { export interface IndicesDelete extends Generic { index: string | string[]; timeout?: string; + cluster_manager_timeout?: string; master_timeout?: string; ignore_unavailable?: boolean; allow_no_indices?: boolean; @@ -713,17 +757,21 @@ export interface IndicesDeleteAlias extends Generic { index: string | string[]; name: string | string[]; timeout?: string; + cluster_manager_timeout?: string; master_timeout?: string; } + export interface IndicesDeleteIndexTemplate extends Generic { name: string; timeout?: string; + cluster_manager_timeout?: string; master_timeout?: string; } export interface IndicesDeleteTemplate extends Generic { name: string; timeout?: string; + cluster_manager_timeout?: string; master_timeout?: string; } @@ -758,6 +806,7 @@ export interface IndicesExistsAlias extends Generic { export interface IndicesExistsIndexTemplate extends Generic { name: string; flat_settings?: boolean; + cluster_manager_timeout?: string; master_timeout?: string; local?: boolean; } @@ -765,6 +814,7 @@ export interface IndicesExistsIndexTemplate extends Generic { export interface IndicesExistsTemplate extends Generic { name: string | string[]; flat_settings?: boolean; + cluster_manager_timeout?: string; master_timeout?: string; local?: boolean; } @@ -821,6 +871,7 @@ export interface IndicesGet extends Generic { expand_wildcards?: 'open' | 'closed' | 'hidden' | 'none' | 'all'; flat_settings?: boolean; include_defaults?: boolean; + cluster_manager_timeout?: string; master_timeout?: string; } @@ -848,6 +899,7 @@ export interface IndicesGetFieldMapping extends Generic { export interface IndicesGetIndexTemplate extends Generic { name?: string | string[]; flat_settings?: boolean; + cluster_manager_timeout?: string; master_timeout?: string; local?: boolean; } @@ -859,6 +911,7 @@ export interface IndicesGetMapping extends Generic { ignore_unavailable?: boolean; allow_no_indices?: boolean; expand_wildcards?: 'open' | 'closed' | 'hidden' | 'none' | 'all'; + cluster_manager_timeout?: string; master_timeout?: string; local?: boolean; } @@ -866,6 +919,7 @@ export interface IndicesGetMapping extends Generic { export interface IndicesGetSettings extends Generic { index?: string | string[]; name?: string | string[]; + cluster_manager_timeout?: string; master_timeout?: string; ignore_unavailable?: boolean; allow_no_indices?: boolean; @@ -879,6 +933,7 @@ export interface IndicesGetTemplate extends Generic { name?: string | string[]; include_type_name?: boolean; flat_settings?: boolean; + cluster_manager_timeout?: string; master_timeout?: string; local?: boolean; } @@ -894,6 +949,7 @@ export interface IndicesGetUpgrade extends Generic { export interface IndicesOpen extends Generic { index: string | string[]; timeout?: string; + cluster_manager_timeout?: string; master_timeout?: string; ignore_unavailable?: boolean; allow_no_indices?: boolean; @@ -905,6 +961,7 @@ export interface IndicesPutAlias extends Generic { index: string | string[]; name: string; timeout?: string; + cluster_manager_timeout?: string; master_timeout?: string; body?: T; } @@ -913,6 +970,7 @@ export interface IndicesPutIndexTemplate extends Generic { name: string; create?: boolean; cause?: string; + cluster_manager_timeout?: string; master_timeout?: string; body: T; } @@ -922,6 +980,7 @@ export interface IndicesPutMapping extends Generic { type?: string; include_type_name?: boolean; timeout?: string; + cluster_manager_timeout?: string; master_timeout?: string; ignore_unavailable?: boolean; allow_no_indices?: boolean; @@ -932,6 +991,7 @@ export interface IndicesPutMapping extends Generic { export interface IndicesPutSettings extends Generic { index?: string | string[]; + cluster_manager_timeout?: string; master_timeout?: string; timeout?: string; preserve_existing?: boolean; @@ -947,6 +1007,7 @@ export interface IndicesPutTemplate extends Generic { include_type_name?: boolean; order?: number; create?: boolean; + cluster_manager_timeout?: string; master_timeout?: string; body: T; } @@ -975,6 +1036,7 @@ export interface IndicesRollover extends Generic { include_type_name?: boolean; timeout?: string; dry_run?: boolean; + cluster_manager_timeout?: string; master_timeout?: string; wait_for_active_shards?: string; body?: T; @@ -1001,6 +1063,7 @@ export interface IndicesShrink extends Generic { target: string; copy_settings?: boolean; timeout?: string; + cluster_manager_timeout?: string; master_timeout?: string; wait_for_active_shards?: string; body?: T; @@ -1010,6 +1073,7 @@ export interface IndicesSimulateIndexTemplate extends Generic { name: string; create?: boolean; cause?: string; + cluster_manager_timeout?: string; master_timeout?: string; body?: T; } @@ -1018,6 +1082,7 @@ export interface IndicesSimulateTemplate extends Generic { name?: string; create?: boolean; cause?: string; + cluster_manager_timeout?: string; master_timeout?: string; body?: T; } @@ -1027,6 +1092,7 @@ export interface IndicesSplit extends Generic { target: string; copy_settings?: boolean; timeout?: string; + cluster_manager_timeout?: string; master_timeout?: string; wait_for_active_shards?: string; body?: T; @@ -1049,6 +1115,7 @@ export interface IndicesStats extends Generic { export interface IndicesUpdateAliases extends Generic { timeout?: string; + cluster_manager_timeout?: string; master_timeout?: string; body: T; } @@ -1085,6 +1152,7 @@ export interface Info extends Generic { export interface IngestDeletePipeline extends Generic { id: string; + cluster_manager_timeout?: string; master_timeout?: string; timeout?: string; } @@ -1095,6 +1163,7 @@ export interface IngestGeoIpStats extends Generic { export interface IngestGetPipeline extends Generic { id?: string; summary?: boolean; + cluster_manager_timeout?: string; master_timeout?: string; } @@ -1103,6 +1172,7 @@ export interface IngestProcessorGrok extends Generic { export interface IngestPutPipeline extends Generic { id: string; + cluster_manager_timeout?: string; master_timeout?: string; timeout?: string; body: T; @@ -1232,6 +1302,7 @@ export interface PutScript extends Generic { id: string; context?: string; timeout?: string; + cluster_manager_timeout?: string; master_timeout?: string; body: T; } @@ -1373,6 +1444,7 @@ export interface ShutdownPutNode extends Generic { export interface SnapshotCleanupRepository extends Generic { repository: string; + cluster_manager_timeout?: string; master_timeout?: string; timeout?: string; } @@ -1381,6 +1453,7 @@ export interface SnapshotClone extends Generic { repository: string; snapshot: string; target_snapshot: string; + cluster_manager_timeout?: string; master_timeout?: string; body: T; } @@ -1388,6 +1461,7 @@ export interface SnapshotClone extends Generic { export interface SnapshotCreate extends Generic { repository: string; snapshot: string; + cluster_manager_timeout?: string; master_timeout?: string; wait_for_completion?: boolean; body?: T; @@ -1395,6 +1469,7 @@ export interface SnapshotCreate extends Generic { export interface SnapshotCreateRepository extends Generic { repository: string; + cluster_manager_timeout?: string; master_timeout?: string; timeout?: string; verify?: boolean; @@ -1404,11 +1479,13 @@ export interface SnapshotCreateRepository extends Generic { export interface SnapshotDelete extends Generic { repository: string; snapshot: string; + cluster_manager_timeout?: string; master_timeout?: string; } export interface SnapshotDeleteRepository extends Generic { repository: string | string[]; + cluster_manager_timeout?: string; master_timeout?: string; timeout?: string; } @@ -1416,6 +1493,7 @@ export interface SnapshotDeleteRepository extends Generic { export interface SnapshotGet extends Generic { repository: string; snapshot: string | string[]; + cluster_manager_timeout?: string; master_timeout?: string; ignore_unavailable?: boolean; index_details?: boolean; @@ -1425,6 +1503,7 @@ export interface SnapshotGet extends Generic { export interface SnapshotGetRepository extends Generic { repository?: string | string[]; + cluster_manager_timeout?: string; master_timeout?: string; local?: boolean; } @@ -1447,6 +1526,7 @@ export interface SnapshotRepositoryAnalyze extends Generic { export interface SnapshotRestore extends Generic { repository: string; snapshot: string; + cluster_manager_timeout?: string; master_timeout?: string; wait_for_completion?: boolean; body?: T; @@ -1455,12 +1535,14 @@ export interface SnapshotRestore extends Generic { export interface SnapshotStatus extends Generic { repository?: string; snapshot?: string | string[]; + cluster_manager_timeout?: string; master_timeout?: string; ignore_unavailable?: boolean; } export interface SnapshotVerifyRepository extends Generic { repository: string; + cluster_manager_timeout?: string; master_timeout?: string; timeout?: string; } @@ -1579,5 +1661,4 @@ export interface UpdateByQuery extends Generic { export interface UpdateByQueryRethrottle extends Generic { task_id: string; requests_per_second: number; -} - +} \ No newline at end of file diff --git a/api/types.d.ts b/api/types.d.ts index 028e60bbc..53ef24b86 100644 --- a/api/types.d.ts +++ b/api/types.d.ts @@ -257,6 +257,7 @@ export interface DeleteByQueryRethrottleResponse extends TaskListResponse { export interface DeleteScriptRequest extends RequestBase { id: Id + cluster_manager_timeout?: Time master_timeout?: Time timeout?: Time } @@ -426,6 +427,7 @@ export interface GetResponse { export interface GetScriptRequest extends RequestBase { id: Id + cluster_manager_timeout?: Time master_timeout?: Time } @@ -683,6 +685,7 @@ export type PingResponse = boolean export interface PutScriptRequest extends RequestBase { id: Id context?: Name + cluster_manager_timeout?: Time master_timeout?: Time timeout?: Time body?: { @@ -2062,7 +2065,8 @@ export type NodeIds = string export type NodeName = string -export type NodeRole = 'master' | 'data' | 'client' | 'ingest' | 'voting_only' | 'remote_cluster_client' | 'coordinating_only' +// toDo: remove master role if it is not supported. +export type NodeRole = 'cluster_manager'| 'master' | 'data' | 'client' | 'ingest' | 'voting_only' | 'remote_cluster_client' | 'coordinating_only' export type NodeRoles = NodeRole[] @@ -5159,6 +5163,18 @@ export interface CatIndicesRequest extends CatCatRequestBase { export type CatIndicesResponse = CatIndicesIndicesRecord[] +export interface CatClusterManagerClusterManagerRecord { + id?: string + host?: string + h?: string + ip?: string + node?: string + n?: string +} + +// CatMasterMasterRecord is deprecated +// toDo: delete CatMasterMasterRecord interface and clean out +// the usage when it is officially removed export interface CatMasterMasterRecord { id?: string host?: string @@ -5168,9 +5184,20 @@ export interface CatMasterMasterRecord { n?: string } +export interface CatClusterManagerRequest extends CatCatRequestBase { +} + +// CatMasterRequest is deprecated +// toDo: delete CatMasterRequest interface and clean out +// the usage when it is officially removed export interface CatMasterRequest extends CatCatRequestBase { } +export type CatClusterManagerResponse = CatClusterManagerClusterManagerRecord[] + +// type CatMasterResponse is deprecated +// toDo: delete CatMasterResponse type and clean out +// the usage when it is officially removed export type CatMasterResponse = CatMasterMasterRecord[] export interface CatNodeAttributesNodeAttributesRecord { @@ -5264,6 +5291,7 @@ export interface CatNodesNodesRecord { r?: string role?: string nodeRole?: string + cluster_manager?: string master?: string m?: string name?: Name @@ -6253,8 +6281,10 @@ export interface ClusterAllocationExplainUnassignedInformation { export type ClusterAllocationExplainUnassignedInformationReason = 'INDEX_CREATED' | 'CLUSTER_RECOVERED' | 'INDEX_REOPENED' | 'DANGLING_INDEX_IMPORTED' | 'NEW_INDEX_RESTORED' | 'EXISTING_INDEX_RESTORED' | 'REPLICA_ADDED' | 'ALLOCATION_FAILED' | 'NODE_LEFT' | 'REROUTE_CANCELLED' | 'REINITIALIZED' | 'REALLOCATED_REPLICA' | 'PRIMARY_FAILED' | 'FORCED_EMPTY_PRIMARY' | 'MANUAL_ALLOCATION' + export interface ClusterDeleteComponentTemplateRequest extends RequestBase { name: Name + cluster_manager_timeout?: Time master_timeout?: Time timeout?: Time } @@ -6284,10 +6314,12 @@ export interface ClusterExistsComponentTemplateResponse { stub: integer } + export interface ClusterGetComponentTemplateRequest extends RequestBase { name?: Name flat_settings?: boolean local?: boolean + cluster_manager_timeout?: Time master_timeout?: Time } @@ -6295,9 +6327,11 @@ export interface ClusterGetComponentTemplateResponse { component_templates: ClusterComponentTemplate[] } + export interface ClusterGetSettingsRequest extends RequestBase { flat_settings?: boolean include_defaults?: boolean + cluster_manager_timeout?: Time master_timeout?: Time timeout?: Time } @@ -6320,11 +6354,13 @@ export interface ClusterHealthIndexHealthStats { unassigned_shards: integer } + export interface ClusterHealthRequest extends RequestBase { index?: Indices expand_wildcards?: ExpandWildcards level?: Level local?: boolean + cluster_manager_timeout?: Time master_timeout?: Time timeout?: Time wait_for_active_shards?: WaitForActiveShards @@ -6371,8 +6407,10 @@ export interface ClusterPendingTasksPendingTask { time_in_queue_millis: integer } + export interface ClusterPendingTasksRequest extends RequestBase { local?: boolean + cluster_manager_timeout?: Time master_timeout?: Time } @@ -6380,9 +6418,11 @@ export interface ClusterPendingTasksResponse { tasks: ClusterPendingTasksPendingTask[] } + export interface ClusterPutComponentTemplateRequest extends RequestBase { name: Name create?: boolean + cluster_manager_timeout?: Time master_timeout?: Time body?: { template: IndicesIndexState @@ -6397,8 +6437,10 @@ export interface ClusterPutComponentTemplateRequest extends RequestBase { export interface ClusterPutComponentTemplateResponse extends AcknowledgedResponseBase { } + export interface ClusterPutSettingsRequest extends RequestBase { flat_settings?: boolean + cluster_manager_timeout?: Time master_timeout?: Time timeout?: Time body?: { @@ -6477,11 +6519,13 @@ export interface ClusterRerouteCommandMoveAction { to_node: string } + export interface ClusterRerouteRequest extends RequestBase { dry_run?: boolean explain?: boolean metric?: Metrics retry_failed?: boolean + cluster_manager_timeout?: Time master_timeout?: Time timeout?: Time body?: { @@ -6513,6 +6557,7 @@ export interface ClusterRerouteRerouteParameters { export interface ClusterRerouteRerouteState { cluster_uuid: Uuid state_uuid?: Uuid + cluster_manager_node?: string master_node?: string version?: VersionNumber blocks?: EmptyObject @@ -6542,6 +6587,7 @@ export interface ClusterStateRequest extends RequestBase { flat_settings?: boolean ignore_unavailable?: boolean local?: boolean + cluster_manager_timeout?: Time master_timeout?: Time wait_for_metadata_version?: VersionNumber wait_for_timeout?: Time @@ -6550,6 +6596,7 @@ export interface ClusterStateRequest extends RequestBase { export interface ClusterStateResponse { cluster_name: Name cluster_uuid: Uuid + cluster_manager_node?: string master_node?: string state?: string[] state_uuid?: Uuid @@ -6643,7 +6690,8 @@ export interface ClusterStatsClusterNodeCount { coordinating_only: integer data: integer ingest: integer - master: integer + cluster_manager?: integer + master?: integer total: integer voting_only: integer remote_cluster_client: integer @@ -7054,6 +7102,7 @@ export interface IndicesAddBlockRequest extends RequestBase { allow_no_indices?: boolean expand_wildcards?: ExpandWildcards ignore_unavailable?: boolean + cluster_manager_timeout?: Time master_timeout?: Time timeout?: Time } @@ -7146,6 +7195,7 @@ export interface IndicesClearCacheResponse extends ShardsOperationResponseBase { export interface IndicesCloneRequest extends RequestBase { index: IndexName target: Name + cluster_manager_timeout?: Time master_timeout?: Time timeout?: Time wait_for_active_shards?: WaitForActiveShards @@ -7174,6 +7224,7 @@ export interface IndicesCloseRequest extends RequestBase { allow_no_indices?: boolean expand_wildcards?: ExpandWildcards ignore_unavailable?: boolean + cluster_manager_timeout?: Time master_timeout?: Time timeout?: Time wait_for_active_shards?: WaitForActiveShards @@ -7187,6 +7238,7 @@ export interface IndicesCloseResponse extends AcknowledgedResponseBase { export interface IndicesCreateRequest extends RequestBase { index: IndexName include_type_name?: boolean + cluster_manager_timeout?: Time master_timeout?: Time timeout?: Time wait_for_active_shards?: WaitForActiveShards @@ -7207,6 +7259,7 @@ export interface IndicesDeleteRequest extends RequestBase { allow_no_indices?: boolean expand_wildcards?: ExpandWildcards ignore_unavailable?: boolean + cluster_manager_timeout?: Time master_timeout?: Time timeout?: Time } @@ -7217,6 +7270,7 @@ export interface IndicesDeleteResponse extends IndicesResponseBase { export interface IndicesDeleteAliasRequest extends RequestBase { index: Indices name: Names + cluster_manager_timeout?: Time master_timeout?: Time timeout?: Time } @@ -7233,6 +7287,7 @@ export interface IndicesDeleteIndexTemplateResponse extends AcknowledgedResponse export interface IndicesDeleteTemplateRequest extends RequestBase { name: Name + cluster_manager_timeout?: Time master_timeout?: Time timeout?: Time } @@ -7265,6 +7320,7 @@ export type IndicesExistsAliasResponse = boolean export interface IndicesExistsIndexTemplateRequest extends RequestBase { name: Name + cluster_manager_timeout?: Time master_timeout?: Time } @@ -7274,6 +7330,7 @@ export interface IndicesExistsTemplateRequest extends RequestBase { name: Names flat_settings?: boolean local?: boolean + cluster_manager_timeout?: Time master_timeout?: Time } @@ -7335,6 +7392,7 @@ export interface IndicesGetRequest extends RequestBase { include_defaults?: boolean include_type_name?: boolean local?: boolean + cluster_manager_timeout?: Time master_timeout?: Time } @@ -7404,6 +7462,7 @@ export interface IndicesGetIndexTemplateRequest extends RequestBase { body?: { flat_settings?: boolean include_type_name?: boolean + cluster_manager_timeout?: Time master_timeout?: Time } } @@ -7425,6 +7484,7 @@ export interface IndicesGetMappingRequest extends RequestBase { ignore_unavailable?: boolean include_type_name?: boolean local?: boolean + cluster_manager_timeout?: Time master_timeout?: Time } @@ -7440,6 +7500,7 @@ export interface IndicesGetSettingsRequest extends RequestBase { ignore_unavailable?: boolean include_defaults?: boolean local?: boolean + cluster_manager_timeout?: Time master_timeout?: Time } @@ -7451,6 +7512,7 @@ export interface IndicesGetTemplateRequest extends RequestBase { flat_settings?: boolean include_type_name?: boolean local?: boolean + cluster_manager_timeout?: Time master_timeout?: Time } @@ -7471,6 +7533,7 @@ export interface IndicesOpenRequest extends RequestBase { allow_no_indices?: boolean expand_wildcards?: ExpandWildcards ignore_unavailable?: boolean + cluster_manager_timeout?: Time master_timeout?: Time timeout?: Time wait_for_active_shards?: WaitForActiveShards @@ -7483,6 +7546,7 @@ export interface IndicesOpenResponse extends AcknowledgedResponseBase { export interface IndicesPutAliasRequest extends RequestBase { index: Indices name: Name + cluster_manager_timeout?: Time master_timeout?: Time timeout?: Time body?: { @@ -7526,6 +7590,7 @@ export interface IndicesPutMappingRequest extends RequestBase { expand_wildcards?: ExpandWildcards ignore_unavailable?: boolean include_type_name?: boolean + cluster_manager_timeout?: Time master_timeout?: Time timeout?: Time write_index_only?: boolean @@ -7560,6 +7625,7 @@ export interface IndicesPutSettingsRequest extends RequestBase { expand_wildcards?: ExpandWildcards flat_settings?: boolean ignore_unavailable?: boolean + cluster_manager_timeout?: Time master_timeout?: Time preserve_existing?: boolean timeout?: Time @@ -7574,6 +7640,7 @@ export interface IndicesPutTemplateRequest extends RequestBase { create?: boolean flat_settings?: boolean include_type_name?: boolean + cluster_manager_timeout?: Time master_timeout?: Time timeout?: Time body?: { @@ -7737,6 +7804,7 @@ export interface IndicesRolloverRequest extends RequestBase { new_index?: IndexName dry_run?: boolean include_type_name?: boolean + cluster_manager_timeout?: Time master_timeout?: Time timeout?: Time wait_for_active_shards?: WaitForActiveShards @@ -7848,6 +7916,7 @@ export interface IndicesShardStoresShardStoreWrapper { export interface IndicesShrinkRequest extends RequestBase { index: IndexName target: IndexName + cluster_manager_timeout?: Time master_timeout?: Time timeout?: Time wait_for_active_shards?: WaitForActiveShards @@ -7878,6 +7947,7 @@ export interface IndicesSimulateIndexTemplateResponse { export interface IndicesSimulateTemplateRequest extends RequestBase { name?: Name create?: boolean + cluster_manager_timeout?: Time master_timeout?: Time body?: IndicesGetIndexTemplateIndexTemplate } @@ -7889,6 +7959,7 @@ export interface IndicesSimulateTemplateResponse { export interface IndicesSplitRequest extends RequestBase { index: IndexName target: IndexName + cluster_manager_timeout?: Time master_timeout?: Time timeout?: Time wait_for_active_shards?: WaitForActiveShards @@ -8040,6 +8111,7 @@ export interface IndicesUpdateAliasesIndicesUpdateAliasBulk { } export interface IndicesUpdateAliasesRequest extends RequestBase { + cluster_manager_timeout?: Time master_timeout?: Time timeout?: Time body?: { @@ -8402,6 +8474,7 @@ export type IngestUserAgentProperty = 'NAME' | 'MAJOR' | 'MINOR' | 'PATCH' | 'OS export interface IngestDeletePipelineRequest extends RequestBase { id: Id + cluster_manager_timeout?: Time master_timeout?: Time timeout?: Time } @@ -8436,6 +8509,7 @@ export interface IngestGeoIpStatsResponse { export interface IngestGetPipelineRequest extends RequestBase { id?: Id + cluster_manager_timeout?: Time master_timeout?: Time summary?: boolean } @@ -8452,6 +8526,7 @@ export interface IngestProcessorGrokResponse { export interface IngestPutPipelineRequest extends RequestBase { id: Id + cluster_manager_timeout?: Time master_timeout?: Time timeout?: Time body?: { @@ -8887,6 +8962,7 @@ export interface NodesInfoNodeInfoSettingsCluster { name: Name routing?: IndicesIndexRouting election: NodesInfoNodeInfoSettingsClusterElection + initial_cluster_manager_nodes?: string initial_master_nodes?: string } @@ -8982,6 +9058,7 @@ export interface NodesInfoRequest extends RequestBase { node_id?: NodeIds metric?: Metrics flat_settings?: boolean + cluster_manager_timeout?: Time master_timeout?: Time timeout?: Time } @@ -9025,6 +9102,7 @@ export interface NodesStatsRequest extends RequestBase { groups?: boolean include_segment_file_sizes?: boolean level?: Level + cluster_manager_timeout?: Time master_timeout?: Time timeout?: Time types?: string[] @@ -9206,6 +9284,7 @@ export interface SnapshotCleanupRepositoryCleanupRepositoryResults { export interface SnapshotCleanupRepositoryRequest extends RequestBase { repository: Name + cluster_manager_timeout?: Time master_timeout?: Time timeout?: Time } @@ -9218,6 +9297,7 @@ export interface SnapshotCloneRequest extends RequestBase { repository: Name snapshot: Name target_snapshot: Name + cluster_manager_timeout?: Time master_timeout?: Time timeout?: Time body?: { @@ -9231,6 +9311,7 @@ export interface SnapshotCloneResponse extends AcknowledgedResponseBase { export interface SnapshotCreateRequest extends RequestBase { repository: Name snapshot: Name + cluster_manager_timeout?: Time master_timeout?: Time wait_for_completion?: boolean body?: { @@ -9249,6 +9330,7 @@ export interface SnapshotCreateResponse { export interface SnapshotCreateRepositoryRequest extends RequestBase { repository: Name + cluster_manager_timeout?: Time master_timeout?: Time timeout?: Time verify?: boolean @@ -9265,6 +9347,7 @@ export interface SnapshotCreateRepositoryResponse extends AcknowledgedResponseBa export interface SnapshotDeleteRequest extends RequestBase { repository: Name snapshot: Name + cluster_manager_timeout?: Time master_timeout?: Time } @@ -9273,6 +9356,7 @@ export interface SnapshotDeleteResponse extends AcknowledgedResponseBase { export interface SnapshotDeleteRepositoryRequest extends RequestBase { repository: Names + cluster_manager_timeout?: Time master_timeout?: Time timeout?: Time } @@ -9284,6 +9368,7 @@ export interface SnapshotGetRequest extends RequestBase { repository: Name snapshot: Names ignore_unavailable?: boolean + cluster_manager_timeout?: Time master_timeout?: Time verbose?: boolean index_details?: boolean @@ -9304,6 +9389,7 @@ export interface SnapshotGetSnapshotResponseItem { export interface SnapshotGetRepositoryRequest extends RequestBase { repository?: Names local?: boolean + cluster_manager_timeout?: Time master_timeout?: Time } @@ -9313,6 +9399,7 @@ export interface SnapshotGetRepositoryResponse extends DictionaryResponseBase any; // /Extend API +// both cluster_manager and master in NodeOptions roles +// are optional due to backward compatibility concern. +// toDo: remove master role if it is completed removed. interface NodeOptions { url: URL; id?: string; @@ -84,7 +87,8 @@ interface NodeOptions { ssl?: TlsConnectionOptions; headers?: Record; roles?: { - master: boolean; + cluster_manager?: boolean + master?: boolean; data: boolean; ingest: boolean; } @@ -167,6 +171,10 @@ declare class Client { allocation, TContext = Context>(callback: callbackFn): TransportRequestCallback allocation, TContext = Context>(params: RequestParams.CatAllocation, callback: callbackFn): TransportRequestCallback allocation, TContext = Context>(params: RequestParams.CatAllocation, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback + cluster_manager, TContext = Context>(params?: RequestParams.CatClusterManager, options?: TransportRequestOptions): TransportRequestPromise> + cluster_manager, TContext = Context>(callback: callbackFn): TransportRequestCallback + cluster_manager, TContext = Context>(params: RequestParams.CatClusterManager, callback: callbackFn): TransportRequestCallback + cluster_manager, TContext = Context>(params: RequestParams.CatClusterManager, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback count, TContext = Context>(params?: RequestParams.CatCount, options?: TransportRequestOptions): TransportRequestPromise> count, TContext = Context>(callback: callbackFn): TransportRequestCallback count, TContext = Context>(params: RequestParams.CatCount, callback: callbackFn): TransportRequestCallback @@ -187,6 +195,8 @@ declare class Client { indices, TContext = Context>(callback: callbackFn): TransportRequestCallback indices, TContext = Context>(params: RequestParams.CatIndices, callback: callbackFn): TransportRequestCallback indices, TContext = Context>(params: RequestParams.CatIndices, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback + // cat.master api is deprecated. + // toDo: delete cat.master api when it is removed from OpenSearch master, TContext = Context>(params?: RequestParams.CatMaster, options?: TransportRequestOptions): TransportRequestPromise> master, TContext = Context>(callback: callbackFn): TransportRequestCallback master, TContext = Context>(params: RequestParams.CatMaster, callback: callbackFn): TransportRequestCallback diff --git a/lib/Connection.d.ts b/lib/Connection.d.ts index 3df2dafd1..a1a0b31f6 100644 --- a/lib/Connection.d.ts +++ b/lib/Connection.d.ts @@ -54,6 +54,7 @@ export interface ConnectionOptions { } interface ConnectionRoles { + cluster_manager?: boolean master?: boolean data?: boolean ingest?: boolean @@ -78,7 +79,8 @@ export default class Connection { DEAD: string; }; static roles: { - MASTER: string; + CLUSTER_MANAGER?: string; + MASTER?: string; DATA: string; INGEST: string; }; diff --git a/lib/Connection.js b/lib/Connection.js index c0ab2e6fd..3de87c663 100644 --- a/lib/Connection.js +++ b/lib/Connection.js @@ -293,13 +293,13 @@ Connection.statuses = { } Connection.roles = { + CLUSTER_MANAGER: 'cluster_manager', MASTER: 'master', DATA: 'data', INGEST: 'ingest' } const defaultRoles = { - [Connection.roles.MASTER]: true, [Connection.roles.DATA]: true, [Connection.roles.INGEST]: true } diff --git a/lib/Transport.js b/lib/Transport.js index ce67a5c42..0180e5447 100644 --- a/lib/Transport.js +++ b/lib/Transport.js @@ -610,8 +610,9 @@ function isStream (obj) { } function defaultNodeFilter (node) { - // avoid master only nodes - if (node.roles.master === true && + // avoid cluster_manager or master only nodes + // toDo: remove role check on master when master is not supported + if (node.roles.cluster_manager === true | node.roles.master === true && node.roles.data === false && node.roles.ingest === false) { return false diff --git a/lib/pool/BaseConnectionPool.js b/lib/pool/BaseConnectionPool.js index 05243415a..928784670 100644 --- a/lib/pool/BaseConnectionPool.js +++ b/lib/pool/BaseConnectionPool.js @@ -243,7 +243,6 @@ class BaseConnectionPool { url: new URL(address), id: ids[i], roles: Object.assign({ - [Connection.roles.MASTER]: false, [Connection.roles.DATA]: false, [Connection.roles.INGEST]: false }, roles) diff --git a/lib/pool/ConnectionPool.js b/lib/pool/ConnectionPool.js index 7fca12550..6b01bc5b6 100644 --- a/lib/pool/ConnectionPool.js +++ b/lib/pool/ConnectionPool.js @@ -188,7 +188,7 @@ class ConnectionPool extends BaseConnectionPool { /** * Returns an alive connection if present, * otherwise returns a dead connection. - * By default it filters the `master` only nodes. + * By default it filters the `cluster_manager` or `master` only nodes. * It uses the selector to choose which * connection return. * diff --git a/lib/pool/index.d.ts b/lib/pool/index.d.ts index c08098fd7..b66607764 100644 --- a/lib/pool/index.d.ts +++ b/lib/pool/index.d.ts @@ -109,7 +109,7 @@ declare class BaseConnectionPool { /** * Returns an alive connection if present, * otherwise returns a dead connection. - * By default it filters the `master` only nodes. + * By default it filters the `cluster_manager` or `master` only nodes. * It uses the selector to choose which * connection return. * diff --git a/test/acceptance/sniff.test.js b/test/acceptance/sniff.test.js index 9d3e1b5ce..e139d8202 100644 --- a/test/acceptance/sniff.test.js +++ b/test/acceptance/sniff.test.js @@ -65,6 +65,7 @@ test('Should update the connection pool', t => { }) // run the sniffer + // toDo: modify node roles when master is not supported client.transport.sniff((err, hosts) => { t.error(err) t.equal(hosts.length, 4) diff --git a/test/fixtures/stackoverflow.ndjson b/test/fixtures/stackoverflow.ndjson index 154138b19..3f6381874 100644 --- a/test/fixtures/stackoverflow.ndjson +++ b/test/fixtures/stackoverflow.ndjson @@ -25,7 +25,7 @@ {"id":"9789560","title":"Dimension-independent loop over boost::multi_array?","body":"\u003cp\u003eSay I've got an N-dimensional boost::multi_array (of type int for simplicity), where \u003ccode\u003eN\u003c/code\u003e is known at compile time but can vary (i.e. is a non-type template parameter). Let's assume that all dimensions have equal size \u003ccode\u003em\u003c/code\u003e.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003etypedef boost::multi_array\u0026lt;int, N\u0026gt; tDataArray;\nboost::array\u0026lt;tDataArray::index, N\u0026gt; shape;\nshape.fill(m);\ntDataArray A(shape);\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eNow I would like to loop over all entries in \u003ccode\u003eA\u003c/code\u003e, e.g. to print them. If N was 2 for example I think I would write something like this\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e boost::array\u0026lt;tDataArray::index, 2\u0026gt; index;\n for ( int i = 0; i \u0026lt; m; i++ )\n {\n for ( int j = 0; j \u0026lt; m; j++ )\n {\n index = {{ i, j }};\n cout \u0026lt;\u0026lt; A ( index ) \u0026lt;\u0026lt; endl;\n }\n }\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI've used an index object to access the elements as I think this is more flexible than the []-operator here.\u003c/p\u003e\n\n\u003cp\u003eBut how could I write this without knowing the number of dimensions \u003ccode\u003eN\u003c/code\u003e. Is there any built-in way? The documentation of multi_array is not very clear on which types of iterators exist, etc.\nOr would I have to resort to some custom method with custom pointers, computing indices from the pointers, etc.? If so - any suggestions how such an algorithm could look like?\u003c/p\u003e","accepted_answer_id":"9837332","answer_count":"3","comment_count":"4","creation_date":"2012-03-20 15:17:45.25 UTC","favorite_count":"1","last_activity_date":"2016-05-10 14:33:20.56 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"392772","post_type_id":"1","score":"5","tags":"c++|algorithm|boost|multidimensional-array","view_count":"1807"} {"id":"43787891","title":"Get element being sorted within helper function","body":"\u003cp\u003ei'm using jQuery UI and would like to modify the helper So I do this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e$(\"#container\").sortable({\n helper: function(event, ui) {\n var newHelper = ; // new helper HTML\n return newHelper;\n }\n});\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eMy question is: How can I get the element being sorted within the helper function? I want to get the height of the sorted element but can't get the element to begin with. I have tried the following with no luck:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eui.item;\nui.element;\nui.helper; \n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"43788125","answer_count":"2","comment_count":"2","creation_date":"2017-05-04 16:06:37.347 UTC","last_activity_date":"2017-05-04 16:36:31.59 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"3758078","post_type_id":"1","score":"-1","tags":"jquery|user-interface|jquery-ui-sortable","view_count":"75"} {"id":"18972984","title":"How am I supposed to get the Container instance for my app","body":"\u003cp\u003eI can get access to this variable using the private instance variable \u003ccode\u003eApp.__container__\u003c/code\u003e, but this is obviously bad practice.\u003c/p\u003e","answer_count":"0","comment_count":"3","creation_date":"2013-09-24 04:30:05.153 UTC","last_activity_date":"2013-09-24 04:30:05.153 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"822249","post_type_id":"1","score":"0","tags":"ember.js","view_count":"22"} -{"id":"38158235","title":"How topojson's world map scale has set?","body":"\u003cp\u003ein \u003ca href=\"https://github.com/mbostock/topojson/blob/master/examples/world-110m.json\" rel=\"nofollow\"\u003eworld-110m.json\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003ethere is a scale value.\n\u003ccode\u003e[0.0036000360003600037, 0.0017364686646866468]\u003c/code\u003e\u003c/p\u003e\n\n\u003cp\u003eand I got this values are computed from \u003ccode\u003e[360/99990, 173.64513/99999]\u003c/code\u003e\u003c/p\u003e\n\n\u003cp\u003eok, \u003ccode\u003e360\u003c/code\u003e from latitude, \u003ccode\u003e173.64\u003c/code\u003e from longitude, just for including northernmost lang point.\u003c/p\u003e\n\n\u003cp\u003ebut where does that denominators (\u003ccode\u003e99990\u003c/code\u003e and \u003ccode\u003e99999\u003c/code\u003e) came from?\u003c/p\u003e","answer_count":"1","comment_count":"3","creation_date":"2016-07-02 08:44:30.547 UTC","last_activity_date":"2016-07-02 16:54:09.733 UTC","last_edit_date":"2016-07-02 08:55:26.807 UTC","last_editor_display_name":"","last_editor_user_id":"5107380","owner_display_name":"","owner_user_id":"5107380","post_type_id":"1","score":"0","tags":"d3.js|geospatial|topojson","view_count":"29"} +{"id":"38158235","title":"How topojson's world map scale has set?","body":"\u003cp\u003ein \u003ca href=\"https://github.com/mbostock/topojson/blob/main/examples/world-110m.json\" rel=\"nofollow\"\u003eworld-110m.json\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003ethere is a scale value.\n\u003ccode\u003e[0.0036000360003600037, 0.0017364686646866468]\u003c/code\u003e\u003c/p\u003e\n\n\u003cp\u003eand I got this values are computed from \u003ccode\u003e[360/99990, 173.64513/99999]\u003c/code\u003e\u003c/p\u003e\n\n\u003cp\u003eok, \u003ccode\u003e360\u003c/code\u003e from latitude, \u003ccode\u003e173.64\u003c/code\u003e from longitude, just for including northernmost lang point.\u003c/p\u003e\n\n\u003cp\u003ebut where does that denominators (\u003ccode\u003e99990\u003c/code\u003e and \u003ccode\u003e99999\u003c/code\u003e) came from?\u003c/p\u003e","answer_count":"1","comment_count":"3","creation_date":"2016-07-02 08:44:30.547 UTC","last_activity_date":"2016-07-02 16:54:09.733 UTC","last_edit_date":"2016-07-02 08:55:26.807 UTC","last_editor_display_name":"","last_editor_user_id":"5107380","owner_display_name":"","owner_user_id":"5107380","post_type_id":"1","score":"0","tags":"d3.js|geospatial|topojson","view_count":"29"} {"id":"17394826","title":"JS events source detection","body":"\u003cp\u003eI'm working on a part of my web site where people can vote on publications, I have many in the same page, and next every publication there are two images one to agree and the other to disagree. I want to change the images, so when someone votes, whether agree or not, the image changes to say he already voted.\nHere's my code:\u003c/p\u003e\n\n\u003cp\u003eJPS:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;logic:iterate id=\"comment\" name=\"Liste_Comments\" scope=\"request\"\u0026gt; \n\u0026lt;html:img src=\"pages/images/ok.png\" alt=\"Vote pour!\" paramId=\"code\" paramName=\"comment\" paramProperty=\"code\" onclick=\"voterComment('pour');\"/\u0026gt; \n\n\u0026lt;html:img src=\"pages/images/ko.png\" alt=\"Vote contre!\" paramId=\"code\" paramName=\"comment\" paramProperty=\"code\" onclick=\"voterComment('contre');\"/\u0026gt; \n\n \u0026lt;bean:write name=\"comment\" property=\"libelle\" /\u0026gt; \n \u0026lt;bean:write name=\"comment\" property=\"subject\" /\u0026gt; \n \u0026lt;br\u0026gt; \n\u0026lt;/logic:iterate\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eScript:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;script type=\"text/javascript\"\u0026gt;\n function voterComment(vote) { \n var url = \"\u0026lt;%=request.getContextPath()%\u0026gt;/VoteComment.do\";\n new Ajax.Request(url, {\n parameters: {vote: vote},\n onSuccess: function(transport, json) {\n if (json.error) {\n alert(json.error);\n }\n else{\n window.event.srcElement.src = \"pages/images/photo.jpg\";\n }\n }\n });\n }\n \u0026lt;/script\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI have a problem to access to the image that was clicked!!\u003c/p\u003e\n\n\u003cp\u003eThanks guys, in advance, for your great helping :)\u003c/p\u003e","accepted_answer_id":"17394886","answer_count":"1","comment_count":"0","creation_date":"2013-06-30 21:02:45.877 UTC","last_activity_date":"2013-06-30 22:51:40.343 UTC","last_edit_date":"2013-06-30 22:51:40.343 UTC","last_editor_display_name":"","last_editor_user_id":"249624","owner_display_name":"","owner_user_id":"2490377","post_type_id":"1","score":"0","tags":"javascript","view_count":"47"} {"id":"20116426","title":"Quick algorithm of comparing sums of two arrays?","body":"\u003cp\u003eSuppose I have 2 integer arrays, they could be not in same length and value on any index is a valid integer (min ~ max). such as:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eint data1[] = {1227210749, 382745290, 567552295, 1910060611,\n 577735884, 75518037, 742485551, 1202127013, \n 386030509, 308032134};\n\nint data2[] = {1729472635, 1258098863, 259427472, 1664987257, \n 994376913, 1581883691, 1728724734, 2034013490};\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHow could I quickly compare of them to know which one have a bigger sum?\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eint compare(int a[], int len_a, int b[], int len_b)\n{\n // compares if the sum of data1 is bigger than sum of data2\n} \n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"20116775","answer_count":"4","comment_count":"3","creation_date":"2013-11-21 09:01:26.533 UTC","last_activity_date":"2013-11-21 10:34:19.043 UTC","last_edit_date":"2013-11-21 09:04:01.78 UTC","last_editor_display_name":"","last_editor_user_id":"28169","owner_display_name":"","owner_user_id":"768722","post_type_id":"1","score":"-5","tags":"c++|c|algorithm|sorting","view_count":"176"} {"id":"10094601","title":"Erlang Web framework and SSL?","body":"\u003cp\u003eCan anyone either 1) tell me how to do it, or 2) point me to a resource on how to run/enable/use SSL with the Erlang Web framework? I can't find anything in any docs or online web searches, and it looks like the last post to their mailing list is a couple of years old.\u003c/p\u003e\n\n\u003cp\u003eThanks.\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2012-04-10 18:46:37.64 UTC","last_activity_date":"2012-04-11 07:51:34.913 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1324831","post_type_id":"1","score":"1","tags":"ssl|frameworks|erlang","view_count":"448"} @@ -156,7 +156,7 @@ {"id":"12943531","title":"PUT without data, is it RESTful?","body":"\u003cp\u003eSimple question: what if I'm NOT sending data (content) via HTTP POST/PUT method on my resource — is it still RESTful?\u003c/p\u003e\n\n\u003cp\u003eObviously, the question is in which case would I want use PUT without data. Imagine a user that wants to reset his/her password (like in \u003ca href=\"https://stackoverflow.com/questions/3077229/restful-password-reset\"\u003ethis older topic\u003c/a\u003e).\u003c/p\u003e\n\n\u003cp\u003eWhat do you think of it? Is it okay NOT to send content with POST/PUT methods? Personally I have no problem with it but I'm just curious what would other people say.\u003c/p\u003e","accepted_answer_id":"12943705","answer_count":"2","comment_count":"0","creation_date":"2012-10-17 21:16:57.353 UTC","last_activity_date":"2012-10-18 09:20:56.783 UTC","last_edit_date":"2017-05-23 11:43:40.38 UTC","last_editor_display_name":"","last_editor_user_id":"-1","owner_display_name":"","owner_user_id":"597222","post_type_id":"1","score":"7","tags":"http|rest","view_count":"761"} {"id":"28908529","title":"Remove records based on other record values in R","body":"\u003cp\u003eI have three columns of data: Recipient_ID, Offer_Key, and Response_Code\u003c/p\u003e\n\n\u003cp\u003eWhenever an email is sent, a record is generated with Response_Code = 1\u003c/p\u003e\n\n\u003cp\u003eWhenever an email bounces, the Response_Code = 2, 3, or 4, depending on the type of bounce.\u003c/p\u003e\n\n\u003cp\u003eWhat I want to do is find the bounced email records, remove the corresponding sent email records for each one(with the same Offer_Key), then remove the bounced email records.\u003c/p\u003e\n\n\u003cp\u003eAny ideas?\u003c/p\u003e","accepted_answer_id":"28908819","answer_count":"1","comment_count":"0","creation_date":"2015-03-06 22:09:22.78 UTC","last_activity_date":"2015-03-07 06:59:16.097 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"3384596","post_type_id":"1","score":"0","tags":"database|r|record","view_count":"45"} {"id":"13193872","title":"Core Data, NSPredicate, ANY key.path == nil","body":"\u003cp\u003eI came up with a solution to this using subquery, but I don't understand why what I was trying to do first didn't work.\u003c/p\u003e\n\n\u003cp\u003eHere's my data model. I'm fetching on Advice.\u003c/p\u003e\n\n\u003cp\u003e\u003cimg src=\"https://i.stack.imgur.com/vgOE2.png\" alt=\"enter image description here\"\u003e\u003c/p\u003e\n\n\u003cp\u003eI can do the following as a predicate:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e[NSPredicate predicateWithFormat:@\"ANY conditions.terrain == %@\", aTerrainObject];\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ethat works fine, and returns any piece of advice where at least one of its conditions has that terrain type.\u003c/p\u003e\n\n\u003cp\u003eHowever, when I try to do this, it fails:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e[NSPredicate predicateWithFormat:@\"ANY conditions.terrain == nil\"];\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhat I want to do is return any piece of advice where at least one of its conditions doesn't have a terrain type set.\u003c/p\u003e\n\n\u003cp\u003eHowever, the following does work:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e[NSPredicate predicateWithFormat:@\"SUBQUERY(conditions, $x, $x.terrain == nil).@count \u0026gt; 0\"];\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eCan anyone explain why, when searching for nil, I can't use the \u003ccode\u003eANY\u003c/code\u003e syntax?\u003c/p\u003e","accepted_answer_id":"13200639","answer_count":"2","comment_count":"1","creation_date":"2012-11-02 10:57:16.99 UTC","favorite_count":"3","last_activity_date":"2012-11-02 17:56:38.13 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"244340","post_type_id":"1","score":"8","tags":"core-data|nspredicate","view_count":"4458"} -{"id":"8019921","title":"Android sqlite from pc","body":"\u003cp\u003eI have a pre-baked sqlite database that I want to use in my Android application.\u003c/p\u003e\n\n\u003cp\u003eI've followed this tutorial: \n\u003ca href=\"http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/\" rel=\"nofollow noreferrer\"\u003ehttp://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eHowever nothing is throwing an exception during the process of building and copying the db,\nbut when I access the db tables, they are not there, like they don't exist.\u003c/p\u003e\n\n\u003cp\u003eI made this sql query:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003edatabase.rawQuery(\"SELECT * FROM sqlite_master\", null).getCount();\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eand I got the answer: 1. (I have 5 tables)\u003c/p\u003e\n\n\u003cp\u003eAny help?\u003c/p\u003e","accepted_answer_id":"8020141","answer_count":"2","comment_count":"1","creation_date":"2011-11-05 11:38:36.62 UTC","last_activity_date":"2016-11-11 15:58:27.85 UTC","last_edit_date":"2016-11-11 15:58:27.85 UTC","last_editor_display_name":"","last_editor_user_id":"4370109","owner_display_name":"","owner_user_id":"906364","post_type_id":"1","score":"0","tags":"android|database|sqlite","view_count":"788"} +{"id":"8019921","title":"Android sqlite from pc","body":"\u003cp\u003eI have a pre-baked sqlite database that I want to use in my Android application.\u003c/p\u003e\n\n\u003cp\u003eI've followed this tutorial: \n\u003ca href=\"http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/\" rel=\"nofollow noreferrer\"\u003ehttp://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eHowever nothing is throwing an exception during the process of building and copying the db,\nbut when I access the db tables, they are not there, like they don't exist.\u003c/p\u003e\n\n\u003cp\u003eI made this sql query:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003edatabase.rawQuery(\"SELECT * FROM sqlite_cluster_manager\", null).getCount();\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eand I got the answer: 1. (I have 5 tables)\u003c/p\u003e\n\n\u003cp\u003eAny help?\u003c/p\u003e","accepted_answer_id":"8020141","answer_count":"2","comment_count":"1","creation_date":"2011-11-05 11:38:36.62 UTC","last_activity_date":"2016-11-11 15:58:27.85 UTC","last_edit_date":"2016-11-11 15:58:27.85 UTC","last_editor_display_name":"","last_editor_user_id":"4370109","owner_display_name":"","owner_user_id":"906364","post_type_id":"1","score":"0","tags":"android|database|sqlite","view_count":"788"} {"id":"41583139","title":"Appending Jquery Var to a function URL","body":"\u003cp\u003eHere I would like to append the variable arr_icao and dep_icao to the url\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003evar arr_icao = document.getElementById(\"arr_icao\").value;\nvar dep_icao = document.getElementById(\"dep_icao\").value;\n\n$.ajax({\n type: 'POST',\n url: \"http://localhost/position/route_finder/\" + arr_icao + dep_icao,\n success: function (data) {\n $(\".route-results\").html(data);\n }\n});\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"4","comment_count":"1","creation_date":"2017-01-11 05:11:43.437 UTC","last_activity_date":"2017-01-11 06:19:02.01 UTC","last_edit_date":"2017-01-11 05:14:14.053 UTC","last_editor_display_name":"","last_editor_user_id":"1288198","owner_display_name":"","owner_user_id":"7188833","post_type_id":"1","score":"-3","tags":"php|html|ajax|codeigniter","view_count":"28"} {"id":"21124558","title":"Custom Client MessageInspector recording requests but not responses","body":"\u003cp\u003eI have a Custom ClientMessageInspector that records requests but not replies to my service.\u003c/p\u003e\n\n\u003cp\u003eThe code is:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003enamespace MessageListener.Instrumentation\n{\n public class MessageInspector : IClientMessageInspector\n {\n\n private Message TraceMessage(MessageBuffer buffer)\n {\n // Must use a buffer rather than the original message, because the Message's body can be processed only once.\n Message msg = buffer.CreateMessage();\n\n using (RREM_GilbaneEntities3 entities3 = new RREM_GilbaneEntities3())\n {\n SOAPMessage soapMessages = new SOAPMessage\n {\n SOAPMessage1 = msg.ToString(),\n created = DateTime.Now,\n source = \"Interface12\",\n sourceIP = \"Interface12\"\n };\n entities3.SOAPMessages.Add(soapMessages);\n entities3.SaveChanges();\n }\n\n //Return copy of origonal message with unalterd State\n return buffer.CreateMessage();\n }\n\n public void AfterReceiveReply(ref System.ServiceModel.Channels.Message reply, object correlationState)\n {\n reply = TraceMessage(reply.CreateBufferedCopy(int.MaxValue));\n }\n\n public object BeforeSendRequest(ref System.ServiceModel.Channels.Message request, System.ServiceModel.IClientChannel channel)\n {\n request = TraceMessage(request.CreateBufferedCopy(int.MaxValue));\n return null;\n }\n }\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhat seems to be happening is both AfterRecievReply and BeforeSendRequest are being called. In AfterRecieveReply before I call TraceMessage, I can see the whole reply. Inside TraceMessage, when I do:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e// Must use a buffer rather than the original message, because the Message's body can be processed only once.\n\n Message msg = buffer.CreateMessage();\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eit turns the reply into junk:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003emsg {\u0026lt;soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"\u0026gt;\n \u0026lt;soap:Header /\u0026gt;\n \u0026lt;soap:Body\u0026gt;... stream ...\u0026lt;/soap:Body\u0026gt;\n\u0026lt;/soap:Envelope\u0026gt;}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhat's going on?\u003c/p\u003e","accepted_answer_id":"21174892","answer_count":"1","comment_count":"0","creation_date":"2014-01-14 21:39:03.487 UTC","favorite_count":"2","last_activity_date":"2014-01-16 23:16:08.727 UTC","last_edit_date":"2014-01-14 21:46:14.437 UTC","last_editor_display_name":"","last_editor_user_id":"2471435","owner_display_name":"","owner_user_id":"2471435","post_type_id":"1","score":"0","tags":"wcf","view_count":"137"} {"id":"34534672","title":"How to Remove Border of Bootstrap Carousel","body":"\u003cp\u003eI need to remove the Border of Carousel in Bootstrap here is my work:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e.carousel-indicators .active{ background: #31708f; } \n.content{ margin-top:20px; } \n.adjust1{ float:left; width:100%; margin-bottom:0; } \n.adjust2{ margin:0; } \n.carousel-indicators li{ border :1px solid #ccc; } \n.carousel-control{ color:#31708f; width:5%; } \n.carousel-control:hover, \n.carousel-control:focus{ color:#31708f; } \n.carousel-control.left, .carousel-control.right { background-image: none; } \n.media-object{ margin:auto; margin-top:15%; } \n@media screen and (max-width: 768px) { .media-object{ margin-top:0; } }\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI'm trying to use \"border:0px\" but it doesnt work \u003cbr\u003e\nAny Idea ?\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2015-12-30 17:59:19.817 UTC","last_activity_date":"2015-12-30 18:02:06.847 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"2519696","post_type_id":"1","score":"0","tags":"twitter-bootstrap-3|carousel","view_count":"1275"} @@ -212,7 +212,7 @@ {"id":"17613518","title":"one function accepts different models and dynamically creates object according to that in django","body":"\u003cp\u003eI want to create a function like\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003edef dynamic_model(model_name,**kwargs)\n obj=model_name.object.create(**dct)\n return obj\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ebecause I don't want to do again and again create object and save them in database.you pass model name in function and object create according to passed **kwargs. How I import path runtime and what would be the body of function.\u003c/p\u003e\n\n\u003cp\u003e*\u003cem\u003eAnd main thing I don't know which model and from where it import .all things get visible me at runtime so how can I import the path regarding to model name in function *\u003c/em\u003e\u003c/p\u003e","answer_count":"2","comment_count":"3","creation_date":"2013-07-12 11:05:59.683 UTC","last_activity_date":"2013-12-06 10:32:12.1 UTC","last_edit_date":"2013-12-06 10:32:12.1 UTC","last_editor_display_name":"","last_editor_user_id":"759866","owner_display_name":"","owner_user_id":"2576049","post_type_id":"1","score":"0","tags":"django|function|python-2.7|import","view_count":"112"} {"id":"1763753","title":"Can .local files be used during VB6 compile to avoid registering COM ocx and dll files","body":"\u003cp\u003eIn an attempt to keep my build machine clean can .local files be used during the compile of an application or is there a better way to keep the bloat off the machine.\u003c/p\u003e","accepted_answer_id":"1764418","answer_count":"1","comment_count":"0","creation_date":"2009-11-19 14:41:25.75 UTC","favorite_count":"2","last_activity_date":"2009-11-19 16:05:48.027 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"117527","post_type_id":"1","score":"4","tags":"com|vb6|build","view_count":"575"} {"id":"19512033","title":"How to find Nearest Locations in Google Maps with radius and a particular area(without having Latitude \u0026 Longitude) as parameters in Asp.Net","body":"\u003cp\u003eHi i am trying to get the near by locations of a particular area surrounding 3 kms distance. \u003c/p\u003e\n\n\u003cp\u003eHere i am passing two parameters, \n1) one is radius i.e; surrounding 3 kms distance.\n2) second is particular area without having latitude and longitudes values.\u003c/p\u003e\n\n\u003ch2\u003eFor Example:\u003c/h2\u003e\n\n\u003cp\u003eI have Countries, States, Cities and Areas in by SQL Server database.\u003c/p\u003e\n\n\u003cp\u003eI have 4 dropdowns boxes for selecting above data.\u003c/p\u003e\n\n\u003cp\u003eNow i will select Country-India, State-A.P, City-Hyderabad, Area-Banjara Hills. \u003c/p\u003e\n\n\u003cp\u003eI need to get my output with areas surrounding 3 kms from selected area.\u003c/p\u003e\n\n\u003cp\u003eCan anyone Please help me in solving this Problem.\u003c/p\u003e\n\n\u003cp\u003eThanks, Chakri.\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2013-10-22 07:49:03.563 UTC","last_activity_date":"2013-10-22 08:04:17.303 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"2905833","post_type_id":"1","score":"0","tags":"asp.net|google-maps","view_count":"1091"} -{"id":"38818379","title":"Adding reactive.rb to project","body":"\u003cp\u003eI have a trouble with adding react.rb to my project.\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eAt first,\u003c/strong\u003e \u003ca href=\"https://github.com/reactrb/todo-tutorial\" rel=\"nofollow\"\u003eafter all steps\u003c/a\u003e with adding \u003ccode\u003ereactive_rails_generator\u003c/code\u003e is done, and i started my app, i have got the error:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eActionView::Template::Error (undefined method `load_asset' for Opal::Sprockets:Module):\n\n\u0026lt;%= javascript_include_tag 'application', 'data-turbolinks-track' =\u0026gt; true %\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eapp/views/layouts/grid/layout.html.erb:15:\u003c/p\u003e\n\n\u003cp\u003eI see all need gem's In Gemfile to work with react.rb\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003egem 'reactive-ruby' gem 'react-rails', '~\u0026gt; 1.3.0' gem 'opal-rails' gem 'therubyracer', platforms: :ruby gem 'react-router-rails', '~\u0026gt;0.13.3' gem 'reactive-router' gem 'reactive-record'\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eCan anyone help with that?\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eAt second,\u003c/strong\u003e i have a rake task message:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eWarning:[rake --tasks] DEPRECATION WARNING: Sprockets method `register_engine` is deprecated.\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ePlease register a mime type using \u003ccode\u003eregister_mime_type\u003c/code\u003e then\nuse \u003ccode\u003eregister_compressor\u003c/code\u003e or \u003ccode\u003eregister_transformer\u003c/code\u003e.\n\u003ca href=\"https://github.com/rails/sprockets/blob/master/guides/extending_sprockets.md#supporting-all-versions-of-sprockets-in-processors\" rel=\"nofollow\"\u003ehttps://github.com/rails/sprockets/blob/master/guides/extending_sprockets.md#supporting-all-versions-of-sprockets-in-processors\u003c/a\u003e\n(called from at /Users/serzh/.rvm/gems/ruby-2.3.1@global/gems/opal-0.8.0/lib/opal/sprockets/processor.rb:165)\nDEPRECATION WARNING: Sprockets method \u003ccode\u003eregister_engine\u003c/code\u003e is deprecated.\nPlease register a mime type using \u003ccode\u003eregister_mime_type\u003c/code\u003e then\nuse \u003ccode\u003eregister_compressor\u003c/code\u003e or \u003ccode\u003eregister_transformer\u003c/code\u003e.\n\u003ca href=\"https://github.com/rails/sprockets/blob/master/guides/extending_sprockets.md#supporting-all-versions-of-sprockets-in-processors\" rel=\"nofollow\"\u003ehttps://github.com/rails/sprockets/blob/master/guides/extending_sprockets.md#supporting-all-versions-of-sprockets-in-processors\u003c/a\u003e\n(called from at /Users/serzh/.rvm/gems/ruby-2.3.1@global/gems/opal-0.8.0/lib/opal/sprockets/processor.rb:166)\nDEPRECATION WARNING: Sprockets method \u003ccode\u003eregister_engine\u003c/code\u003e is deprecated.\nPlease register a mime type using \u003ccode\u003eregister_mime_type\u003c/code\u003e then\nuse \u003ccode\u003eregister_compressor\u003c/code\u003e or \u003ccode\u003eregister_transformer\u003c/code\u003e.\n\u003ca href=\"https://github.com/rails/sprockets/blob/master/guides/extending_sprockets.md#supporting-all-versions-of-sprockets-in-processors\" rel=\"nofollow\"\u003ehttps://github.com/rails/sprockets/blob/master/guides/extending_sprockets.md#supporting-all-versions-of-sprockets-in-processors\u003c/a\u003e\n(called from at /Users/serzh/.rvm/gems/ruby-2.3.1@global/gems/opal-0.8.0/lib/opal/sprockets/erb.rb:23)\u003c/p\u003e","accepted_answer_id":"38834236","answer_count":"2","comment_count":"5","creation_date":"2016-08-07 20:44:46.42 UTC","last_activity_date":"2016-08-08 16:27:58.127 UTC","last_edit_date":"2016-08-07 22:04:09.787 UTC","last_editor_display_name":"","last_editor_user_id":"1334421","owner_display_name":"","owner_user_id":"1334421","post_type_id":"1","score":"0","tags":"ruby-on-rails|react.rb","view_count":"144"} +{"id":"38818379","title":"Adding reactive.rb to project","body":"\u003cp\u003eI have a trouble with adding react.rb to my project.\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eAt first,\u003c/strong\u003e \u003ca href=\"https://github.com/reactrb/todo-tutorial\" rel=\"nofollow\"\u003eafter all steps\u003c/a\u003e with adding \u003ccode\u003ereactive_rails_generator\u003c/code\u003e is done, and i started my app, i have got the error:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eActionView::Template::Error (undefined method `load_asset' for Opal::Sprockets:Module):\n\n\u0026lt;%= javascript_include_tag 'application', 'data-turbolinks-track' =\u0026gt; true %\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eapp/views/layouts/grid/layout.html.erb:15:\u003c/p\u003e\n\n\u003cp\u003eI see all need gem's In Gemfile to work with react.rb\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003egem 'reactive-ruby' gem 'react-rails', '~\u0026gt; 1.3.0' gem 'opal-rails' gem 'therubyracer', platforms: :ruby gem 'react-router-rails', '~\u0026gt;0.13.3' gem 'reactive-router' gem 'reactive-record'\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eCan anyone help with that?\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eAt second,\u003c/strong\u003e i have a rake task message:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eWarning:[rake --tasks] DEPRECATION WARNING: Sprockets method `register_engine` is deprecated.\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ePlease register a mime type using \u003ccode\u003eregister_mime_type\u003c/code\u003e then\nuse \u003ccode\u003eregister_compressor\u003c/code\u003e or \u003ccode\u003eregister_transformer\u003c/code\u003e.\n\u003ca href=\"https://github.com/rails/sprockets/blob/main/guides/extending_sprockets.md#supporting-all-versions-of-sprockets-in-processors\" rel=\"nofollow\"\u003ehttps://github.com/rails/sprockets/blob/main/guides/extending_sprockets.md#supporting-all-versions-of-sprockets-in-processors\u003c/a\u003e\n(called from at /Users/serzh/.rvm/gems/ruby-2.3.1@global/gems/opal-0.8.0/lib/opal/sprockets/processor.rb:165)\nDEPRECATION WARNING: Sprockets method \u003ccode\u003eregister_engine\u003c/code\u003e is deprecated.\nPlease register a mime type using \u003ccode\u003eregister_mime_type\u003c/code\u003e then\nuse \u003ccode\u003eregister_compressor\u003c/code\u003e or \u003ccode\u003eregister_transformer\u003c/code\u003e.\n\u003ca href=\"https://github.com/rails/sprockets/blob/main/guides/extending_sprockets.md#supporting-all-versions-of-sprockets-in-processors\" rel=\"nofollow\"\u003ehttps://github.com/rails/sprockets/blob/main/guides/extending_sprockets.md#supporting-all-versions-of-sprockets-in-processors\u003c/a\u003e\n(called from at /Users/serzh/.rvm/gems/ruby-2.3.1@global/gems/opal-0.8.0/lib/opal/sprockets/processor.rb:166)\nDEPRECATION WARNING: Sprockets method \u003ccode\u003eregister_engine\u003c/code\u003e is deprecated.\nPlease register a mime type using \u003ccode\u003eregister_mime_type\u003c/code\u003e then\nuse \u003ccode\u003eregister_compressor\u003c/code\u003e or \u003ccode\u003eregister_transformer\u003c/code\u003e.\n\u003ca href=\"https://github.com/rails/sprockets/blob/main/guides/extending_sprockets.md#supporting-all-versions-of-sprockets-in-processors\" rel=\"nofollow\"\u003ehttps://github.com/rails/sprockets/blob/main/guides/extending_sprockets.md#supporting-all-versions-of-sprockets-in-processors\u003c/a\u003e\n(called from at /Users/serzh/.rvm/gems/ruby-2.3.1@global/gems/opal-0.8.0/lib/opal/sprockets/erb.rb:23)\u003c/p\u003e","accepted_answer_id":"38834236","answer_count":"2","comment_count":"5","creation_date":"2016-08-07 20:44:46.42 UTC","last_activity_date":"2016-08-08 16:27:58.127 UTC","last_edit_date":"2016-08-07 22:04:09.787 UTC","last_editor_display_name":"","last_editor_user_id":"1334421","owner_display_name":"","owner_user_id":"1334421","post_type_id":"1","score":"0","tags":"ruby-on-rails|react.rb","view_count":"144"} {"id":"17155554","title":"what are difference of int initialize values?","body":"\u003cp\u003eI had some confusions about \u003ca href=\"https://stackoverflow.com/questions/17147553/int-num-new-int-what-happens-when-this-line-executes\"\u003e\u003cstrong\u003ethis thread\u003c/strong\u003e\u003c/a\u003e.\u003c/p\u003e\n\n\u003cp\u003eWhat are differences between these terms? When should I use what?\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eint x = default(int);\nint x = 0;\nint x = new int(); \n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI read here in \u003cstrong\u003e\u003ca href=\"http://bytes.com/topic/c-sharp/answers/662786-int-n-default-system-int32\" rel=\"nofollow noreferrer\"\u003ethis thread\u003c/a\u003e\u003c/strong\u003e. \u003c/p\u003e","answer_count":"3","comment_count":"4","creation_date":"2013-06-17 19:47:41.203 UTC","last_activity_date":"2017-07-30 02:34:45.9 UTC","last_edit_date":"2017-07-30 02:34:45.9 UTC","last_editor_display_name":"","last_editor_user_id":"1033581","owner_display_name":"","owner_user_id":"2469282","post_type_id":"1","score":"1","tags":"c#","view_count":"127"} {"id":"22458853","title":"Powershell - How to use webclient login a webpage (Cacti)","body":"\u003cp\u003eDoes anyone know how to use webclient to login Cacti?\u003cbr\u003e\nI am trying to use PowerShell to log into a website (Realm : Local).\u003cbr\u003e\nHowever I stuck on login page.\u003cbr\u003e\n\u003cimg src=\"https://i.stack.imgur.com/retRW.jpg\" alt=\"enter image description here\"\u003e\u003c/p\u003e\n\n\u003cp\u003eHtml code for this page : \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;tr\u0026gt;\n \u0026lt;td colspan=\"2\"\u0026gt;Please enter your user name and password below:\u0026lt;/td\u0026gt;\n\u0026lt;/tr\u0026gt;\n\u0026lt;tr style=\"height: 10px;\"\u0026gt;\u0026lt;td\u0026gt;\u0026lt;/td\u0026gt;\u0026lt;/tr\u0026gt;\n\u0026lt;tr\u0026gt;\n \u0026lt;td\u0026gt;User Name:\u0026lt;/td\u0026gt;\n \u0026lt;td\u0026gt;\u0026lt;input name=\"login_username\" style=\"width: 295px;\" type=\"text\" size=\"40\" value=\"\"\u0026gt;\u0026lt;/td\u0026gt;\n\u0026lt;/tr\u0026gt;\n\u0026lt;tr\u0026gt;\n \u0026lt;td\u0026gt;Password:\u0026lt;/td\u0026gt;\n \u0026lt;td\u0026gt;\u0026lt;input name=\"login_password\" style=\"width: 295px;\" type=\"password\" size=\"40\"\u0026gt;\u0026lt;/td\u0026gt;\n\u0026lt;/tr\u0026gt;\n\u0026lt;tr\u0026gt;\n \u0026lt;td\u0026gt;Realm:\u0026lt;/td\u0026gt;\n \u0026lt;td\u0026gt;\n \u0026lt;select name=\"realm\" style=\"width: 295px;\"\u0026gt;\u0026lt;option value=\"local\"\u0026gt;Local\u0026lt;/option\u0026gt;\u0026lt;option value=\"ldap\" selected=\"\"\u0026gt;LDAP\u0026lt;/option\u0026gt;\n \u0026lt;/select\u0026gt;\n \u0026lt;/td\u0026gt;\n\u0026lt;/tr\u0026gt;\n \u0026lt;tr style=\"height: 10px;\"\u0026gt;\u0026lt;td\u0026gt;\u0026lt;/td\u0026gt;\u0026lt;/tr\u0026gt;\n\u0026lt;tr\u0026gt;\n \u0026lt;td\u0026gt;\u0026lt;input type=\"submit\" value=\"Login\"\u0026gt;\u0026lt;/td\u0026gt;\n\u0026lt;/tr\u0026gt; \n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHere is my powershell code : \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e$username=\"MyAccount\"\n$passowrd=\"MyPassowrd\"\n$realm=\"local\"\n\n$webclient = new-object System.Net.WebClient\n$webclient.Credentials = new-object System.Net.NetworkCredential($username, $password, $realm)\n$webclient.DownloadFile($url, \"C:\\temp\\test.jpg\")\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"22459686","answer_count":"1","comment_count":"0","creation_date":"2014-03-17 15:45:20.523 UTC","last_activity_date":"2014-03-18 16:45:44.663 UTC","last_edit_date":"2014-03-18 16:45:44.663 UTC","last_editor_display_name":"","last_editor_user_id":"3354227","owner_display_name":"","owner_user_id":"3354227","post_type_id":"1","score":"0","tags":"powershell|webclient|cacti","view_count":"931"} {"id":"22891757","title":"using img element with cover","body":"\u003cp\u003eI want to show images to same ratio.But image sizes get different.Maybe 16:10 or 10:10 aspect ratio.Some images look vertical, some images look horizontal.\u003c/p\u003e\n\n\u003cp\u003eI did background cover center with div.But I have to use this to img element.\u003c/p\u003e\n\n\u003cp\u003eHow can I do that with img ?\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ediv.image-content\n{\n width: 210px;\n margin: 15px;\n float: left;\n height: 210px;\n overflow: hidden;\n background: no-repeat center center;\n background-size: cover;\n -webkit-background-size: cover;\n -moz-background-size: cover;\n -o-background-size: cover; \n }\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"1","comment_count":"0","creation_date":"2014-04-06 08:39:15.637 UTC","last_activity_date":"2014-04-06 08:41:10.277 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"3396095","post_type_id":"1","score":"0","tags":"css|image|background-image","view_count":"230"} @@ -223,7 +223,7 @@ {"id":"31948013","title":"iOS 9 Beta 5 made my app not work","body":"\u003cp\u003eI am relatively new to iOS coding, and swift. I have only coded in Swift, and not Swift 2. I am nervous that updating to the latest XCode will delete my files, or do something crazy, because that has happened before, so I have kept the last version, Xcode 6.3 (i think). Now, when I test my applications on my iPhone 6 with the iOS 9 Beta 5 software, most of my tableviews are not showing anything in them. They load the correct amount of rows, but they are not displaying anything. \u003c/p\u003e\n\n\u003col\u003e\n\u003cli\u003eHow should I go about fixing this?\u003c/li\u003e\n\u003cli\u003eShould I update to Xcode 7? \u003c/li\u003e\n\u003cli\u003eIf I do, will I have to change the code, and will my apps then still be able to be used on previous iOS operating systems? In other words, will there be a transition from Swift to Swift 2? \u003c/li\u003e\n\u003c/ol\u003e","answer_count":"1","comment_count":"5","creation_date":"2015-08-11 17:15:33.653 UTC","last_activity_date":"2015-08-11 17:19:40.153 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"4954930","post_type_id":"1","score":"0","tags":"ios|xcode|swift2|ios9","view_count":"244"} {"id":"24506018","title":"SailsJs - cannot generate api (using v0.10.0-rc8)","body":"\u003cp\u003eI cannot make generation work using beta SailsJs (v0.10.0-rc8).\nI tried this and that but with no success.\nAny ideas would be appreciated.\u003c/p\u003e\n\n\u003cp\u003e\u003ccode\u003e~/dev$ npm -g ls | grep sails\n├─┬ sails@0.10.0-rc8\n│ ├── grunt-sails-linker@0.9.5\n│ ├── sails-build-dictionary@0.10.1\n│ ├─┬ sails-disk@0.10.1\n│ ├─┬ sails-generate@0.10.3\n│ │ ├── sails-generate-adapter@0.10.4\n│ │ ├── sails-generate-backend@0.10.13\n│ │ ├─┬ sails-generate-controller@0.10.6\n│ │ ├── sails-generate-frontend@0.10.18\n│ │ ├── sails-generate-generator@0.10.11\n│ │ ├── sails-generate-gruntfile@0.10.10\n│ │ ├─┬ sails-generate-model@0.10.9\n│ │ ├── sails-generate-new@0.10.16\n│ │ ├── sails-generate-views@0.10.1\n│ │ └── sails-generate-views-jade@0.10.0\n│ ├── sails-stringfile@0.3.2\n│ ├─┬ sails-util@0.10.2\n\u003c/code\u003e\u003c/p\u003e\n\n\u003cp\u003e\u003ccode\u003e~/dev$ sails new project\ninfo: Created a new Sails app 'project'!\n\u003c/code\u003e\u003c/p\u003e\n\n\u003cp\u003e\u003ccode\u003e~/dev/project$ sails generate api user\nerror: No generator called 'controller' found; perhaps you meant 'sails generate api controller'?\nerror: No generator called 'model' found; perhaps you meant 'sails generate api model'?\n\u003c/code\u003e\u003c/p\u003e","accepted_answer_id":"24515195","answer_count":"1","comment_count":"0","creation_date":"2014-07-01 08:46:44.563 UTC","favorite_count":"1","last_activity_date":"2014-07-18 05:46:18.07 UTC","last_edit_date":"2014-07-18 05:46:18.07 UTC","last_editor_display_name":"","last_editor_user_id":"3266689","owner_display_name":"","owner_user_id":"3266689","post_type_id":"1","score":"0","tags":"frameworks|sails.js","view_count":"560"} {"id":"10926733","title":"Need to pass a NSMutableString object from a view controller to the AppDelegate","body":"\u003cp\u003eI've struggled for 6 hrs trying to pass a mutable string object from a view controller to the AppDelegate. I've seen a lot of comments on passing data between view controllers and have worked some of those tutorials, but can't seem to figure out how to pass data to the AppDelegate.\u003c/p\u003e\n\n\u003cp\u003eThanks for any ideas\u003c/p\u003e","answer_count":"1","comment_count":"1","creation_date":"2012-06-07 06:30:41.233 UTC","last_activity_date":"2012-06-07 06:33:05.603 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1441426","post_type_id":"1","score":"0","tags":"ios|delegates|pass-data","view_count":"220"} -{"id":"15432052","title":"What is the meaning of git reset --hard origin/master?","body":"\u003cp\u003eI did a git pull and got an error \"The following working tree files would be overwritten by merge... Please move or remove them before you can merge\". To resolve this I did the following\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003egit fetch\ngit reset --hard origin/master\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eNow when I do git pull, it says everything up to date.I want to know what exactly happens when i run these commands. I know \u003ccode\u003egit fetch\u003c/code\u003e fetches the changes from the remote repo without merging them into my local repo.\u003c/p\u003e\n\n\u003cp\u003eWhat is the meaning of \u003ccode\u003egit reset --hard origin/master\u003c/code\u003e? How does it work?\u003c/p\u003e","accepted_answer_id":"15432250","answer_count":"1","comment_count":"0","creation_date":"2013-03-15 12:06:57.02 UTC","favorite_count":"21","last_activity_date":"2013-12-21 07:42:11.27 UTC","last_edit_date":"2013-12-21 07:42:11.27 UTC","last_editor_display_name":"","last_editor_user_id":"363437","owner_display_name":"","owner_user_id":"1154018","post_type_id":"1","score":"82","tags":"git|version-control","view_count":"115026"} +{"id":"15432052","title":"What is the meaning of git reset --hard origin/main?","body":"\u003cp\u003eI did a git pull and got an error \"The following working tree files would be overwritten by merge... Please move or remove them before you can merge\". To resolve this I did the following\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003egit fetch\ngit reset --hard origin/main\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eNow when I do git pull, it says everything up to date.I want to know what exactly happens when i run these commands. I know \u003ccode\u003egit fetch\u003c/code\u003e fetches the changes from the remote repo without merging them into my local repo.\u003c/p\u003e\n\n\u003cp\u003eWhat is the meaning of \u003ccode\u003egit reset --hard origin/main\u003c/code\u003e? How does it work?\u003c/p\u003e","accepted_answer_id":"15432250","answer_count":"1","comment_count":"0","creation_date":"2013-03-15 12:06:57.02 UTC","favorite_count":"21","last_activity_date":"2013-12-21 07:42:11.27 UTC","last_edit_date":"2013-12-21 07:42:11.27 UTC","last_editor_display_name":"","last_editor_user_id":"363437","owner_display_name":"","owner_user_id":"1154018","post_type_id":"1","score":"82","tags":"git|version-control","view_count":"115026"} {"id":"24548872","title":"CSS doesn't work in Chrome but works in Firefox","body":"\u003cp\u003eI have piece of CSS code which works fine in Firefox but not in Chrome.\nI guess made a mistake when using \u003ccode\u003e-webkit-linear-gradient\u003c/code\u003e which shows invalid value in chrome\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eHTML code:\u003c/strong\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;div class=\"laptop\"\u0026gt;\n \u0026lt;div class=\"glare-xl\"\u0026gt;\u0026lt;/div\u0026gt;\n \u0026lt;div class=\"screen-xl\"\u0026gt;\n \u0026lt;img src=\"http://www.psdgraphics.com/file/silver-laptop-icon.jpg\" alt=\"laptop\" /\u0026gt; \n \u0026lt;/div\u0026gt;\n \u0026lt;div class=\"base-xl\"\u0026gt;\u0026lt;/div\u0026gt;\n \u0026lt;div class=\"addons-xl \"\u0026gt;\u0026lt;/div\u0026gt;\n \u0026lt;div class=\"button-xl\"\u0026gt;\u0026lt;/div\u0026gt;\n\u0026lt;/div\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003cstrong\u003eCSS code:\u003c/strong\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e.laptop:before {\n background: none repeat scroll 0 0 padding-box #d3d4d6;\n border-color: #cecece #b7b7b9 #5e5d62;\n border-radius: 12px 12px 0 0;\n border-style: solid;\n border-width: 1px;\n bottom: 0;\n content: \"\";\n height: 317px;\n left: 0;\n margin-bottom: -1px;\n margin-left: -6px;\n margin-top: -6px;\n position: absolute;\n top: 0;\n width: 536px;\n z-index: -3;\n}\n.laptop:after {\n background: none repeat scroll 0 0 padding-box #000000;\n border: 1px solid #bdbec0;\n border-radius: 10px 10px 0 0;\n bottom: 0;\n content: \"\";\n height: 311px;\n left: 1px;\n margin-bottom: -1px;\n margin-left: -5px;\n margin-top: -6px;\n position: absolute;\n top: 2px;\n width: 532px;\n z-index: -2;\n}\n.laptop {\n background: none repeat scroll 0 0 padding-box #010101;\n border: 1px solid #101113;\n border-radius: 8px 8px 0 0;\n display: inline-block;\n height: 230px;\n margin-bottom: 40px;\n margin-left: 60px;\n position: relative;\n width: 528px;\n}\n\n\n\n.glare-xl {\n background-clip: padding-box;\n background-image: -moz-linear-gradient(-27% bottom , rgba(0, 0, 0, 0.1) 55%, rgba(0, 0, 0, 0.1) 55%, rgba(255, 255, 255, 0.25) 55.05%);\n background-image: -webkit-linear-gradient(-27% bottom , rgba(0, 0, 0, 0.1) 55%, rgba(0, 0, 0, 0.1) 55%, rgba(255, 255, 255, 0.25) 55.05%);\n background-image: -ms-linear-gradient(-27% bottom , rgba(0, 0, 0, 0.1) 55%, rgba(0, 0, 0, 0.1) 55%, rgba(255, 255, 255, 0.25) 55.05%);\n background-image: -o-linear-gradient(-27% bottom , rgba(0, 0, 0, 0.1) 55%, rgba(0, 0, 0, 0.1) 55%, rgba(255, 255, 255, 0.25) 55.05%);\n background-image: linear-gradient(-27% bottom , rgba(0, 0, 0, 0.1) 55%, rgba(0, 0, 0, 0.1) 55%, rgba(255, 255, 255, 0.25) 55.05%);\n border-radius: 7px 7px 0 0;\n height: 308px;\n position: absolute;\n top: -1px;\n width: 610px;\n z-index: 100;\n}\n\n\n\n.screen-xl:before {\n background: -moz-linear-gradient(center top , #303235 0%, #0a0a0a 100%) repeat scroll 0 0 padding-box rgba(0, 0, 0, 0);\n background: -webkit-linear-gradient(center top , #303235 0%, #0a0a0a 100%) repeat scroll 0 0 padding-box rgba(0, 0, 0, 0);\n background: -ms-linear-gradient(center top , #303235 0%, #0a0a0a 100%) repeat scroll 0 0 padding-box rgba(0, 0, 0, 0);\n background: -o-linear-gradient(center top , #303235 0%, #0a0a0a 100%) repeat scroll 0 0 padding-box rgba(0, 0, 0, 0);\n background: linear-gradient(center top , #303235 0%, #0a0a0a 100%) repeat scroll 0 0 padding-box rgba(0, 0, 0, 0);\n border-color: #000000;\n border-radius: 7px 7px 0 0;\n border-style: solid;\n border-width: 9px 7px;\n content: \"\";\n height: 272px;\n left: -6px;\n position: absolute;\n top: -5px;\n width: 500px;\n z-index: 3;\n}\n.screen-xl:after {\n background: -moz-linear-gradient(center top , #5c5c5c 0%, #656565 8%, #4f4f4f 42%, #727272 100%) repeat scroll 0 0 padding-box rgba(0, 0, 0, 0);\n background: -webkit-linear-gradient(center top , #5c5c5c 0%, #656565 8%, #4f4f4f 42%, #727272 100%) repeat scroll 0 0 padding-box rgba(0, 0, 0, 0);\n background: -ms-linear-gradient(center top , #5c5c5c 0%, #656565 8%, #4f4f4f 42%, #727272 100%) repeat scroll 0 0 padding-box rgba(0, 0, 0, 0);\n background: -o-linear-gradient(center top , #5c5c5c 0%, #656565 8%, #4f4f4f 42%, #727272 100%) repeat scroll 0 0 padding-box rgba(0, 0, 0, 0);\n background: linear-gradient(center top , #5c5c5c 0%, #656565 8%, #4f4f4f 42%, #727272 100%) repeat scroll 0 0 padding-box rgba(0, 0, 0, 0);\n border: 1px solid #404040;\n border-radius: 25px;\n box-shadow: 0 0 2px #ffffff;\n content: \"\";\n height: 3px;\n left: 49%;\n position: absolute;\n top: -8px;\n width: 3px;\n z-index: 130;\n}\n.screen-xl {\n border: 1px solid #141414;\n border-radius: 2px 2px 0 0;\n height: 276px;\n left: 10px;\n position: absolute;\n top: 12px;\n width: 502px;\n}\n\n.screen-xl img {\n border-radius: 2px;\n height: 272px;\n left: 0;\n margin-left: 1px;\n margin-top: 4px;\n position: absolute;\n width: 500px;\n z-index: 100;\n}\n\n.base-xl:before {\n background: -moz-linear-gradient(center top , #c5c4c6 0%, #aeadb1 6%, #99989d 25%, #98979d 31%, #918f96 38%, #686a6d 63%, #4c5254 75%, #43484a 81%, #2c2f30 94%, #16191a 100%) repeat scroll 0 0 padding-box rgba(0, 0, 0, 0);\n background: -webkit-linear-gradient(center top , #c5c4c6 0%, #aeadb1 6%, #99989d 25%, #98979d 31%, #918f96 38%, #686a6d 63%, #4c5254 75%, #43484a 81%, #2c2f30 94%, #16191a 100%) repeat scroll 0 0 padding-box rgba(0, 0, 0, 0);\n background: -ms-linear-gradient(center top , #c5c4c6 0%, #aeadb1 6%, #99989d 25%, #98979d 31%, #918f96 38%, #686a6d 63%, #4c5254 75%, #43484a 81%, #2c2f30 94%, #16191a 100%) repeat scroll 0 0 padding-box rgba(0, 0, 0, 0);\n background: -o-linear-gradient(center top , #c5c4c6 0%, #aeadb1 6%, #99989d 25%, #98979d 31%, #918f96 38%, #686a6d 63%, #4c5254 75%, #43484a 81%, #2c2f30 94%, #16191a 100%) repeat scroll 0 0 padding-box rgba(0, 0, 0, 0);\n background: linear-gradient(center top , #c5c4c6 0%, #aeadb1 6%, #99989d 25%, #98979d 31%, #918f96 38%, #686a6d 63%, #4c5254 75%, #43484a 81%, #2c2f30 94%, #16191a 100%) repeat scroll 0 0 padding-box rgba(0, 0, 0, 0);\n border-radius: 0 0 400px 400px / 0 0 100px 100px;\n bottom: -15px;\n box-shadow: 7px 0 3px #6a6d71 inset, -7px 0 3px #6a6d71 inset;\n content: \"\";\n height: 15px;\n left: -1px;\n position: absolute;\n width: 655px;\n z-index: 130;\n}\n.base-xl {\n background: -moz-linear-gradient(left center , #979ba0 1%, #dfdfdf 4%, #f2f2f2 6%, #e3e3e5 14%, #e3e3e5 86%, #f2f2f2 94%, #dfdfdf 96%, #6a6d71 100%) repeat scroll 0 0 padding-box rgba(0, 0, 0, 0);\n background: -webkit-linear-gradient(left center , #979ba0 1%, #dfdfdf 4%, #f2f2f2 6%, #e3e3e5 14%, #e3e3e5 86%, #f2f2f2 94%, #dfdfdf 96%, #6a6d71 100%) repeat scroll 0 0 padding-box rgba(0, 0, 0, 0);\n background: -ms-linear-gradient(left center , #979ba0 1%, #dfdfdf 4%, #f2f2f2 6%, #e3e3e5 14%, #e3e3e5 86%, #f2f2f2 94%, #dfdfdf 96%, #6a6d71 100%) repeat scroll 0 0 padding-box rgba(0, 0, 0, 0);\n background: -o-linear-gradient(left center , #979ba0 1%, #dfdfdf 4%, #f2f2f2 6%, #e3e3e5 14%, #e3e3e5 86%, #f2f2f2 94%, #dfdfdf 96%, #6a6d71 100%) repeat scroll 0 0 padding-box rgba(0, 0, 0, 0);\n background: linear-gradient(left center , #979ba0 1%, #dfdfdf 4%, #f2f2f2 6%, #e3e3e5 14%, #e3e3e5 86%, #f2f2f2 94%, #dfdfdf 96%, #6a6d71 100%) repeat scroll 0 0 padding-box rgba(0, 0, 0, 0);\n border-color: #6b6e72;\n border-radius: 3px 3px 0 0;\n border-style: solid;\n border-width: 1px 1px 0;\n bottom: -101px;\n box-shadow: 0 1px 2px #ffffff inset;\n float: left;\n height: 22px;\n left: -125px;\n margin-left: 60px;\n position: absolute;\n width: 654px;\n z-index: 4;\n}\n\n.addons-xl:before {\n background-color: #000000;\n border-radius: 55px 55px 5px 5px;\n bottom: -115px;\n content: \"\";\n height: 5px;\n left: 4%;\n position: absolute;\n width: 5px;\n z-index: 1000;\n}\n.addons-xl:after {\n background-color: #000000;\n border-radius: 55px 55px 5px 5px;\n bottom: -115px;\n content: \"\";\n height: 5px;\n position: absolute;\n right: 4%;\n width: 5px;\n z-index: 1000;\n}\n.addons-xl {\n background-color: rgba(0, 0, 0, 0);\n border-radius: 10px;\n height: 3px;\n margin-left: 53%;\n margin-top: 5px;\n width: 3px;\n z-index: 1000;\n}\n\n\n.button-xl:after {\n background: -moz-linear-gradient(center top , #1a2226 0%, #535a61 64%, #68778c 100%) repeat scroll 0 0 padding-box rgba(0, 0, 0, 0);\n background: -webkit-linear-gradient(center top , #1a2226 0%, #535a61 64%, #68778c 100%) repeat scroll 0 0 padding-box rgba(0, 0, 0, 0);\n background: -ms-linear-gradient(center top , #1a2226 0%, #535a61 64%, #68778c 100%) repeat scroll 0 0 padding-box rgba(0, 0, 0, 0);\n background: -o-linear-gradient(center top , #1a2226 0%, #535a61 64%, #68778c 100%) repeat scroll 0 0 padding-box rgba(0, 0, 0, 0);\n background: linear-gradient(center top , #1a2226 0%, #535a61 64%, #68778c 100%) repeat scroll 0 0 padding-box rgba(0, 0, 0, 0);\n border-radius: 10px;\n bottom: -6px;\n box-shadow: 0 0 1px #ffffff;\n content: \"\";\n height: 3px;\n left: 274px;\n position: absolute;\n width: 20px;\n z-index: 4;\n}\n.button-xl {\n background: -moz-linear-gradient(left center , #979ba0 1%, #dfdfdf 4%, #f2f2f2 6%, #b1b3b6 14%, #b1b3b6 86%, #f2f2f2 94%, #dfdfdf 96%, #6a6d71 100%) repeat scroll 0 0 padding-box rgba(0, 0, 0, 0);\n background: -webkit-linear-gradient(left center , #979ba0 1%, #dfdfdf 4%, #f2f2f2 6%, #b1b3b6 14%, #b1b3b6 86%, #f2f2f2 94%, #dfdfdf 96%, #6a6d71 100%) repeat scroll 0 0 padding-box rgba(0, 0, 0, 0);\n background: -ms-linear-gradient(left center , #979ba0 1%, #dfdfdf 4%, #f2f2f2 6%, #b1b3b6 14%, #b1b3b6 86%, #f2f2f2 94%, #dfdfdf 96%, #6a6d71 100%) repeat scroll 0 0 padding-box rgba(0, 0, 0, 0);\n background: -o-linear-gradient(left center , #979ba0 1%, #dfdfdf 4%, #f2f2f2 6%, #b1b3b6 14%, #b1b3b6 86%, #f2f2f2 94%, #dfdfdf 96%, #6a6d71 100%) repeat scroll 0 0 padding-box rgba(0, 0, 0, 0);\n background: linear-gradient(left center , #979ba0 1%, #dfdfdf 4%, #f2f2f2 6%, #b1b3b6 14%, #b1b3b6 86%, #f2f2f2 94%, #dfdfdf 96%, #6a6d71 100%) repeat scroll 0 0 padding-box rgba(0, 0, 0, 0);\n border-color: #5c6064;\n border-radius: 0 0 50px 50px;\n border-style: solid;\n border-width: 0 1px 1px;\n bottom: -87px;\n box-shadow: 0 1px 5px #ffffff, 0 1px 1px #ffffff inset;\n content: \"\";\n height: 6px;\n left: 44%;\n position: absolute;\n width: 60px;\n z-index: 4;\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003cstrong\u003eQuestions:\u003c/strong\u003e\u003c/p\u003e\n\n\u003cp\u003e1)Why CSS doesn't work in Chrome\u003c/p\u003e\n\n\u003cp\u003e2)How I can make this all structure i.e laptop as responsive as I tried max-width at all places but it doesn't work?\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"http://jsfiddle.net/shoaibista/gxb2C/\" rel=\"nofollow\"\u003e\u003cstrong\u003eJS FIDDLE\u003c/strong\u003e\u003c/a\u003e\u003c/p\u003e","accepted_answer_id":"24549431","answer_count":"1","comment_count":"6","creation_date":"2014-07-03 08:38:48.62 UTC","last_activity_date":"2014-07-03 09:04:34.71 UTC","last_edit_date":"2014-07-03 08:55:35.45 UTC","last_editor_display_name":"","last_editor_user_id":"2396624","owner_display_name":"","owner_user_id":"2396624","post_type_id":"1","score":"1","tags":"html|css3|google-chrome|responsive-design|gradient","view_count":"410"} {"id":"28359045","title":"How do I add up two scatter points with the same values of x but different values of y?","body":"\u003cp\u003eOn a stem plot, how can I add points that have the same values of \u003ccode\u003ex\u003c/code\u003e but different values of \u003ccode\u003ey\u003c/code\u003e? \u003c/p\u003e\n\n\u003cp\u003eFor example, given the following code:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ex = [1 2 3 6 6 4 5];\ny = [3 6 1 8 9 4 2];\nstem(x,y);\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eIf you plot \u003ccode\u003ex\u003c/code\u003e, and \u003ccode\u003ey\u003c/code\u003e, this will be the output:\u003c/p\u003e\n\n\u003cp\u003e\u003cimg src=\"https://i.stack.imgur.com/vEDY6.png\" alt=\"enter image description here\"\u003e\u003c/p\u003e\n\n\u003cp\u003eI want to add up \u003ccode\u003e(6,8)\u003c/code\u003e and \u003ccode\u003e(6,9)\u003c/code\u003e so it becomes \u003ccode\u003e(6,17)\u003c/code\u003e, just like what the image is showing.\u003c/p\u003e\n\n\u003cp\u003eHow can I achieve this?\u003c/p\u003e","accepted_answer_id":"28360150","answer_count":"1","comment_count":"2","creation_date":"2015-02-06 05:19:43.677 UTC","favorite_count":"1","last_activity_date":"2015-02-06 07:11:22.46 UTC","last_edit_date":"2015-02-06 07:11:22.46 UTC","last_editor_display_name":"","last_editor_user_id":"3250829","owner_display_name":"","owner_user_id":"4503052","post_type_id":"1","score":"1","tags":"matlab","view_count":"157"} {"id":"31137442","title":"How to fade animate an image icon in html/css","body":"\u003cp\u003eHi I am trying to duplicate the flame icon animations on the left and right of this wix webite:How can i position the flame icon to the far right or left and also make it have a fade animatiion\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"http://jirungu2012.wix.com/firebrandoption2\" rel=\"nofollow\"\u003ehttp://jirungu2012.wix.com/firebrandoption2\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eThis is the htm code \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e \u0026lt;section id=\"ourfires\" class=\"portfolio page-section add-top add-bottom\"\u0026gt;\n \u0026lt;div id=\"right\"\u0026gt;\n \u0026lt;img src=\"http://static.wixstatic.com/media/d57153_09c71d3fe10848c3a04b18f8d8a6c2b3.png_srz_p_487_587_75_22_0.50_1.20_0.00_png_srz\" /\u0026gt;\n \u0026lt;!-- inner-section : starts --\u0026gt;\n \u0026lt;section class=\"inner-section\"\u0026gt;\n\n \u0026lt;!-- container : starts --\u0026gt;\n \u0026lt;section class=\"container\"\u0026gt;\n\n \u0026lt;div class=\"row\"\u0026gt;\n \u0026lt;article class=\"col-md-12\"\u0026gt;\n \u0026lt;h1 style=\"text-align:left;\"\u0026gt;\u0026lt;span class=\"animated\" data-fx=\"bounceInRight\"\u0026gt;Our fire\u0026lt;/span\u0026gt;\u0026lt;/h1\u0026gt;\n \u0026lt;article id=\"article\"\u0026gt;\u0026lt;hr class=\"hr\"\u0026gt;\u0026lt;/hr\u0026gt;\u0026lt;/article\u0026gt;\n \u0026lt;div class=\"clearfix\"\u0026gt;\u0026lt;/div\u0026gt;\n\n\n\n \u0026lt;div id=\"mid\"\u0026gt;\n\n \u0026lt;p class=\"promod-text dark-text\"\u0026gt;Our fire is all about \u0026lt;b\u0026gt;Big Brand Ideas\u0026lt;/b\u0026gt; that not only have an \u0026lt;b\u0026gt;edge in the market\u0026lt;/b\u0026gt; and make a difference in the \u0026lt;b\u0026gt;bottom line\u0026lt;/b\u0026gt;,but ieas are: \u0026lt;/p\u0026gt;\n\n\n\n \u0026lt;p\u0026gt;\n \u0026lt;ul id=\"navlist\" class=\"promod-text dark-text\" \u0026gt;\n \u0026lt;li\u0026gt;Locally relevant\u0026lt;/li\u0026gt;\n \u0026lt;li\u0026gt;Creatively imagined and executed\u0026lt;/li\u0026gt;\n \u0026lt;li\u0026gt;Internationally recognized\u0026lt;/li\u0026gt;\n \u0026lt;/ul\u0026gt;\n \u0026lt;/p\u0026gt;\n \u0026lt;br\u0026gt;\u0026lt;br\u0026gt;\u0026lt;br\u0026gt;\u0026lt;br\u0026gt;\u0026lt;br\u0026gt; \n \u0026lt;/div\u0026gt;\n\n \u0026lt;/article\u0026gt;\n \u0026lt;/div \n \u0026gt;\u0026lt;/section\u0026gt;\n \u0026lt;!-- container : ends --\u0026gt;\n \u0026lt;/section\u0026gt;\n \u0026lt;!-- inner-section : ends --\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;/section\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe css\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e#ourfires{\n\n background: url('../images/bg/03.jpg');\n background-color:#ffffff;\n\n\n}\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"2","comment_count":"5","creation_date":"2015-06-30 11:48:38.203 UTC","last_activity_date":"2015-07-01 14:06:17.263 UTC","last_edit_date":"2015-06-30 12:55:10.453 UTC","last_editor_display_name":"","last_editor_user_id":"2260344","owner_display_name":"","owner_user_id":"2260344","post_type_id":"1","score":"0","tags":"html|html5|css3|css-transitions","view_count":"796"} @@ -600,7 +600,7 @@ {"id":"31968261","title":"How to validate 17 digits in array of VIN numbers from form in php?","body":"\u003cp\u003eI have the following validation code that runs after my form is submitted:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eforeach ($_POST['vin']) as $vin_value ) {\nif(strlen($vin_value) != 17) {\necho \"VIN is not 17 digits\"; \necho \"VIN is \" . strlen($vin_value) . \" digits\";\necho \"VIN value is: \" . $vin_value;\n} else {\nmail($admin_email, \"Auto Quote Request\", $email_body);\necho \"Thank you for contacting us!\";\n}\n\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI am trying to make sure the individual vin's ($vin_value) of my vin[] array are exactly 17 digits. Right now when I submit the form no message is displayed at all. What's going on here?? And I realize this code just checks for characters, not digits. Thanks.\u003c/p\u003e\n\n\u003cp\u003ehtml form input:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;div class=\"form-group\"\u0026gt;\n \u0026lt;label for=\"inputVIN\" class=\"col-lg-2 control-label\"\u0026gt;Vehicle Identification Number\u0026lt;/label\u0026gt;\n \u0026lt;div class=\"col-lg-10\"\u0026gt;\n \u0026lt;input class=\"form-control\" id=\"inputVIN\" placeholder=\"Must be 17 digits.\" type=\"text\" name=\"vin[]\"\u0026gt;\n\n \u0026lt;/div\u0026gt;\n\u0026lt;/div\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe input is an array. This is to accommodate the possibility of multiple vin numbers. There is an option to add another form field with the name of vin[]. All the inputs relevant to this question have name=\"vin[]\" . To reiterate, at first there is one form group with name=vin[], but the user can click a button to add more. This is why I am using an array in the first place. So I want each element in the array (the $vin_value)to contain exactly 17 characters. That is why I am using a foreach. I hope that provides enough context.\u003c/p\u003e","accepted_answer_id":"31968390","answer_count":"1","comment_count":"22","creation_date":"2015-08-12 14:34:41.727 UTC","last_activity_date":"2015-08-12 16:50:18.927 UTC","last_edit_date":"2015-08-12 16:50:18.927 UTC","last_editor_display_name":"","last_editor_user_id":"5198569","owner_display_name":"","owner_user_id":"5198569","post_type_id":"1","score":"-4","tags":"php","view_count":"119"} {"id":"28751030","title":"Cannot retrieve django serialized json using javascript","body":"\u003cp\u003eHi I am parsing serialzed json -\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003edef wall_copy(request):\n posts = user_post.objects.order_by('id')[:20].reverse()\n posts_serialized = serializers.serialize('json', posts)\n return JsonResponse(posts_serialized, safe=False)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eand trying to get data as-\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e$(document).ready(function()\n {\n setInterval(function() \n {\n var xhr = new XMLHttpRequest();\n xhr.open(\"GET\",\"http://10.8.21.17:8000/wall/wall_copy/\",false);\n xhr.send(null);\n var data = JSON.parse(xhr.responseText);\n //alert(xhr.status+' '+xhr.statusText);\n for(i=0; i\u0026lt;20; i++)\n {\n alert(data[i].post_content);\n }\n }, 3000);\n });\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eBut the problem is that every time it alerts as 'Undefined'. I checked the url and the server is sending json data but I am unable to fetch it.\u003c/p\u003e\n\n\u003cp\u003eJson data-\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\"[{\\\"fields\\\": {\\\"post_id\\\": \\\"rahularyan06:16PM on February 26, 2015\\\", \\\"posted_by\\\": \\\"rahularyan\\\", \\\"post_content\\\": \\\"koi nhi re\\\", \\\"time_of_post\\\": \\\"2015-02-26T18:16:00Z\\\"}, \\\"model\\\": \\\"wall.user_post\\\", \\\"pk\\\": 77}, {\\\"fields\\\": {\\\"post_id\\\": \\\"aquaman06:00PM on February 26, 2015\\\", \\\"posted_by\\\": \\\"aquaman\\\", \\\"post_content\\\": \\\"kuch nhi\\\", \\\"time_of_post\\\": \\\"2015-02-26T18:00:44Z\\\"}, \\\"model\\\": \\\"wall.user_post\\\", \\\"pk\\\": 76}, {\\\"fields\\\": {\\\"post_id\\\": \\\"rahularyan06:00PM on February 26, 2015\\\", \\\"posted_by\\\": \\\"rahularyan\\\", \\\"post_content\\\": \\\"kya hua??\\\", \\\"time_of_post\\\": \\\"2015-02-26T18:00:04Z\\\"}, \\\"model\\\": \\\"wall.user_post\\\", \\\"pk\\\": 75}, {\\\"fields\\\": {\\\"post_id\\\": \\\"aquaman12:01AM on February 26, 2015\\\", \\\"posted_by\\\": \\\"aquaman\\\", \\\"post_content\\\": \\\"lelo\\\", \\\"time_of_post\\\": \\\"2015-02-26T00:01:14Z\\\"}, \\\"model\\\": \\\"wall.user_post\\\", \\\"pk\\\": 74}, {\\\"fields\\\": {\\\"post_id\\\": \\\"aquaman10:41AM on February 25, 2015\\\", \\\"posted_by\\\": \\\"aquaman\\\", \\\"post_content\\\": \\\"sahi me lega??\\\", \\\"time_of_post\\\": \\\"2015-02-25T10:41:43Z\\\"}, \\\"model\\\": \\\"wall.user_post\\\", \\\"pk\\\": 73}, {\\\"fields\\\": {\\\"post_id\\\": \\\"aquaman10:41AM on February 25, 2015\\\", \\\"posted_by\\\": \\\"aquaman\\\", \\\"post_content\\\": \\\"sahi me lega??\\\", \\\"time_of_post\\\": \\\"2015-02-25T10:41:34Z\\\"}, \\\"model\\\": \\\"wall.user_post\\\", \\\"pk\\\": 72}, {\\\"fields\\\": {\\\"post_id\\\": \\\"shreyansh10:41AM on February 25, 2015\\\", \\\"posted_by\\\": \\\"shreyansh\\\", \\\"post_content\\\": \\\"yo\\\", \\\"time_of_post\\\": \\\"2015-02-25T10:41:17Z\\\"}, \\\"model\\\": \\\"wall.user_post\\\", \\\"pk\\\": 71}, {\\\"fields\\\": {\\\"post_id\\\": \\\"aquaman10:40AM on February 25, 2015\\\", \\\"posted_by\\\": \\\"aquaman\\\", \\\"post_content\\\": \\\"muh me lega??\\\", \\\"time_of_post\\\": \\\"2015-02-25T10:40:53Z\\\"}, \\\"model\\\": \\\"wall.user_post\\\", \\\"pk\\\": 70}, {\\\"fields\\\": {\\\"post_id\\\": \\\"aquaman10:40AM on February 25, 2015\\\", \\\"posted_by\\\": \\\"aquaman\\\", \\\"post_content\\\": \\\"bc\\\", \\\"time_of_post\\\": \\\"2015-02-25T10:40:42Z\\\"}, \\\"model\\\": \\\"wall.user_post\\\", \\\"pk\\\": 69}, {\\\"fields\\\": {\\\"post_id\\\": \\\"shreyansh10:40AM on February 25, 2015\\\", \\\"posted_by\\\": \\\"shreyansh\\\", \\\"post_content\\\": \\\"lele\\\", \\\"time_of_post\\\": \\\"2015-02-25T10:40:28Z\\\"}, \\\"model\\\": \\\"wall.user_post\\\", \\\"pk\\\": 68}, {\\\"fields\\\": {\\\"post_id\\\": \\\"aquaman10:39AM on February 25, 2015\\\", \\\"posted_by\\\": \\\"aquaman\\\", \\\"post_content\\\": \\\"kya bhai??\\\", \\\"time_of_post\\\": \\\"2015-02-25T10:39:39Z\\\"}, \\\"model\\\": \\\"wall.user_post\\\", \\\"pk\\\": 67}, {\\\"fields\\\": {\\\"post_id\\\": \\\"aquaman10:38AM on February 25, 2015\\\", \\\"posted_by\\\": \\\"aquaman\\\", \\\"post_content\\\": \\\"sb mast\\\", \\\"time_of_post\\\": \\\"2015-02-25T10:38:22Z\\\"}, \\\"model\\\": \\\"wall.user_post\\\", \\\"pk\\\": 66}, {\\\"fields\\\": {\\\"post_id\\\": \\\"shreyansh10:38AM on February 25, 2015\\\", \\\"posted_by\\\": \\\"shreyansh\\\", \\\"post_content\\\": \\\"or baaki??\\\", \\\"time_of_post\\\": \\\"2015-02-25T10:38:05Z\\\"}, \\\"model\\\": \\\"wall.user_post\\\", \\\"pk\\\": 65}, {\\\"fields\\\": {\\\"post_id\\\": \\\"aquaman10:03AM on February 25, 2015\\\", \\\"posted_by\\\": \\\"aquaman\\\", \\\"post_content\\\": \\\"badiya\\\", \\\"time_of_post\\\": \\\"2015-02-25T10:03:39Z\\\"}, \\\"model\\\": \\\"wall.user_post\\\", \\\"pk\\\": 64}, {\\\"fields\\\": {\\\"post_id\\\": \\\"shreyansh10:03AM on February 25, 2015\\\", \\\"posted_by\\\": \\\"shreyansh\\\", \\\"post_content\\\": \\\"thik ba\\\", \\\"time_of_post\\\": \\\"2015-02-25T10:03:23Z\\\"}, \\\"model\\\": \\\"wall.user_post\\\", \\\"pk\\\": 63}, {\\\"fields\\\": {\\\"post_id\\\": \\\"aquaman10:00AM on February 25, 2015\\\", \\\"posted_by\\\": \\\"aquaman\\\", \\\"post_content\\\": \\\"kaisan??\\\", \\\"time_of_post\\\": \\\"2015-02-25T10:00:30Z\\\"}, \\\"model\\\": \\\"wall.user_post\\\", \\\"pk\\\": 62}, {\\\"fields\\\": {\\\"post_id\\\": \\\"aquaman10:00AM on February 25, 2015\\\", \\\"posted_by\\\": \\\"aquaman\\\", \\\"post_content\\\": \\\"hi\\\", \\\"time_of_post\\\": \\\"2015-02-25T10:00:04Z\\\"}, \\\"model\\\": \\\"wall.user_post\\\", \\\"pk\\\": 61}, {\\\"fields\\\": {\\\"post_id\\\": \\\"aquaman09:58AM on February 25, 2015\\\", \\\"posted_by\\\": \\\"aquaman\\\", \\\"post_content\\\": \\\"abe jldi likh\\\", \\\"time_of_post\\\": \\\"2015-02-25T09:58:43Z\\\"}, \\\"model\\\": \\\"wall.user_post\\\", \\\"pk\\\": 60}, {\\\"fields\\\": {\\\"post_id\\\": \\\"aquaman09:57AM on February 25, 2015\\\", \\\"posted_by\\\": \\\"aquaman\\\", \\\"post_content\\\": \\\"hello\\\", \\\"time_of_post\\\": \\\"2015-02-25T09:57:49Z\\\"}, \\\"model\\\": \\\"wall.user_post\\\", \\\"pk\\\": 59}, {\\\"fields\\\": {\\\"post_id\\\": \\\"shreyansh09:39AM on February 25, 2015\\\", \\\"posted_by\\\": \\\"shreyansh\\\", \\\"post_content\\\": \\\"lele\\\", \\\"time_of_post\\\": \\\"2015-02-25T09:39:39Z\\\"}, \\\"model\\\": \\\"wall.user_post\\\", \\\"pk\\\": 58}]\"\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHelp me how can I get this data through javascript.\u003c/p\u003e\n\n\u003cp\u003eThanks in advance.\u003c/p\u003e","accepted_answer_id":"28751159","answer_count":"2","comment_count":"2","creation_date":"2015-02-26 19:23:39.833 UTC","last_activity_date":"2015-02-26 21:10:13.503 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"4428377","post_type_id":"1","score":"1","tags":"javascript|json|django","view_count":"254"} {"id":"5584533","title":"sorl-thumbnail: resize original image before saving?","body":"\u003cp\u003eUsing sorl-thumbnail v11.01 and an ImageField on my model is there a simple way to have an uploaded file resized before saving it (to avoid saving a massive image, in case one has been uploaded)? Thanks in advance.\u003c/p\u003e","answer_count":"2","comment_count":"0","creation_date":"2011-04-07 16:40:19.483 UTC","last_activity_date":"2012-09-12 05:35:52.213 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"313472","post_type_id":"1","score":"3","tags":"django|image-processing|django-models|sorl-thumbnail","view_count":"1205"} -{"id":"44239788","title":"MySQL Failover error \"Missing gtid_executed system variable\"","body":"\u003cp\u003eI have done a GTID replication in MySQL 5.7.18, I have setup the fail over both master and slave health is good. When I am trying to down master I am getting this error. \u003c/p\u003e\n\n\u003cblockquote\u003e\n \u003cp\u003eFailover starting in 'auto' mode...\n 2017-05-29 14:53:56 PM CRITICAL The server IP :3306 does not comply to the latest GTID feature support. Errors:\n Missing gtid_executed system variable.\u003c/p\u003e\n\u003c/blockquote\u003e\n\n\u003cp\u003eSo I googled, they were telling to check global variable and variable which I don't understand. This is my master status of \u003ccode\u003egtid_exe\u003c/code\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003emysql\u0026gt; show variables like '%**gtid_exe%'**;\n\n+----------------------------------+-------+\n| Variable_name | Value |\n+----------------------------------+-------+\n| gtid_executed_compression_period | 1000 |\n+----------------------------------+-------+\n1 row in set (0.00 sec)\n\n\nmysql\u0026gt; show global variables like '%**gtid_exe%**';\n\n+----------------------------------+-------------------------------------------------+\n| Variable_name | Value |\n+----------------------------------+-------------------------------------------------+\n| **gtid_executed** | c6b90b56-4084-11e7-8af7-00163e4da2ba:1-26006378 |\n| gtid_executed_compression_period | 1000 |\n+----------------------------------+-------------------------------------------------+\n2 rows in set (0.01 sec)\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"0","comment_count":"0","creation_date":"2017-05-29 10:06:01.243 UTC","favorite_count":"1","last_activity_date":"2017-05-29 12:31:33.18 UTC","last_edit_date":"2017-05-29 12:31:33.18 UTC","last_editor_display_name":"","last_editor_user_id":"13317","owner_display_name":"","owner_user_id":"8059939","post_type_id":"1","score":"1","tags":"mysql","view_count":"13"} +{"id":"44239788","title":"MySQL Failover error \"Missing gtid_executed system variable\"","body":"\u003cp\u003eI have done a GTID replication in MySQL 5.7.18, I have setup the fail over both cluster_manager and slave health is good. When I am trying to down cluster manager I am getting this error. \u003c/p\u003e\n\n\u003cblockquote\u003e\n \u003cp\u003eFailover starting in 'auto' mode...\n 2017-05-29 14:53:56 PM CRITICAL The server IP :3306 does not comply to the latest GTID feature support. Errors:\n Missing gtid_executed system variable.\u003c/p\u003e\n\u003c/blockquote\u003e\n\n\u003cp\u003eSo I googled, they were telling to check global variable and variable which I don't understand. This is my cluster manager status of \u003ccode\u003egtid_exe\u003c/code\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003emysql\u0026gt; show variables like '%**gtid_exe%'**;\n\n+----------------------------------+-------+\n| Variable_name | Value |\n+----------------------------------+-------+\n| gtid_executed_compression_period | 1000 |\n+----------------------------------+-------+\n1 row in set (0.00 sec)\n\n\nmysql\u0026gt; show global variables like '%**gtid_exe%**';\n\n+----------------------------------+-------------------------------------------------+\n| Variable_name | Value |\n+----------------------------------+-------------------------------------------------+\n| **gtid_executed** | c6b90b56-4084-11e7-8af7-00163e4da2ba:1-26006378 |\n| gtid_executed_compression_period | 1000 |\n+----------------------------------+-------------------------------------------------+\n2 rows in set (0.01 sec)\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"0","comment_count":"0","creation_date":"2017-05-29 10:06:01.243 UTC","favorite_count":"1","last_activity_date":"2017-05-29 12:31:33.18 UTC","last_edit_date":"2017-05-29 12:31:33.18 UTC","last_editor_display_name":"","last_editor_user_id":"13317","owner_display_name":"","owner_user_id":"8059939","post_type_id":"1","score":"1","tags":"mysql","view_count":"13"} {"id":"36010062","title":"Inserting a line of text at the beginning of an Access export","body":"\u003cp\u003eI would like to export Access query results to a text file with some added string in the first line of exported file. \u003c/p\u003e\n\n\u003cp\u003eSpecifically, I would like to combine a text string:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e *Abc def\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ewith the Access query results (tab delimited): \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eDoCmd.TransferText acExportDelim, \"Export_spec\", \"Export\", \"C:\\export.txt\", True, \"\"\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eand then save it as a text file.\u003c/p\u003e\n\n\u003cp\u003eThe text string have to be in the first line of the text file, followed by access query results. \u003c/p\u003e\n\n\u003cp\u003eThe results should looks like:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e*Abc def\nHeader1 Header2 Header3 Header4 ...\nValue1 Value2 Value3 Value4 ...\n... ... ... ... ...\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"1","comment_count":"0","creation_date":"2016-03-15 11:29:21.363 UTC","favorite_count":"0","last_activity_date":"2016-03-15 13:38:09.443 UTC","last_edit_date":"2016-03-15 13:38:09.443 UTC","last_editor_display_name":"","last_editor_user_id":"2144390","owner_display_name":"","owner_user_id":"6066007","post_type_id":"1","score":"1","tags":"vba|ms-access|access-vba","view_count":"84"} {"id":"3126162","title":"Is this a good architecture / design concept for handling/manipulating file uploads?","body":"\u003cp\u003eI'm looking at adding multi-file uploading to our \u003ccode\u003eASP.NET MVC\u003c/code\u003e web application. I am going to use the \u003ca href=\"http://www.aurigma.com/\" rel=\"nofollow noreferrer\"\u003e3rd Party Multi-File uploader Aurigma\u003c/a\u003e to handle the actual uploading. \u003c/p\u003e\n\n\u003cp\u003eOnce each file is 100% received by the web server, it needs to be checked for the following\u003c/p\u003e\n\n\u003col\u003e\n\u003cli\u003eis it an image or video.\u003c/li\u003e\n\u003cli\u003eif it's an image, does it need to be resized? if so, resize.\u003c/li\u003e\n\u003cli\u003eif it's a video, we need to re-encode it to flash (unfortunately.. bring on html5 :) )\u003c/li\u003e\n\u003cli\u003efinally, store on S3 amazon.\u003c/li\u003e\n\u003c/ol\u003e\n\n\u003cp\u003eSo i know how to do most of steps 1 to 4 - that's not the question.\u003c/p\u003e\n\n\u003cp\u003eMy question is: \u003cstrong\u003ehow should I really be handling this workflow\u003c/strong\u003e? Especially if i get a bulk of media at once -\u003e after all, this is a \u003cem\u003emulti-file\u003c/em\u003e uploader :) I don't want to have lots of media getting processed at once (eg. 5 video's getting encoded to flash..).\u003c/p\u003e\n\n\u003cp\u003eSo I thought i might have \u003ccode\u003eMSMQ\u003c/code\u003e installed and when each file gets 100% recieved, then pop it into \u003ccode\u003eMSMQ\u003c/code\u003e. That way, only one item is getting \u003cem\u003eprocessed\u003c/em\u003e at once. The cost of this, is that if there's a lot of \u003cem\u003eexpensive\u003c/em\u003e processing, the queue might actually start to get a few items in there ... and there will be some waiting period from the time an item is uploaded to the site, until it's actually 100% processed. We can easily handle this in the UI to tell them it's not finished yet.\u003c/p\u003e\n\n\u003cp\u003eSo - does this sound like an OK way to handle this problem?\u003c/p\u003e\n\n\u003cp\u003eSecondly, this is in a web farm scenario .. so installation / deployment / maintenance needs to be considered.\u003c/p\u003e\n\n\u003cp\u003eWould love to see what other people are thinking. \u003c/p\u003e","answer_count":"2","comment_count":"0","creation_date":"2010-06-27 02:23:24.31 UTC","last_activity_date":"2010-06-27 03:39:47.223 UTC","last_edit_date":"2010-06-27 03:39:47.223 UTC","last_editor_display_name":"","last_editor_user_id":"30674","owner_display_name":"","owner_user_id":"30674","post_type_id":"1","score":"0","tags":"design|architecture|file-upload|queue|msmq","view_count":"671"} {"id":"24212122","title":"Curl header request returning 404 but body returning 200","body":"\u003cp\u003eI'm sending a header request with curl using the following code \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003efunction getContentType($u)\n{\n $ch = curl_init();\n $url = $u;\n curl_setopt($ch, CURLOPT_URL, $url);\n curl_setopt($ch, CURLOPT_HEADER, 1);\n curl_setopt($ch, CURLOPT_NOBODY, 1);\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);\n curl_setopt($ch, CURLOPT_AUTOREFERER, true);\n curl_setopt($ch, CURLOPT_USERAGENT, \"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:7.0.1) Gecko/20100101 Firefox/7.0.12011-10-16 20:23:00\");\n\n $results = split(\"\\n\", trim(curl_exec($ch)));\n print_r($results);\n foreach($results as $line) {\n if (strtok($line, ':') == 'Content-Type') {\n $parts = explode(\":\", $line);\n return trim($parts[1]);\n }\n }\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eFor most websites it is returning correctly, although for some servers it is returning a 404 error when the page is actually available. I'm assuming this is because the servers have been configured to reject the header request. \u003c/p\u003e\n\n\u003cp\u003eI'm looking for a way to bypass this server header request rejection, or a way to tell if the header request has been rejected and is not in fact 404. \u003c/p\u003e","accepted_answer_id":"24212203","answer_count":"1","comment_count":"0","creation_date":"2014-06-13 18:52:35.603 UTC","last_activity_date":"2014-06-13 18:57:42.843 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"290957","post_type_id":"1","score":"1","tags":"php|curl|http-headers|content-type","view_count":"789"} @@ -611,7 +611,7 @@ {"id":"3903598","title":"What's a good shuffle percentage?","body":"\u003cp\u003eI'm basically new to coding for random results, but did some reading and tested out the javascript version of the Fisher-Yates algorithm (as seen on wikipedia), with an ordered list.\u003c/p\u003e\n\n\u003cp\u003eI ended up adding code to make sure the array was shuffled differently than its initial order, and also calculated the percentage of how many objects were shuffled to a different position by the algorithm.\u003c/p\u003e\n\n\u003cp\u003eSo I'm wondering what might be considered a good result. Kind of a generic question. If I shuffled a deck of cards, what would be the least acceptable amount of shuffle? Right now I have mine coded to repeat the algorithm if it comes out less than 25 percent shuffled.\u003c/p\u003e\n\n\u003cp\u003eWhat do you think?\u003c/p\u003e","answer_count":"3","comment_count":"1","creation_date":"2010-10-11 04:52:08.89 UTC","favorite_count":"0","last_activity_date":"2010-10-14 01:14:26.17 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"471935","post_type_id":"1","score":"4","tags":"arrays|algorithm","view_count":"168"} {"id":"13384124","title":"How to migrate database from SAP DB to PostGres?","body":"\u003cp\u003eAny idea how to go about doing that through a tool(preferred). Any alternate ways to do that.\u003c/p\u003e","answer_count":"2","comment_count":"1","creation_date":"2012-11-14 17:35:18.15 UTC","last_activity_date":"2012-11-19 22:28:21.503 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"731433","post_type_id":"1","score":"0","tags":"postgresql|migration|sap","view_count":"820"} {"id":"18988561","title":"how to integrate Paypal Express checkout using new method?","body":"\u003cp\u003eI want to integrate PAYPAL EXPRESS CHECKOUT in my project. I think PAYPAL has upgraded the APIs and its methods. I downloaded REST API from Github but I am not able to figure out how to integrate it. All i get is confused. Because in that REST zip I downloaded there are so many files and I was not able to understand how can i integrate express checkout with the new API and method. Also I have gone through many of the sites with the examples but as soon as I execute them I get an error 10001. Please help.\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2013-09-24 17:48:11.013 UTC","last_activity_date":"2013-12-17 15:29:02.25 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1960411","post_type_id":"1","score":"0","tags":"paypal","view_count":"756"} -{"id":"26341233","title":"ng-flow - no destination directory option","body":"\u003cp\u003eI am using ng-flow in my application and it works pretty well. Currently, the destination directory for the files being uploaded is set in my web.config and used within my webapi controller method.\u003c/p\u003e\n\n\u003cp\u003eWhat I want to do is allow the user to specify the destination, rather than it come from config. However, looking at the \u003ca href=\"https://github.com/flowjs/flow.js/blob/master/README.md\" rel=\"nofollow\"\u003edocs\u003c/a\u003e, I don't see an option that I can add to the below appconfig for this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003efunction appConfig(flowFactoryProvider) {\nflowFactoryProvider.defaults = {\n target: 'api/upload',\n permanentErrors: [404, 500, 501],\n maxChunkRetries: 1,\n chunkRetryInterval: 5000,\n simultaneousUploads: 4\n};\nflowFactoryProvider.on('catchAll', function (event) {\n console.log('catchAll', arguments);\n});\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e}\u003c/p\u003e\n\n\u003cp\u003eAm i missing something or do I need to handle this myself?\u003c/p\u003e","answer_count":"1","comment_count":"1","creation_date":"2014-10-13 13:31:27.403 UTC","last_activity_date":"2015-04-13 08:43:15.543 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1005609","post_type_id":"1","score":"1","tags":"angularjs|angularjs-directive|flow-js","view_count":"361"} +{"id":"26341233","title":"ng-flow - no destination directory option","body":"\u003cp\u003eI am using ng-flow in my application and it works pretty well. Currently, the destination directory for the files being uploaded is set in my web.config and used within my webapi controller method.\u003c/p\u003e\n\n\u003cp\u003eWhat I want to do is allow the user to specify the destination, rather than it come from config. However, looking at the \u003ca href=\"https://github.com/flowjs/flow.js/blob/main/README.md\" rel=\"nofollow\"\u003edocs\u003c/a\u003e, I don't see an option that I can add to the below appconfig for this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003efunction appConfig(flowFactoryProvider) {\nflowFactoryProvider.defaults = {\n target: 'api/upload',\n permanentErrors: [404, 500, 501],\n maxChunkRetries: 1,\n chunkRetryInterval: 5000,\n simultaneousUploads: 4\n};\nflowFactoryProvider.on('catchAll', function (event) {\n console.log('catchAll', arguments);\n});\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e}\u003c/p\u003e\n\n\u003cp\u003eAm i missing something or do I need to handle this myself?\u003c/p\u003e","answer_count":"1","comment_count":"1","creation_date":"2014-10-13 13:31:27.403 UTC","last_activity_date":"2015-04-13 08:43:15.543 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1005609","post_type_id":"1","score":"1","tags":"angularjs|angularjs-directive|flow-js","view_count":"361"} {"id":"40931444","title":"spark embedded (same JVM) for \u003c400k text file process","body":"\u003cp\u003eCan we do a mini spark job embedded in our app? Any example? Reason : want to process part of a file and give results quicker than submitting a regular job. File is only 500 lines. But do not want to keep 2 code bases - just the one that is used for the large files too. File size is less than an MB.\u003c/p\u003e\n\n\u003cp\u003eI want to process the file in the same JVM that my client code is running. Want a single executor kicked off from within same JVM, via a flag in the config. (so a few jobs will have this flag set and others wont. Those that do not will run as usual on the cluster.)\u003c/p\u003e","answer_count":"0","comment_count":"0","creation_date":"2016-12-02 11:43:51.687 UTC","favorite_count":"1","last_activity_date":"2016-12-02 18:59:07.85 UTC","last_edit_date":"2016-12-02 18:59:07.85 UTC","last_editor_display_name":"","last_editor_user_id":"1643558","owner_display_name":"","owner_user_id":"1643558","post_type_id":"1","score":"1","tags":"apache-spark","view_count":"23"} {"id":"38223491","title":"Can I configure settings in UWP app desktop scanner?","body":"\u003cp\u003eI have had good success in getting input from a flatbed scanner in my UWP app \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eusing Windows.Devices.Enumeration;\nusing Windows.Devices.Scanners;\n\nImageScanner myScanner = await ImageScanner.FromIdAsync(deviceId);\nvar result = await myScanner.ScanFilesToFolderAsync(ImageScannerScanSource.Default, folder);\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eand even make use of the auto configured scan profile\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eif (myScanner.IsScanSourceSupported(ImageScannerScanSource.AutoConfigured))\n{\n ...\n // Scan API call to start scanning with Auto-Configured settings. \n var result = await myScanner.ScanFilesToFolderAsync(\n ImageScannerScanSource.AutoConfigured, folder).AsTask(cancellationToken.Token, progress);\n ...\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ebut is there any way that I can control the configuration, get a lower resolution or just B\u0026amp;W? All of the format options appear to be read only properties. I have tried to make an external scanner profile in Win10 but it isn't picked up (even when it is the default). The API appears to be aware of the scanner supported settings because the ScanToStream equivalent call reads in lowest possible resolution as a preview.\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2016-07-06 12:00:56.09 UTC","last_activity_date":"2016-07-11 04:58:25.88 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"6555901","post_type_id":"1","score":"0","tags":".net|uwp|resolution|scanning","view_count":"110"} {"id":"31867819","title":"MySQL - Delete a selection","body":"\u003cp\u003eI am trying to delete all the accounts associated with IPs that are used more than two times in my MyBB database. The following code works to \"select\" these users.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eSELECT * FROM `mybb_forumusers` WHERE `regip` IN (\n SELECT `regip` FROM `mybb_forumusers`\n GROUP BY `regip`\n HAVING COUNT( `regip` ) \u0026gt; 2\n)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHowever, I cannot successfully delete all of these users without getting errors. I have tried the following (and variations):\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eDELETE FROM `mybb_forumusers` WHERE `uid` IN (\n SELECT `uid` FROM `mybb_forumusers` WHERE `regip`IN (\n SELECT `regip` FROM `mybb_forumusers`\n GROUP BY `regip`\n HAVING COUNT( `regip` ) \u0026gt; 2\n )\n)\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"31867845","answer_count":"1","comment_count":"1","creation_date":"2015-08-07 00:23:34.04 UTC","last_activity_date":"2015-08-07 00:26:32.227 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"4506174","post_type_id":"1","score":"2","tags":"mysql|sql|database|mybb","view_count":"32"} @@ -717,7 +717,7 @@ {"id":"6383779","title":"Making Text field empty when clicking on it (Prototype Framework of javascript)","body":"\u003cp\u003eThats my input field. I want to make value of it empty when I click it. How can I do this by using prototype framework of javascript ? \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;input name=\"ctl0$txtSearch\" type=\"text\" value=\"Quick Search\" id=\"ctl0_txtSearch\" class=\"MainSearchBar\" /\u0026gt; \n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThanks in advance,\u003c/p\u003e\n\n\u003cp\u003eActually I am using PRADO. So the html tag to create input is \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e \u0026lt;com:TTextBox Id=\"txtSearch\" Text=\"Quick Search\" CssClass=\"MainSearchBar\" /\u0026gt; \n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAnd it has no onclick attr to handle javascript. \u003c/p\u003e","accepted_answer_id":"6384830","answer_count":"4","comment_count":"1","creation_date":"2011-06-17 09:23:06.97 UTC","last_activity_date":"2011-06-17 11:05:18.04 UTC","last_edit_date":"2011-06-17 09:43:09.247 UTC","last_editor_display_name":"","last_editor_user_id":"735259","owner_display_name":"","owner_user_id":"735259","post_type_id":"1","score":"0","tags":"javascript|html|javascript-events|javascript-framework|prototypejs","view_count":"1385"} {"id":"24741403","title":"How can I retrieve information for only a specific type of activity from the Pivotal Tracker API?","body":"\u003cp\u003eI am getting JSON information from the Pivotal Tracker API, and I need to get certain info, instead of all the raw data. To do this, I used \u003ccode\u003eJSON.parse()\u003c/code\u003e to convert the JSON to a Ruby array of hashes.\u003c/p\u003e\n\n\u003cp\u003eNow, I need to iterate through this array and only return the relevant hashes. \u003c/p\u003e\n\n\u003cp\u003eFor example, I just want to return the \u003ccode\u003eprimary_resources\u003c/code\u003e hash that has a nested hash of:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\"story_type\" =\u0026gt; \"feature\"\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eTo do this, I wrote this code (\u003ccode\u003eresponse.body\u003c/code\u003e is the data returned from the GET request):\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e@data = response.body\nparsed = JSON.parse(@data)\nputs parsed['primary_resources']['story_type']['feature']\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhen I run the script, I get this error:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eno implicit conversion of String into Integer (TypeError)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eIt seems that it is iterating through an array of hashes and looking for an integer number of the array (like \u003ccode\u003earray[3]\u003c/code\u003e or \u003ccode\u003earray[0]\u003c/code\u003e), but that doesn't help me. I need to return all the hashes that have a nested hash \u003ccode\u003e:kind =\u0026gt; story\u003c/code\u003e in the primary resources hash.\u003c/p\u003e\n\n\u003cp\u003eI also tried to do this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eparsed.each do |entry|\n puts entry['primary_resources']['story_Type']['feature']\nend\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eand I got the same error.\u003c/p\u003e\n\n\u003cp\u003eHere is my full code:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003erequire 'json'\nrequire 'net/http'\nrequire 'open-uri'\nrequire 'openssl'\nrequire 'active_support'\n\nprompt = '\u0026gt; '\nputs \"What is the id of the Project you want to get data from?\"\nprint prompt\nproject_id = STDIN.gets.chomp()\nputs \"What is the beginning date you want to return from? ex: 2014-07-02\"\nprint prompt\ndate1 = STDIN.gets.chomp()\nputs \"What is the end date you want to return from? ex: 2014-07-16\"\nprint prompt\ndate2 = STDIN.gets.chomp()\n\n\n\ndef scope(project_id, date1, date2)\n uri = URI.parse(\"https://www.pivotaltracker.com/services/v5/projects/#{project_id}/activity?occurred_after=#{date1}T01:00:15Z\u0026amp;occurred_before=#{date2}T01:00:15Z\u0026amp;fields=primary_resources\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Get.new(uri.request_uri)\n request.add_field(\"X-TrackerToken\", \"*****************\")\n response = http.request(request)\n @data = response.body\n parsed = JSON.parse(@data)\n puts parsed['primary_resources']['story_type']['feature']\n # parsed.each do |entry|\n # puts entry['primary_resources']['kind']['story']\n # end\n\n # puts parsed['primary_resources'].select { |r| r['story_type'].eql? 'feature' }\nend\n\nscope(project_id, date1, date2)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHere is some of the JSON response, without parsing (full response is too long, and really just the same response for like 15 other user stories):\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eWhat is the id of the Project you want to get data from?\n\u0026gt; 961142\nWhat is the beginning date you want to return from? ex: 2014-07-02\n\u0026gt; 2014-07-02\nWhat is the end date you want to return from? ex: 2014-07-16\n\u0026gt; 2014-07-03\n[\n {\n \"primary_resources\": [\n {\n \"kind\": \"story\",\n \"id\": 74313670,\n \"name\": \"User can make an image fit inside the grid when viewing image detail and save it to case template. BUILD 146\",\n \"story_type\": \"bug\",\n \"url\": \"https://www.pivotaltracker.com/story/show/74313670\"\n }\n ],\n \"guid\": \"961142_3419\",\n \"project_version\": 3419\n },\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHere is some of the JSON response, after parsing (only showing first story for same reason as above):\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eWhat is the id of the Project you want to get data from?\n\u0026gt; 961142\nWhat is the beginning date you want to return from? ex: 2014-07-02\n\u0026gt; 2014-07-02\nWhat is the end date you want to return from? ex: 2014-07-16\n\u0026gt; 2014-07-03\n{\"primary_resources\"=\u0026gt;[{\"kind\"=\u0026gt;\"story\", \"id\"=\u0026gt;74313670, \"name\"=\u0026gt;\"User can make an image fit inside the grid when viewing image detail and save it to case template. BUILD 146\", \"story_type\"=\u0026gt;\"bug\", \"url\"=\u0026gt;\"https://www.pivotaltracker.com/story/show/74313670\"}], \"guid\"=\u0026gt;\"961142_3419\", \"project_version\"=\u0026gt;3419}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHow can I iterate through this array of hashes and return only the ones of \"story_type\"=\u003e\"feature\" ? \u003c/p\u003e","accepted_answer_id":"24745481","answer_count":"1","comment_count":"5","creation_date":"2014-07-14 16:35:00.563 UTC","last_activity_date":"2015-05-20 17:40:52.79 UTC","last_edit_date":"2015-05-20 17:40:52.79 UTC","last_editor_display_name":"","last_editor_user_id":"473305","owner_display_name":"","owner_user_id":"3784445","post_type_id":"1","score":"-1","tags":"ruby|json|parsing|iteration|pivotaltracker","view_count":"189"} {"id":"21392946","title":"How to auto-format javascript to align multiple lines with require() statements","body":"\u003cp\u003eI am using js-beautify from \u003ca href=\"https://github.com/einars/js-beautify\" rel=\"nofollow\"\u003eeinars\u003c/a\u003e, and I am trying to\nconfigure the options to achieve the following format:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003evar a = require(\"lib-a\"),\n alongvariable = require(\"another-lib-a\");\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eor \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003evar a = require(\"lib-a\");\nvar alongvariable = require(\"another-lib-a\");\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eDoes a combination of option would allow to produce this layout ?\u003c/p\u003e","answer_count":"0","comment_count":"2","creation_date":"2014-01-27 22:23:03.783 UTC","last_activity_date":"2014-01-30 03:24:55.437 UTC","last_edit_date":"2014-01-30 03:24:55.437 UTC","last_editor_display_name":"","last_editor_user_id":"1104000","owner_display_name":"","owner_user_id":"1104000","post_type_id":"1","score":"0","tags":"javascript|emacs|code-formatting|js-beautify","view_count":"95"} -{"id":"43369477","title":"instanceID return nil in real device but wasn't nil in simulator in ios","body":"\u003cp\u003eI using fcm for push notification.\nI develop completely FCM on my project and i follow step by step of tutorial of firebase \n(my language is objective - c)\nmy device token is generated, but instanceID not generated !! in other words refreshToken Method not called ever !.\nnow when i run my project in simulator instanceID was generated. but when i run my project in real Device instanceID return null !! \nmy time \u0026amp; date in real device is up to date but still not working !! it's log of my console when run project in simulator : \u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"https://i.stack.imgur.com/40d5K.jpg\" rel=\"nofollow noreferrer\"\u003elog for simulator.\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eand this log when run my project in a real device : \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e2017-04-12 16:53:44.504 pin-Go[1031] \u0026lt;Notice\u0026gt; [Firebase/Analytics][I-ACS023012] Firebase Analytics enabled\n2017-04-12 16:53:44.546831+0430 pin-Go[1031:175957] APNs token retrieved: \u0026lt;f73de751 b71d59b8 f1e3b83a 826646ba d6338e7c a1a062be 4adda159 83cb5fa5\u0026gt;\n2017-04-12 16:53:44.804239+0430 pin-Go[1031:175957] animating is complited ..\n2017-04-12 16:53:44.804639+0430 pin-Go[1031:175957] animating is complited.\n2017-04-12 16:53:45.124628+0430 pin-Go[1031:175957] animating1 ...\n2017-04-12 16:53:45.751638+0430 pin-Go[1031:175957] Connected to FCM.\n2017-04-12 16:53:45.755046+0430 pin-Go[1031:175957] InstanceID token: (null)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eand my code is Exactly like this code : \u003ca href=\"https://github.com/firebase/quickstart-ios/blob/master/messaging/MessagingExample/AppDelegate.m\" rel=\"nofollow noreferrer\"\u003ehttps://github.com/firebase/quickstart-ios/blob/master/messaging/MessagingExample/AppDelegate.m\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eand my log don't show any error for that ...\nanyone can help me pls ??\u003c/p\u003e\n\n\u003cp\u003eEdit : That is my code : \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e #if defined(__IPHONE_10_0) \u0026amp;\u0026amp; __IPHONE_OS_VERSION_MAX_ALLOWED \u0026gt;= __IPHONE_10_0\n @import UserNotifications;\n #endif\n @import GoogleMaps;\n @import GooglePlaces;\n #import \"AfzayeshMojodiViewController.h\"\n #import \"ChangeInfoViewController.h\"\n #import \"MasirMontakhaViewController.h\"\n @import Firebase;\n\n\n // Implement UNUserNotificationCenterDelegate to receive display notification via APNS for devices\n // running iOS 10 and above. Implement FIRMessagingDelegate to receive data message via FCM for\n // devices running iOS 10 and above.\n #if defined(__IPHONE_10_0) \u0026amp;\u0026amp; __IPHONE_OS_VERSION_MAX_ALLOWED \u0026gt;= __IPHONE_10_0\n @interface AppDelegate () \u0026lt;UNUserNotificationCenterDelegate, FIRMessagingDelegate\u0026gt;\n @end\n #endif\n // Copied from Apple's header in case it is missing in some cases (e.g. pre-Xcode 8 builds).\n #ifndef NSFoundationVersionNumber_iOS_9_x_Max\n #define NSFoundationVersionNumber_iOS_9_x_Max 1299\n #endif\n\n @implementation AppDelegate\n NSString *const kGCMMessageIDKey = @\"gcm.message_id\";\n\n - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {\n self.urlStrWebService = [[NSString alloc] init];\n\n\n //Start of GCM\n // [START configure_firebase]\n [FIRApp configure];\n\n if (floor(NSFoundationVersionNumber) \u0026lt;= NSFoundationVersionNumber_iOS_9_x_Max) {\n UIUserNotificationType allNotificationTypes =\n (UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge);\n UIUserNotificationSettings *settings =\n [UIUserNotificationSettings settingsForTypes:allNotificationTypes categories:nil];\n [[UIApplication sharedApplication] registerUserNotificationSettings:settings];\n } else {\n // iOS 10 or later\n #if defined(__IPHONE_10_0) \u0026amp;\u0026amp; __IPHONE_OS_VERSION_MAX_ALLOWED \u0026gt;= __IPHONE_10_0\n // For iOS 10 display notification (sent via APNS)\n [UNUserNotificationCenter currentNotificationCenter].delegate = self;\n UNAuthorizationOptions authOptions =\n UNAuthorizationOptionAlert\n | UNAuthorizationOptionSound\n | UNAuthorizationOptionBadge;\n [[UNUserNotificationCenter currentNotificationCenter] requestAuthorizationWithOptions:authOptions completionHandler:^(BOOL granted, NSError * _Nullable error) {\n }];\n\n // For iOS 10 data message (sent via FCM)\n [FIRMessaging messaging].remoteMessageDelegate = self;\n #endif\n }\n\n [[UIApplication sharedApplication] registerForRemoteNotifications];\n return YES;\n} \n\n//start implementing notification reciver :\n\n\n//// [START receive_message]\n- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {\n // If you are receiving a notification message while your app is in the background,\n // this callback will not be fired till the user taps on the notification launching the application.\n // TODO: Handle data of notification\n\n // Print message ID.\n if (userInfo[kGCMMessageIDKey]) {\n NSLog(@\"Message ID: %@\", userInfo[kGCMMessageIDKey]);\n }\n\n // Print full message.\n NSLog(@\"%@\", userInfo);\n}\n\n- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo\nfetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {\n // If you are receiving a notification message while your app is in the background,\n // this callback will not be fired till the user taps on the notification launching the application.\n // TODO: Handle data of notification\n\n // Print message ID.\n if (userInfo[kGCMMessageIDKey]) {\n NSLog(@\"Message ID: %@\", userInfo[kGCMMessageIDKey]);\n }\n\n\n // Print full message.\n NSLog(@\"%@\", userInfo);\n\n completionHandler(UIBackgroundFetchResultNewData);\n}\n// [END receive_message]\n\n// [START ios_10_message_handling]\n// Receive displayed notifications for iOS 10 devices.\n#if defined(__IPHONE_10_0) \u0026amp;\u0026amp; __IPHONE_OS_VERSION_MAX_ALLOWED \u0026gt;= __IPHONE_10_0\n// Handle incoming notification messages while app is in the foreground.\n- (void)userNotificationCenter:(UNUserNotificationCenter *)center\n willPresentNotification:(UNNotification *)notification\n withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler {\n // Print message ID.\n NSDictionary *userInfo = notification.request.content.userInfo;\n if (userInfo[kGCMMessageIDKey]) {\n NSLog(@\"Message ID: %@\", userInfo[kGCMMessageIDKey]);\n }\n\n // Print full message.\n NSLog(@\"%@\", userInfo);\n\n // Change this to your preferred presentation option\n completionHandler(UNNotificationPresentationOptionNone);\n}\n\n// Handle notification messages after display notification is tapped by the user.\n- (void)userNotificationCenter:(UNUserNotificationCenter *)center\ndidReceiveNotificationResponse:(UNNotificationResponse *)response\n withCompletionHandler:(void (^)())completionHandler {\n NSDictionary *userInfo = response.notification.request.content.userInfo;\n if (userInfo[kGCMMessageIDKey]) {\n NSLog(@\"Message ID: %@\", userInfo[kGCMMessageIDKey]);\n }\n\n // Print full message.\n NSLog(@\"%@\", userInfo);\n\n completionHandler();\n}\n#endif\n// [END ios_10_message_handling]\n\n// [START ios_10_data_message_handling]\n#if defined(__IPHONE_10_0) \u0026amp;\u0026amp; __IPHONE_OS_VERSION_MAX_ALLOWED \u0026gt;= __IPHONE_10_0\n// Receive data message on iOS 10 devices while app is in the foreground.\n- (void)applicationReceivedRemoteMessage:(FIRMessagingRemoteMessage *)remoteMessage {\n // Print full message\n NSLog(@\"%@\", remoteMessage.appData);\n}\n#endif\n// [END ios_10_data_message_handling]\n\n// [START refresh_token]\n- (void)tokenRefreshNotification:(NSNotification *)notification {\n // Note that this callback will be fired everytime a new token is generated, including the first\n // time. So if you need to retrieve the token as soon as it is available this is where that\n // should be done.\n NSString *refreshedToken = [[FIRInstanceID instanceID] token];\n NSLog(@\"InstanceID token: %@\", refreshedToken);\n\n // Connect to FCM since connection may have failed when attempted before having a token.\n [self connectToFcm];\n\n // TODO: If necessary send token to application server.\n}\n// [END refresh_token]\n\n// [START connect_to_fcm]\n- (void)connectToFcm {\n// // Won't connect since there is no token\n// if (![[FIRInstanceID instanceID] token]) {\n// return;\n// }\n\n // Disconnect previous FCM connection if it exists.\n [[FIRMessaging messaging] disconnect];\n\n [[FIRMessaging messaging] connectWithCompletion:^(NSError * _Nullable error) {\n if (error != nil) {\n NSLog(@\"Unable to connect to FCM. %@\", error);\n } else {\n NSLog(@\"Connected to FCM.\");\n NSString *refreshedToken = [[FIRInstanceID instanceID] token];\n NSLog(@\"InstanceID token: %@\", refreshedToken);\n }\n }];\n}\n// [END connect_to_fcm]\n\n- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error {\n NSLog(@\"Unable to register for remote notifications: %@\", error);\n}\n\n// This function is added here only for debugging purposes, and can be removed if swizzling is enabled.\n// If swizzling is disabled then this function must be implemented so that the APNs token can be paired to\n// the InstanceID token.\n- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {\n NSLog(@\"APNs token retrieved: %@\", deviceToken);\n\n // With swizzling disabled you must set the APNs token here.\n [[FIRInstanceID instanceID] setAPNSToken:deviceToken type:FIRInstanceIDAPNSTokenTypeSandbox];\n [self connectToFcm];\n}\n\n// [START connect_on_active]\n- (void)applicationDidBecomeActive:(UIApplication *)application {\n [self connectToFcm];\n}\n// [END connect_on_active]\n\n// [START disconnect_from_fcm]\n- (void)applicationDidEnterBackground:(UIApplication *)application {\n [[FIRMessaging messaging] disconnect];\n NSLog(@\"Disconnected from FCM\");\n}\n// [END disconnect_from_fcm]\n\n\n//end of implement notification.\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"0","comment_count":"2","creation_date":"2017-04-12 12:25:12.407 UTC","last_activity_date":"2017-04-12 13:17:36.36 UTC","last_edit_date":"2017-04-12 13:17:36.36 UTC","last_editor_display_name":"","last_editor_user_id":"5720725","owner_display_name":"","owner_user_id":"5720725","post_type_id":"1","score":"0","tags":"ios|objective-c|null","view_count":"172"} +{"id":"43369477","title":"instanceID return nil in real device but wasn't nil in simulator in ios","body":"\u003cp\u003eI using fcm for push notification.\nI develop completely FCM on my project and i follow step by step of tutorial of firebase \n(my language is objective - c)\nmy device token is generated, but instanceID not generated !! in other words refreshToken Method not called ever !.\nnow when i run my project in simulator instanceID was generated. but when i run my project in real Device instanceID return null !! \nmy time \u0026amp; date in real device is up to date but still not working !! it's log of my console when run project in simulator : \u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"https://i.stack.imgur.com/40d5K.jpg\" rel=\"nofollow noreferrer\"\u003elog for simulator.\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eand this log when run my project in a real device : \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e2017-04-12 16:53:44.504 pin-Go[1031] \u0026lt;Notice\u0026gt; [Firebase/Analytics][I-ACS023012] Firebase Analytics enabled\n2017-04-12 16:53:44.546831+0430 pin-Go[1031:175957] APNs token retrieved: \u0026lt;f73de751 b71d59b8 f1e3b83a 826646ba d6338e7c a1a062be 4adda159 83cb5fa5\u0026gt;\n2017-04-12 16:53:44.804239+0430 pin-Go[1031:175957] animating is complited ..\n2017-04-12 16:53:44.804639+0430 pin-Go[1031:175957] animating is complited.\n2017-04-12 16:53:45.124628+0430 pin-Go[1031:175957] animating1 ...\n2017-04-12 16:53:45.751638+0430 pin-Go[1031:175957] Connected to FCM.\n2017-04-12 16:53:45.755046+0430 pin-Go[1031:175957] InstanceID token: (null)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eand my code is Exactly like this code : \u003ca href=\"https://github.com/firebase/quickstart-ios/blob/main/messaging/MessagingExample/AppDelegate.m\" rel=\"nofollow noreferrer\"\u003ehttps://github.com/firebase/quickstart-ios/blob/main/messaging/MessagingExample/AppDelegate.m\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eand my log don't show any error for that ...\nanyone can help me pls ??\u003c/p\u003e\n\n\u003cp\u003eEdit : That is my code : \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e #if defined(__IPHONE_10_0) \u0026amp;\u0026amp; __IPHONE_OS_VERSION_MAX_ALLOWED \u0026gt;= __IPHONE_10_0\n @import UserNotifications;\n #endif\n @import GoogleMaps;\n @import GooglePlaces;\n #import \"AfzayeshMojodiViewController.h\"\n #import \"ChangeInfoViewController.h\"\n #import \"MasirMontakhaViewController.h\"\n @import Firebase;\n\n\n // Implement UNUserNotificationCenterDelegate to receive display notification via APNS for devices\n // running iOS 10 and above. Implement FIRMessagingDelegate to receive data message via FCM for\n // devices running iOS 10 and above.\n #if defined(__IPHONE_10_0) \u0026amp;\u0026amp; __IPHONE_OS_VERSION_MAX_ALLOWED \u0026gt;= __IPHONE_10_0\n @interface AppDelegate () \u0026lt;UNUserNotificationCenterDelegate, FIRMessagingDelegate\u0026gt;\n @end\n #endif\n // Copied from Apple's header in case it is missing in some cases (e.g. pre-Xcode 8 builds).\n #ifndef NSFoundationVersionNumber_iOS_9_x_Max\n #define NSFoundationVersionNumber_iOS_9_x_Max 1299\n #endif\n\n @implementation AppDelegate\n NSString *const kGCMMessageIDKey = @\"gcm.message_id\";\n\n - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {\n self.urlStrWebService = [[NSString alloc] init];\n\n\n //Start of GCM\n // [START configure_firebase]\n [FIRApp configure];\n\n if (floor(NSFoundationVersionNumber) \u0026lt;= NSFoundationVersionNumber_iOS_9_x_Max) {\n UIUserNotificationType allNotificationTypes =\n (UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge);\n UIUserNotificationSettings *settings =\n [UIUserNotificationSettings settingsForTypes:allNotificationTypes categories:nil];\n [[UIApplication sharedApplication] registerUserNotificationSettings:settings];\n } else {\n // iOS 10 or later\n #if defined(__IPHONE_10_0) \u0026amp;\u0026amp; __IPHONE_OS_VERSION_MAX_ALLOWED \u0026gt;= __IPHONE_10_0\n // For iOS 10 display notification (sent via APNS)\n [UNUserNotificationCenter currentNotificationCenter].delegate = self;\n UNAuthorizationOptions authOptions =\n UNAuthorizationOptionAlert\n | UNAuthorizationOptionSound\n | UNAuthorizationOptionBadge;\n [[UNUserNotificationCenter currentNotificationCenter] requestAuthorizationWithOptions:authOptions completionHandler:^(BOOL granted, NSError * _Nullable error) {\n }];\n\n // For iOS 10 data message (sent via FCM)\n [FIRMessaging messaging].remoteMessageDelegate = self;\n #endif\n }\n\n [[UIApplication sharedApplication] registerForRemoteNotifications];\n return YES;\n} \n\n//start implementing notification reciver :\n\n\n//// [START receive_message]\n- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {\n // If you are receiving a notification message while your app is in the background,\n // this callback will not be fired till the user taps on the notification launching the application.\n // TODO: Handle data of notification\n\n // Print message ID.\n if (userInfo[kGCMMessageIDKey]) {\n NSLog(@\"Message ID: %@\", userInfo[kGCMMessageIDKey]);\n }\n\n // Print full message.\n NSLog(@\"%@\", userInfo);\n}\n\n- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo\nfetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {\n // If you are receiving a notification message while your app is in the background,\n // this callback will not be fired till the user taps on the notification launching the application.\n // TODO: Handle data of notification\n\n // Print message ID.\n if (userInfo[kGCMMessageIDKey]) {\n NSLog(@\"Message ID: %@\", userInfo[kGCMMessageIDKey]);\n }\n\n\n // Print full message.\n NSLog(@\"%@\", userInfo);\n\n completionHandler(UIBackgroundFetchResultNewData);\n}\n// [END receive_message]\n\n// [START ios_10_message_handling]\n// Receive displayed notifications for iOS 10 devices.\n#if defined(__IPHONE_10_0) \u0026amp;\u0026amp; __IPHONE_OS_VERSION_MAX_ALLOWED \u0026gt;= __IPHONE_10_0\n// Handle incoming notification messages while app is in the foreground.\n- (void)userNotificationCenter:(UNUserNotificationCenter *)center\n willPresentNotification:(UNNotification *)notification\n withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler {\n // Print message ID.\n NSDictionary *userInfo = notification.request.content.userInfo;\n if (userInfo[kGCMMessageIDKey]) {\n NSLog(@\"Message ID: %@\", userInfo[kGCMMessageIDKey]);\n }\n\n // Print full message.\n NSLog(@\"%@\", userInfo);\n\n // Change this to your preferred presentation option\n completionHandler(UNNotificationPresentationOptionNone);\n}\n\n// Handle notification messages after display notification is tapped by the user.\n- (void)userNotificationCenter:(UNUserNotificationCenter *)center\ndidReceiveNotificationResponse:(UNNotificationResponse *)response\n withCompletionHandler:(void (^)())completionHandler {\n NSDictionary *userInfo = response.notification.request.content.userInfo;\n if (userInfo[kGCMMessageIDKey]) {\n NSLog(@\"Message ID: %@\", userInfo[kGCMMessageIDKey]);\n }\n\n // Print full message.\n NSLog(@\"%@\", userInfo);\n\n completionHandler();\n}\n#endif\n// [END ios_10_message_handling]\n\n// [START ios_10_data_message_handling]\n#if defined(__IPHONE_10_0) \u0026amp;\u0026amp; __IPHONE_OS_VERSION_MAX_ALLOWED \u0026gt;= __IPHONE_10_0\n// Receive data message on iOS 10 devices while app is in the foreground.\n- (void)applicationReceivedRemoteMessage:(FIRMessagingRemoteMessage *)remoteMessage {\n // Print full message\n NSLog(@\"%@\", remoteMessage.appData);\n}\n#endif\n// [END ios_10_data_message_handling]\n\n// [START refresh_token]\n- (void)tokenRefreshNotification:(NSNotification *)notification {\n // Note that this callback will be fired everytime a new token is generated, including the first\n // time. So if you need to retrieve the token as soon as it is available this is where that\n // should be done.\n NSString *refreshedToken = [[FIRInstanceID instanceID] token];\n NSLog(@\"InstanceID token: %@\", refreshedToken);\n\n // Connect to FCM since connection may have failed when attempted before having a token.\n [self connectToFcm];\n\n // TODO: If necessary send token to application server.\n}\n// [END refresh_token]\n\n// [START connect_to_fcm]\n- (void)connectToFcm {\n// // Won't connect since there is no token\n// if (![[FIRInstanceID instanceID] token]) {\n// return;\n// }\n\n // Disconnect previous FCM connection if it exists.\n [[FIRMessaging messaging] disconnect];\n\n [[FIRMessaging messaging] connectWithCompletion:^(NSError * _Nullable error) {\n if (error != nil) {\n NSLog(@\"Unable to connect to FCM. %@\", error);\n } else {\n NSLog(@\"Connected to FCM.\");\n NSString *refreshedToken = [[FIRInstanceID instanceID] token];\n NSLog(@\"InstanceID token: %@\", refreshedToken);\n }\n }];\n}\n// [END connect_to_fcm]\n\n- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error {\n NSLog(@\"Unable to register for remote notifications: %@\", error);\n}\n\n// This function is added here only for debugging purposes, and can be removed if swizzling is enabled.\n// If swizzling is disabled then this function must be implemented so that the APNs token can be paired to\n// the InstanceID token.\n- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {\n NSLog(@\"APNs token retrieved: %@\", deviceToken);\n\n // With swizzling disabled you must set the APNs token here.\n [[FIRInstanceID instanceID] setAPNSToken:deviceToken type:FIRInstanceIDAPNSTokenTypeSandbox];\n [self connectToFcm];\n}\n\n// [START connect_on_active]\n- (void)applicationDidBecomeActive:(UIApplication *)application {\n [self connectToFcm];\n}\n// [END connect_on_active]\n\n// [START disconnect_from_fcm]\n- (void)applicationDidEnterBackground:(UIApplication *)application {\n [[FIRMessaging messaging] disconnect];\n NSLog(@\"Disconnected from FCM\");\n}\n// [END disconnect_from_fcm]\n\n\n//end of implement notification.\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"0","comment_count":"2","creation_date":"2017-04-12 12:25:12.407 UTC","last_activity_date":"2017-04-12 13:17:36.36 UTC","last_edit_date":"2017-04-12 13:17:36.36 UTC","last_editor_display_name":"","last_editor_user_id":"5720725","owner_display_name":"","owner_user_id":"5720725","post_type_id":"1","score":"0","tags":"ios|objective-c|null","view_count":"172"} {"id":"10425814","title":"Error in .Net Web Service running on IIS 6","body":"\u003cp\u003eI am trying to run a web service build in .Net on IIS 6 server.\nBut it is giving an Error while starting Web Service\u003c/p\u003e\n\n\u003cblockquote\u003e\n \u003cp\u003e\u003cstrong\u003eERROR\u003c/strong\u003e\u003c/p\u003e\n \n \u003cp\u003e\u003cstrong\u003eServer Error in ' /9448' Application\u003c/strong\u003e\u003c/p\u003e\n \n \u003cp\u003e\u003cem\u003e\u003cstrong\u003eConfiguration Error\u003c/em\u003e\u003c/strong\u003e\u003c/p\u003e\n \n \u003cp\u003e\u003cstrong\u003eDescription\u003c/strong\u003e : \"An error occurred during the processing of configuration file required to service this request.Please review the\n specific details below and modify your configuration file\n appropriately.\u003c/p\u003e\n \n \u003cp\u003e\u003cstrong\u003eParse Error Message\u003c/strong\u003e :An error occurred loading the configuration file: Access to the path\n \"C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\Config\\machine.config\"\n is denied.\u003c/p\u003e\n \n \u003cp\u003e\u003cstrong\u003eSource Error\u003c/strong\u003e:\u003c/p\u003e\n \n \u003cp\u003e[No relevant source lines]\u003c/p\u003e\n \n \u003cp\u003e\u003cstrong\u003eSource File\u003c/strong\u003e : C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\Config\\machine.config\n \u003cstrong\u003eLine: 0\u003c/strong\u003e\u003c/p\u003e\n \n \u003cp\u003e\u003cstrong\u003eVersion Information\u003c/strong\u003e : Microsoft.NET Framework Version v2.0.50727.3625; ASP.Net Version : v2.0.50727.3625\u003c/p\u003e\n\u003c/blockquote\u003e\n\n\u003cp\u003eThe user under which it is running have full Administrator Rights\u003c/p\u003e\n\n\u003cp\u003eWhile it was working fine previously\u003c/p\u003e\n\n\u003cp\u003eWhat could be the problem?\u003c/p\u003e","answer_count":"0","comment_count":"2","creation_date":"2012-05-03 05:51:03.713 UTC","last_activity_date":"2012-05-03 05:55:12.607 UTC","last_edit_date":"2012-05-03 05:55:12.607 UTC","last_editor_display_name":"","last_editor_user_id":"107625","owner_display_name":"","owner_user_id":"1049382","post_type_id":"1","score":"1","tags":"asp.net|web-services|iis-6","view_count":"432"} {"id":"18615342","title":"Google DirectoryAPI adding wrong email","body":"\u003cp\u003eGoogle's Directory API incorrectly adding the personal gmail address to a google group when I use the api to insert a non-gmail address. This only happens for a subset of addresses for several domains @indiana.edu, @arizona.edu... (I assume it is connected to the organizations own use of GoogleApps). \u003c/p\u003e\n\n\u003cp\u003eI can reproduce the issue using the \u003ca href=\"https://developers.google.com/apis-explorer/#p/admin/directory_v1/\" rel=\"nofollow\"\u003eGoogle-Api-Explorer\u003c/a\u003e, without any code, but I noticed the issue using google-api-php-client.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e$gData = $this-\u0026gt;service-\u0026gt;members-\u0026gt;insert($groupEmail,$gMember);\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI have filed a ticket with Google. Has anyone encountered this issue, or can you shed light into how a personal gmail account is linked to an @organizatio.edu account in GoogleApps.\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2013-09-04 13:34:10.057 UTC","favorite_count":"0","last_activity_date":"2013-10-11 14:44:31.507 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"486494","post_type_id":"1","score":"0","tags":"php|google-api|google-api-php-client","view_count":"57"} {"id":"9747767","title":"Mapping any OS's global input events to another input events with Java","body":"\u003cp\u003eI couldn't come up with a better title, so allow me to elaborate:\u003c/p\u003e\n\n\u003cp\u003eThere are programs such as \u003ca href=\"http://www-en.jtksoft.net/overview\" rel=\"nofollow\"\u003eJoyToKey\u003c/a\u003e, that allowed the user to map button inputs on any joystick to any key event and mouse event. To be frank, I do not know the real underlying implementation here, but it is like either JoyToKey \"ubiquitously\" sends these mapped inputs to whatever application the user is focusing, or it simply invokes global input events.\u003c/p\u003e\n\n\u003cp\u003eSo the thing is this, in Java application, if we want to listen to any keyboard or mouse input, we can easily to do that with the \u003ccode\u003eKeyListener\u003c/code\u003e and \u003ccode\u003eMouseListener\u003c/code\u003e classes, but what I am talking here is if I want to create a Java application that listens to all of the user's specified inputs, (be it from joystick, touch screen, or whatever) regardless of which application has focus at the time and map these inputs to other inputs and macro. For instance, if I want to perform Hadoken in Street Fighter, I tell the program \"hey, if I press 'P' or 'Joystick 1 Button 10', invoke the following keyboard events respectively 'down arrow' in the first (1/60) millisecond, 'down+right arrow' in the next (1/60) millisecond, 'right arrow' in the next (1/60) millisecond and finally 'Z' in the next (1/60) millisecond\".\u003c/p\u003e\n\n\u003cp\u003eSo what I am looking for here is different from JoyToKey in the following aspect:\u003c/p\u003e\n\n\u003col\u003e\n\u003cli\u003eI am looking for how to write a JoyToKey-like program in \u003cstrong\u003eJava\u003c/strong\u003e.\u003c/li\u003e\n\u003cli\u003enot limited to Joystick only. Allows user to map all sort of hardware inputs to any other hardware input as well.\u003c/li\u003e\n\u003c/ol\u003e\n\n\u003cp\u003eDue to the nature of Java and we are invoking the OS directly, I am concern about the cross-platform capability. The underlying mechanism of each OS might be a little different, but anyway, is this possible in Java? If so, which Java's API should I be looking for? Are there some hardware-specific problems to be aware of?\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2012-03-17 06:15:46.997 UTC","last_activity_date":"2012-03-17 16:17:00.247 UTC","last_edit_date":"2012-03-17 16:16:45.88 UTC","last_editor_display_name":"","last_editor_user_id":"20394","owner_display_name":"","owner_user_id":"144201","post_type_id":"1","score":"2","tags":"java|input|operating-system|mapping|hardware","view_count":"160"} @@ -903,7 +903,7 @@ {"id":"12690169","title":"mciSendString randomly stops working","body":"\u003cp\u003eMy code\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e char MusicLoc [50][200];\n char Music [50][50];\n int MusicBox(int IndexMusic)\n {\n std::string rawloc = ((std::string)\"open \\\"\"+MusicLoc[IndexMusic]+Music[IndexMusic]+\"\\\"type mpegvideo alias \"+Music[IndexMusic]);`\n mciSendString(rawloc.c_str(), NULL, 0, 0); \n mciSendString(((std::string)\"play \"+Music[IndexMusic]).c_str(), NULL, 0, 0);\n return 0;\n }\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eMusicLoc contains the path and Music contains the filename, so MusicLoc[1]+Music[1] would be C:\\etc\\etc\\etc\\audio.mp3 , it worked fine at first but then it randomly stopped working , I have tried everything and it doesn't work so I am gonna guess using mciSendString isn't recomended, so does anyone knows about a good and lightweight audio library?\u003c/p\u003e\n\n\u003cp\u003eEdit:\nThe first mciSendString returns 266, and the second one return 275, if its of any use, but I really haven't found good documentation about them.\u003c/p\u003e\n\n\u003cp\u003eAlso GetLastError says there is no error...\u003c/p\u003e","answer_count":"1","comment_count":"3","creation_date":"2012-10-02 12:23:17.087 UTC","last_activity_date":"2012-10-02 16:07:50.09 UTC","last_edit_date":"2012-10-02 12:34:54.463 UTC","last_editor_display_name":"","last_editor_user_id":"1621086","owner_display_name":"","owner_user_id":"1621086","post_type_id":"1","score":"0","tags":"c++|audio|mcisendstring","view_count":"331"} {"id":"20593907","title":"[Microsoft][SQL Server Native Client 11.0][SQL Server]Invalid object name","body":"\u003cp\u003eI want to access the MS SQL Server and have the select query. I have installed the dll files and am using the \u003ccode\u003esqlsrv_query\u003c/code\u003e. The connection has been successful but I get:\u003c/p\u003e\n\n\u003cblockquote\u003e\n \u003cp\u003e[Microsoft][SQL Server Native Client 11.0][SQL Server]Invalid object\n name as error\u003c/p\u003e\n\u003c/blockquote\u003e\n\n\u003cp\u003eI am using PHP version 5.3.1\u003c/p\u003e\n\n\u003cp\u003eAfter the connection I have this code\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e$sql = \"SELECT id, latitude, longitude from job \";\n$stmt = sqlsrv_query( $conn, $sql );\nif( $stmt === false) {\n die( print_r( sqlsrv_errors(), true) );\n}\n\nwhile( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_ASSOC) ) {\n echo $row['latitude'].\", \".$row['longitude'].\"\u0026lt;br /\u0026gt;\";\n}\nsqlsrv_free_stmt( $stmt);\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"2","comment_count":"0","creation_date":"2013-12-15 11:20:43.897 UTC","favorite_count":"1","last_activity_date":"2016-03-18 12:15:27.29 UTC","last_edit_date":"2016-03-18 12:15:27.29 UTC","last_editor_display_name":"","last_editor_user_id":"2893376","owner_display_name":"","owner_user_id":"2709622","post_type_id":"1","score":"5","tags":"php|sql-server|sqlsrv","view_count":"983"} {"id":"25580975","title":"How to programmatically post like and comment an URL on facebook?","body":"\u003cp\u003eThis is confusing. So just to clarify:\u003c/p\u003e\n\n\u003cp\u003eREQ #1: To fetch basic stats for a URL, you send GET request to:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ehttp://graph.facebook.com/?ids=http://some.com\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e(alternatively, FQL can be used to fetch stats for a URL, but that doesn't return the OpenGraph Object)\u003c/p\u003e\n\n\u003cp\u003eREQ #2: To fetch comments for a URL, you do a GET:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ehttp://graph.facebook.com/comments/?ids=http://some.com\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eREQ #3: To fetch likes for a URL, you GET:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ehttp://graph.facebook.com/likes/?ids=http://some.com\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eBut how do you comment on / like a URL programmatically?\u003c/p\u003e\n\n\u003cp\u003eI guess, likes can be created using Open Graph API, right? \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ehttps://graph.facebook.com/me/og.likes?object=1234\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ewhere 1234 is the OpenGraph Object ID of an article (as returned by REQ #1).\nBut this requires an approval process, the like action has to be approved by Facebook.\u003c/p\u003e\n\n\u003cp\u003eIs there a better way to do this? Can I use for example the Graph API for all these things?\u003c/p\u003e\n\n\u003cp\u003eMy goal:\u003c/p\u003e\n\n\u003cp\u003eCurrently I'm using the Facebook like button and comments plugin to create likes and comments. But these use the JS SDK, which is huge, and they generate a lot of external requests. I wanna get rid of them and just send an AJAX request to my server, which would then asynchronously talk to Facebook, and it would post the Like / Comment.\u003c/p\u003e\n\n\u003cp\u003eIs this possible?\u003c/p\u003e\n\n\u003cp\u003eThanks in advance!\u003c/p\u003e","answer_count":"3","comment_count":"0","creation_date":"2014-08-30 09:35:10.287 UTC","last_activity_date":"2014-08-30 11:35:02.96 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"2297996","post_type_id":"1","score":"0","tags":"facebook-graph-api|facebook-like|facebook-comments","view_count":"1077"} -{"id":"41690120","title":"I am getting below error while using ui-grid in angular js","body":"\u003cp\u003e\u003cdiv class=\"snippet\" data-lang=\"js\" data-hide=\"false\" data-console=\"true\" data-babel=\"false\"\u003e\r\n\u003cdiv class=\"snippet-code\"\u003e\r\n\u003cpre class=\"snippet-code-js lang-js prettyprint-override\"\u003e\u003ccode\u003evar app = angular.module(\"finApp\", [\"ui.grid\"]);\r\napp.controller(\r\n \"finController\",\r\n function($scope, $http) {\r\n $http.get(\"url\", \"data\")\r\n .then(function(response) {\r\n $scope.gridOptions.data = response.data;\r\n\r\n }, function(errorResponse) {});\r\n });\u003c/code\u003e\u003c/pre\u003e\r\n\u003cpre class=\"snippet-code-html lang-html prettyprint-override\"\u003e\u003ccode\u003e\u0026lt;link href=\"https://cdn.rawgit.com/angular-ui/bower-ui-grid/master/ui-grid.min.css\" rel=\"stylesheet\"/\u0026gt;\r\n\u0026lt;script src=\"https://cdn.rawgit.com/angular-ui/bower-ui-grid/master/ui-grid.min.js\"\u0026gt;\u0026lt;/script\u0026gt;\r\n\u0026lt;script src=\"https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js\"\u0026gt;\u0026lt;/script\u0026gt;\r\n\u0026lt;div ui-grid=\"gridOptions\" class=\"grid\"\u0026gt;\u0026lt;/div\u0026gt;\u003c/code\u003e\u003c/pre\u003e\r\n\u003c/div\u003e\r\n\u003c/div\u003e\r\n\u003c/p\u003e\n\n\u003cp\u003eWhile executing above code I am getting below error:\u003c/p\u003e\n\n\u003cblockquote\u003e\n \u003cp\u003eangular.min.js:122 TypeError: Cannot read property 'data' of undefined\u003cbr\u003e\n at new (ui-grid.js:3330)\u003cbr\u003e\n at Object.invoke (angular.min.js:43)\u003cbr\u003e\n at Q.instance (angular.min.js:93) \u003c/p\u003e\n\u003c/blockquote\u003e","accepted_answer_id":"41690175","answer_count":"3","comment_count":"2","creation_date":"2017-01-17 06:11:05.577 UTC","last_activity_date":"2017-01-19 20:30:36.76 UTC","last_edit_date":"2017-01-19 20:30:36.76 UTC","last_editor_display_name":"","last_editor_user_id":"383819","owner_display_name":"","owner_user_id":"7414015","post_type_id":"1","score":"0","tags":"angularjs","view_count":"43"} +{"id":"41690120","title":"I am getting below error while using ui-grid in angular js","body":"\u003cp\u003e\u003cdiv class=\"snippet\" data-lang=\"js\" data-hide=\"false\" data-console=\"true\" data-babel=\"false\"\u003e\r\n\u003cdiv class=\"snippet-code\"\u003e\r\n\u003cpre class=\"snippet-code-js lang-js prettyprint-override\"\u003e\u003ccode\u003evar app = angular.module(\"finApp\", [\"ui.grid\"]);\r\napp.controller(\r\n \"finController\",\r\n function($scope, $http) {\r\n $http.get(\"url\", \"data\")\r\n .then(function(response) {\r\n $scope.gridOptions.data = response.data;\r\n\r\n }, function(errorResponse) {});\r\n });\u003c/code\u003e\u003c/pre\u003e\r\n\u003cpre class=\"snippet-code-html lang-html prettyprint-override\"\u003e\u003ccode\u003e\u0026lt;link href=\"https://cdn.rawgit.com/angular-ui/bower-ui-grid/main/ui-grid.min.css\" rel=\"stylesheet\"/\u0026gt;\r\n\u0026lt;script src=\"https://cdn.rawgit.com/angular-ui/bower-ui-grid/main/ui-grid.min.js\"\u0026gt;\u0026lt;/script\u0026gt;\r\n\u0026lt;script src=\"https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js\"\u0026gt;\u0026lt;/script\u0026gt;\r\n\u0026lt;div ui-grid=\"gridOptions\" class=\"grid\"\u0026gt;\u0026lt;/div\u0026gt;\u003c/code\u003e\u003c/pre\u003e\r\n\u003c/div\u003e\r\n\u003c/div\u003e\r\n\u003c/p\u003e\n\n\u003cp\u003eWhile executing above code I am getting below error:\u003c/p\u003e\n\n\u003cblockquote\u003e\n \u003cp\u003eangular.min.js:122 TypeError: Cannot read property 'data' of undefined\u003cbr\u003e\n at new (ui-grid.js:3330)\u003cbr\u003e\n at Object.invoke (angular.min.js:43)\u003cbr\u003e\n at Q.instance (angular.min.js:93) \u003c/p\u003e\n\u003c/blockquote\u003e","accepted_answer_id":"41690175","answer_count":"3","comment_count":"2","creation_date":"2017-01-17 06:11:05.577 UTC","last_activity_date":"2017-01-19 20:30:36.76 UTC","last_edit_date":"2017-01-19 20:30:36.76 UTC","last_editor_display_name":"","last_editor_user_id":"383819","owner_display_name":"","owner_user_id":"7414015","post_type_id":"1","score":"0","tags":"angularjs","view_count":"43"} {"id":"27028184","title":"How to close JOptionPane","body":"\u003cp\u003eI have a JoptionPane like below. However, when I select a value and hit 'OK' it does return the value, but the frame still remains as is. Only after 'cancel' or 'X' mark on the top, it closes. How to fix this.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e JOptionPane.showInputDialog(\n null,\n \"Select the user\",\n \"Users\",\n JOptionPane.INFORMATION_MESSAGE,\n null,\n userNames,\n userNames[0]);\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"0","comment_count":"2","creation_date":"2014-11-19 22:21:39.387 UTC","last_activity_date":"2014-11-20 15:24:12.303 UTC","last_edit_date":"2014-11-20 15:24:12.303 UTC","last_editor_display_name":"","last_editor_user_id":"2894369","owner_display_name":"","owner_user_id":"2945142","post_type_id":"1","score":"0","tags":"java|swing|joptionpane","view_count":"111"} {"id":"29624524","title":"How can I print/log the checksum calculated by rsync?","body":"\u003cp\u003eI have to transfer millons of files of very different size summing up almost 100 TB between two Linux servers. It's easy to do it the first time with rsync, and quite safe, because data can be checksum'ed.\u003c/p\u003e\n\n\u003cp\u003eHowever, I need to keep a list of files and their checksum to do some checks regularly in the future.\u003c/p\u003e\n\n\u003cp\u003eIs there a way to tell rsync to print/log the checksum of the file?\nAnd in case this is not feasible: Which tool/command would you recommend considering that performance is very important?\u003c/p\u003e\n\n\u003cp\u003eThanks in advance!\u003c/p\u003e","accepted_answer_id":"45053057","answer_count":"1","comment_count":"2","creation_date":"2015-04-14 10:05:06.833 UTC","last_activity_date":"2017-07-12 08:59:20.057 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"2705572","post_type_id":"1","score":"1","tags":"linux|md5|rsync|checksum","view_count":"404"} {"id":"29612289","title":"C program crashes. My guess incorrect usage of arrays","body":"\u003cp\u003eTrying to make a program in C that solves N sized triangular board with M queens problem. Can't even get it to work. My guess it crashes because I use arrays incorrectly. Could you please explain to me what I am doing wrong here? \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e#include \u0026lt;stdlib.h\u0026gt;\n#include \u0026lt;stdio.h\u0026gt;\n\nint checkPlaceability(int n, int (*board)[n], int row, int col);\nint placeQueens(int n, int m, int (*board)[n], int col);\n\nvoid main()\n{\n int n;\n int board[n][n];\n int m;\n\n printf(\"Enter board size: \\n\");\n scanf(\"%d\", \u0026amp;n);\n printf(\"Enter queen count: \\n\");\n scanf(\"%d\", \u0026amp;m);\n\n if(placeQueens(n, m, board, 0) == 0)\n {\n printf(\"Solution doesn't exist\");\n }\n else\n {\n printf(\"Solution exists\");\n }\n}\n\ncheckPlaceability(int n, int (*board)[n], int row, int col)\n{\n int i;\n int j;\n for(i = col; i \u0026lt; i++)\n {\n if(board[i][col] == 1)\n {\n return 0;\n }\n }\n for(i = 0; i \u0026lt; n; i++)\n {\n if(board[row][i] == 1)\n {\n return 0;\n }\n }\n for(i = abs(row - col)+1, j = 0; i \u0026lt; j \u0026amp;\u0026amp; j \u0026lt; n; i++, j++)\n {\n if(board[i][j] == 1)\n {\n return 0;\n }\n }\n return 1;\n}\n\nint placeQueens(int n, int m, int (*board)[n], int col)\n{\n int i;\n int queenCount = m;\n if(col \u0026gt;= n)\n {\n return 1;\n }\n for(i = 0; i \u0026lt; m; i++)\n {\n if(checkPlaceability(n, board, i, col) == 1)\n {\n board[i][col] = 1;\n queenCount--;\n if(queenCount == 0)\n {\n return 1;\n }\n if(placeQueens(n, queenCount, board, col+1) == 1)\n {\n return 1;\n }\n board[i][col] = 0;\n }\n }\n return 0;\n}\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"29612337","answer_count":"1","comment_count":"3","creation_date":"2015-04-13 18:18:07.207 UTC","last_activity_date":"2015-04-13 18:20:45.173 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"4324949","post_type_id":"1","score":"1","tags":"c|arrays|pointers","view_count":"74"} @@ -1037,7 +1037,7 @@ {"id":"34559033","title":"JAX-RS Struts2 REST API","body":"\u003cp\u003eWhy would one like to integrate JAX-RS(Jersey) using Rest API to Struts2? Struts2 is itself a mvc framework, so why would anyone want to integrate these both? If combined, how will the resulting framework be(I wanted to know if REST API just control the controller part of MVC). \u003c/p\u003e","accepted_answer_id":"34561468","answer_count":"2","comment_count":"0","creation_date":"2016-01-01 18:56:09.663 UTC","last_activity_date":"2016-01-04 09:19:19.817 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"5405907","post_type_id":"1","score":"1","tags":"rest|struts2|jersey|jax-rs|struts","view_count":"520"} {"id":"11846144","title":"hibernate not able to reconnect to the mysql DB","body":"\u003cp\u003eIn my spring-hibernate application, we are using \u003ccode\u003eorg.apache.tomcat.jdbc.pool.DataSource\u003c/code\u003e for connection pooling. When we start the server, we are able to see the connection to the DB is established and after the mysql service is stopped the server starts throwing error saying that the connection is lost. When the mysql service is started again, should we have to restart the server to reestablish the connections to the DB? Cuz even after providing autoReconnect=true parameter, the application is not able to establish connection to the DB.\u003c/p\u003e","accepted_answer_id":"12884474","answer_count":"2","comment_count":"1","creation_date":"2012-08-07 12:35:54.44 UTC","last_activity_date":"2012-10-28 19:31:02.58 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"934913","post_type_id":"1","score":"2","tags":"java|mysql|spring|hibernate|java-ee","view_count":"754"} {"id":"16872866","title":"Rest api for yii","body":"\u003cp\u003eI am trying implement REST api in yii by official example, and now I got lot of errors instead of response \u003ca href=\"http://www.taxitaxi.kz/dispatcher/index.php/api/drivers\" rel=\"nofollow\"\u003ehttp://www.taxitaxi.kz/dispatcher/index.php/api/drivers\u003c/a\u003e.\u003c/p\u003e\n\n\u003cp\u003eCan someone clearify me what is the issue?\u003c/p\u003e","accepted_answer_id":"16877145","answer_count":"1","comment_count":"4","creation_date":"2013-06-01 12:46:34.543 UTC","last_activity_date":"2013-08-22 01:05:29.6 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"2440685","post_type_id":"1","score":"1","tags":"rest|yii","view_count":"3581"} -{"id":"35856290","title":"Do I need to make any special flask-sslify settings for HTTP Strict Transport?","body":"\u003cp\u003eI am using Flask as my web/app server. I am attempting to SSLify my Flask app to have the best security for HSTS. From some other Stackoverflow comments, I see it is probably best to set SSLify(app, permanent=True) to give 301 response. Do I need to set an age limit, or make any other non-default setting? I am assuming my response header is set with SSLify, or do I need to add the Strict-Transport-Security: max-age, etc to the response header, or does SSLify do this for my Flask App. \u003c/p\u003e\n\n\u003cp\u003eRef:\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"https://github.com/kennethreitz/flask-sslify/blob/master/README.rst\" rel=\"nofollow\"\u003ehttps://github.com/kennethreitz/flask-sslify/blob/master/README.rst\u003c/a\u003e\u003c/p\u003e","answer_count":"1","comment_count":"1","creation_date":"2016-03-07 23:36:54.107 UTC","last_activity_date":"2016-03-08 19:45:09.74 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1480918","post_type_id":"1","score":"0","tags":"python-2.7|heroku|flask|hsts","view_count":"240"} +{"id":"35856290","title":"Do I need to make any special flask-sslify settings for HTTP Strict Transport?","body":"\u003cp\u003eI am using Flask as my web/app server. I am attempting to SSLify my Flask app to have the best security for HSTS. From some other Stackoverflow comments, I see it is probably best to set SSLify(app, permanent=True) to give 301 response. Do I need to set an age limit, or make any other non-default setting? I am assuming my response header is set with SSLify, or do I need to add the Strict-Transport-Security: max-age, etc to the response header, or does SSLify do this for my Flask App. \u003c/p\u003e\n\n\u003cp\u003eRef:\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"https://github.com/kennethreitz/flask-sslify/blob/main/README.rst\" rel=\"nofollow\"\u003ehttps://github.com/kennethreitz/flask-sslify/blob/main/README.rst\u003c/a\u003e\u003c/p\u003e","answer_count":"1","comment_count":"1","creation_date":"2016-03-07 23:36:54.107 UTC","last_activity_date":"2016-03-08 19:45:09.74 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1480918","post_type_id":"1","score":"0","tags":"python-2.7|heroku|flask|hsts","view_count":"240"} {"id":"41017590","title":"tkinter frame display basics","body":"\u003cp\u003eI am trying to create an application (well my very first) in Python/tkinter which ultimatively should run on a Raspberry Pi with a a small touchscreen display (480x320px) attached to it. The screen is divided into a mainframe and a frame which (later on) will contain 6 function keys (buttons)\u003c/p\u003e\n\n\u003cp\u003eSo I started with below code, hoping/expecting that somehow I will get the main application window divided into two frames, one being grey, one being black ... but all I see (on my PC) is the MainApp window in correct size, not resizeable, with correct title (so far so good!) and a yellow background ... it seems the frames I defined inside MainApp are not displayed, even thoough there are Labels inside, they are sticky, they have a weight (and I can't remember what else I tried and where else I searched)\u003c/p\u003e\n\n\u003cp\u003eWhat am I overlooking here please?\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e#!/usr/bin/python3\nimport tkinter as tk\n#\n# main application\n#\nclass MainApp(tk.Frame):\n def __init__(self, parent):\n tk.Frame.__init__(self, parent)\n self.parent = parent\n self.parent.title(\"My first GUI\")\n self.parent.geometry(\"480x320\")\n self.parent.resizable(width=False, height=False)\n self.parent.config(bg=\"yellow\")\n\n mainframe = tk.Frame(self, bg=\"grey\", width=480, height=280 )\n mainframe.grid(column=0, row=0, sticky=\"WENS\")\n tk.Label(mainframe, text=\"co-cooo\").grid(column=0, row=0, sticky=\"WENS\")\n\n fkeyframe = tk.Frame(self, bg=\"black\", width=480, height=40)\n fkeyframe.grid(column=0, row=1, sticky=\"WENS\")\n tk.Label(fkeyframe, text=\"fo-fooo\").grid(column=0, row=0, sticky=\"WENS\")\n\n self.rowconfigure(0, weight=1, minsize=280)\n self.rowconfigure(1, weight=1, minsize=40)\n#\n# define root element and start application\n#\ndef main():\n root = tk.Tk()\n app = MainApp(root)\n root.mainloop() \n\n#\n# start if called from command line\n#\nif __name__ == '__main__':\n main()\n\n# 0,0 MainApp (yellow) 480,0\n# +---------------------------------+\n# | mainframe (grey, h=280) |\n# |+-------------------------------+|\n# || ||\n# || ||\n# || ||\n# |+-------------------------------+|\n# | fkeyframe (black, h=40) |\n# |+-------------------------------+|\n# ||+----+----+----+----+----+----+||\n# ||| Bt | Bt | Bt | Bt | Bt | Bt |||\n# ||+----+----+----+----+----+----+||\n# |+-------------------------------+|\n# +---------------------------------+\n# 320,0 320,480\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"41017682","answer_count":"2","comment_count":"0","creation_date":"2016-12-07 12:32:43.75 UTC","favorite_count":"1","last_activity_date":"2016-12-07 13:39:48.903 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"185547","post_type_id":"1","score":"1","tags":"python|tkinter","view_count":"183"} {"id":"38089178","title":"Is it possible to attach to a remote gdb target with vscode?","body":"\u003cp\u003eI'm trying to setup the configuration to attach to a remote C/C++ gdb target running gdbserver with visual studio code. Is this currently supported? If so, how do I get around these limitations:\u003c/p\u003e\n\n\u003col\u003e\n\u003cli\u003e\u003cp\u003eThe address and port options indicate that they aren't supported for C/C++.\u003c/p\u003e\u003c/li\u003e\n\u003cli\u003e\u003cp\u003eI can force code to use the special remote enabled version of gdb, but its trying to run the target application locally and not connecting to the target gdbserver platform.\u003c/p\u003e\u003c/li\u003e\n\u003cli\u003e\u003cp\u003eWill PowerPC remote targets be supported assuming I can solve #1 and #2?\u003c/p\u003e\u003c/li\u003e\n\u003c/ol\u003e","answer_count":"0","comment_count":"0","creation_date":"2016-06-29 02:08:04.6 UTC","last_activity_date":"2016-06-29 02:08:04.6 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"6526126","post_type_id":"1","score":"2","tags":"gdb|visual-studio-code","view_count":"366"} {"id":"15601598","title":"how to insert and replace a list of words in another list or a string in python","body":"\u003cp\u003eI am trying to replace a string with the word \u003ccode\u003e[NOUN]\u003c/code\u003e on it. I'm clueless!\u003c/p\u003e\n\n\u003cp\u003eHere's my code below - which returns lots of errors - the variable story is a string and listOfNouns is a list - so I try and convert the string into a list by splitting it.:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003edef replacement(story, listOfNouns): \n length = len(story1)\n story1 = story.split()\n for c in range(0,len(story1)):\n if c in listOfNouns:\n story1[c]= 'NOUN'\n story = ''.join(story) \n return story\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHere's the error message that I get below when I call the above function with\u003cbr\u003e\n\u003ccode\u003ereplacement(\"Let's play marbles\", ['marbles'])\u003c/code\u003e:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eTraceback (most recent call last):\n File \"\u0026lt;pyshell#189\u0026gt;\", line 1, in \u0026lt;module\u0026gt;\n replacement(\"Let's play marbels\", ['marbels'])\n File \"C:/ProblemSet4/exam.py\", line 3, in replacement\n length = len(story1)\nUnboundLocalError: local variable 'story1' referenced before assignment\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHow can I replace the new story1 list with another element from another list?\u003c/p\u003e\n\n\u003cp\u003eHow do I modify the tuples and return the new string - which is supposed to say:\u003cbr\u003e\n\u003ccode\u003eLet's play [NOUN]\u003c/code\u003e???\u003c/p\u003e\n\n\u003cp\u003eCan anyone please help out? I'm lost and i've been trying this for hours using all the knowledge I have in Python/Java to figure this crap out!\u003c/p\u003e","answer_count":"3","comment_count":"0","creation_date":"2013-03-24 17:23:27.777 UTC","last_activity_date":"2013-03-24 21:05:26.493 UTC","last_edit_date":"2013-03-24 17:43:45.747 UTC","last_editor_display_name":"","last_editor_user_id":"235698","owner_display_name":"","owner_user_id":"2150603","post_type_id":"1","score":"0","tags":"python|string|list|split|replace","view_count":"487"} @@ -1106,7 +1106,7 @@ {"id":"45116587","title":"Create 2D array with the same size as another array and initialize with zero in python","body":"\u003cp\u003eI have a 2D array in python, like the following:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e2d_array_1 =[[0,1],[1,0]]\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAnd want to create a second array of the same size, with all values initialized to zero.\u003c/p\u003e\n\n\u003cp\u003eHow can I do that in python, if the size of the initial array can vary?\u003c/p\u003e","accepted_answer_id":"45116669","answer_count":"1","comment_count":"2","creation_date":"2017-07-15 09:21:43.227 UTC","last_activity_date":"2017-07-15 09:31:44.563 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1934212","post_type_id":"1","score":"-1","tags":"python|arrays","view_count":"51"} {"id":"4850909","title":"Qt designer - how to create QDialog?","body":"\u003cp\u003eIt is possibility to create QDialog in Qt-creator like for example QForm (by clicking)? I've found several samples, but QDialog is created programmatically.\nI want to drag and drop buttons, listview and others components on QDialog.\nNow I can add new components only by modifying code.\u003c/p\u003e\n\n\u003cp\u003eThanks \u003c/p\u003e","answer_count":"2","comment_count":"0","creation_date":"2011-01-31 12:34:48.817 UTC","favorite_count":"1","last_activity_date":"2011-02-04 16:08:13.043 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"569987","post_type_id":"1","score":"7","tags":"qt-creator|qdialog","view_count":"3518"} {"id":"14557558","title":"ios objective -c variables","body":"\u003cp\u003eThe following sample program, when using the variable working. When using more variables, the program mixed. Can you solve it without a variable?\nThe sample code ;\u003c/p\u003e\n\n\u003cp\u003etableView - didSelectRowAtIndexPath\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eint indexpath_row = 0;\nUITableView *table1;\n\n- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{\n\n if (tableView == self.searchDisplayController.searchResultsTableView) {\n indexpath_row = indexPath.row + 5;\n table1 = self.searchDisplayController.searchResultsTableView;\n }else{\n if (indexPath.section == 1) {\n indexpath_row = indexPath.row +1;\n table1 = self.tableView;\n }\n }\n\n\n myActionSheet.tag = tableView == self.tableView ? 10 : 11;\n [myActionSheet showFromTabBar:self.tabBarController.tabBar];\n\n // this example. normally you have more variables\n // ActionSheet or Alertview\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eActionSheet or Alertview\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e- (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex; {\n\n switch (buttonIndex) {\n case 1:{\n if (actionSheet.tag == 10)\n [self tableView:self.tableView accessoryButtonTappedForRowWithIndexPath:[NSIndexPath indexPathForRow:indexpath_row inSection:1]];\n else \n [self tableView:self.searchDisplayController.searchResultsTableView accessoryButtonTappedForRowWithIndexPath:[NSIndexPath indexPathForRow:indexpath_row inSection:1]];\n break;\n }\n case 2:{\n if (actionSheet.tag == 10)\n [self Run_Sub:table1 Satir_No:indexpath_row];\n else\n [self Run_Sub_Search:table1 Satir_No:indexpath_row];\n break;\n }\n //etc.\n\n default:\n break;\n }\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eCan we do without them? int indexpath_row and UITableView *table1.\nnsnotification as well as, Defining whether a location to another location would like to run. Is this possible?\u003c/p\u003e","answer_count":"1","comment_count":"1","creation_date":"2013-01-28 07:43:51.873 UTC","last_activity_date":"2013-01-28 23:55:31.677 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1669335","post_type_id":"1","score":"-4","tags":"ios|objective-c|uitableview|uialertview|uiactionsheet","view_count":"90"} -{"id":"13105798","title":"ASP.NET: I'm having trouble getting file path's to work on my Master Page","body":"\u003cp\u003eI have a master page I made with a navigational menu. I use this master page on my file \u003ccode\u003edefault.aspx\u003c/code\u003e and also \u003ccode\u003epro/page.aspx\u003c/code\u003e. The image and link references don't match up depending on which page I'm on. I attempted something like \u003ccode\u003e~/page.aspx?function=a\u003c/code\u003e \u0026amp;\u0026amp; \u003ccode\u003e~/Images/menu/a.gif\u003c/code\u003e. However these don't work. I can get the paths to work in certain cases, but then they never work on the other page. Can anyone point me in the direction of a fix for this? Thanks!\u003c/p\u003e","answer_count":"1","comment_count":"5","creation_date":"2012-10-28 02:06:44.83 UTC","last_activity_date":"2012-10-28 02:26:38.317 UTC","last_edit_date":"2012-10-28 02:08:36.28 UTC","last_editor_display_name":"","last_editor_user_id":"142822","owner_display_name":"","owner_user_id":"394241","post_type_id":"1","score":"1","tags":"asp.net|vb.net|master-pages","view_count":"175"} +{"id":"13105798","title":"ASP.NET: I'm having trouble getting file path's to work on my Cluster manager Page","body":"\u003cp\u003eI have a cluster manager page I made with a navigational menu. I use this cluster manager page on my file \u003ccode\u003edefault.aspx\u003c/code\u003e and also \u003ccode\u003epro/page.aspx\u003c/code\u003e. The image and link references don't match up depending on which page I'm on. I attempted something like \u003ccode\u003e~/page.aspx?function=a\u003c/code\u003e \u0026amp;\u0026amp; \u003ccode\u003e~/Images/menu/a.gif\u003c/code\u003e. However these don't work. I can get the paths to work in certain cases, but then they never work on the other page. Can anyone point me in the direction of a fix for this? Thanks!\u003c/p\u003e","answer_count":"1","comment_count":"5","creation_date":"2012-10-28 02:06:44.83 UTC","last_activity_date":"2012-10-28 02:26:38.317 UTC","last_edit_date":"2012-10-28 02:08:36.28 UTC","last_editor_display_name":"","last_editor_user_id":"142822","owner_display_name":"","owner_user_id":"394241","post_type_id":"1","score":"1","tags":"asp.net|vb.net|cluster-manager-pages","view_count":"175"} {"id":"43758423","title":"Service detection for .NET Core","body":"\u003cp\u003eCould you please suggest a method for \u003ccode\u003e.NET Core\u003c/code\u003e which is able to detect in runtime whether the code is executed within a service or not?\u003c/p\u003e\n\n\u003cp\u003eI have the working code for \u003ccode\u003e.NET Framework\u003c/code\u003e but I think it is impossible to port it because it is based on properties unavailable in \u003ccode\u003e.NET Core 1.1\u003c/code\u003e. \u003c/p\u003e","answer_count":"1","comment_count":"12","creation_date":"2017-05-03 11:13:09.133 UTC","last_activity_date":"2017-05-03 12:19:19.927 UTC","last_edit_date":"2017-05-03 11:18:56.76 UTC","last_editor_display_name":"","last_editor_user_id":"462639","owner_display_name":"","owner_user_id":"462639","post_type_id":"1","score":"0","tags":".net|service|.net-core","view_count":"153"} {"id":"14036232","title":"Getting the offset to .text section code PE file format? VirtualAddress, PointerToRawData?","body":"\u003cp\u003eI've been trying to do this for about two days, with no success. I have been reading over many PE file format tutorials to no avail.\u003c/p\u003e\n\n\u003cp\u003eI map a 32 bit executable into memory via CreateFileMapping which works perfectly. My program then loops through the section headers, and checks the characteristics against my default characteristics (to make sure the section is executable and is code). If it is true the program returns the (PIMAGE_SECTION_HEADER) pointer to that section header (program works perfectly so far).\u003c/p\u003e\n\n\u003cp\u003eNow that I have the pointer, there are two specific entries to the structure that have baffled me, and that is PointerToRawData and VirtualAddress, when I cout the entries;\nVirtualSize = 4096, PointerToRawData = 1536.\u003c/p\u003e\n\n\u003cp\u003eFrom what I have read in PE documentation, is that PointerToRawData is a supposed offset (RVA???) to the first byte of data in the section on disk (am I correct?), and is a multiple of a alignment value (512). The question is what do I set this value to, to obtain a pointer which I can use to access the section's data. On a memory-mapped file would it be better to use (VirtualAddress value + the imagebase value) to find the first byte of the section?\u003c/p\u003e\n\n\u003cp\u003eAnother point of confusion is VirtualSize vs SizeOfRawData. This has confused me because in this article - \u003ca href=\"http://msdn.microsoft.com/en-us/library/ms809762.aspx\" rel=\"nofollow\"\u003ehttp://msdn.microsoft.com/en-us/library/ms809762.aspx\u003c/a\u003e, it says \"The SizeOfRawData field (seems a bit of a misnomer) later on in the structure holds the rounded up value\" yet my VirtualSize is greater than my SizeOfRawData value which has led to confusion on which one I should use.\u003c/p\u003e\n\n\u003cp\u003eThe object of this program is to find the executable section (.text section) and perform a bitwise operation on all the bits in the section, and end the operation before the next section.\u003c/p\u003e\n\n\u003cp\u003eI don't want it to seem like I expect a spoonfeed, I just want some clarifications.\u003c/p\u003e\n\n\u003cp\u003eThank you for your time/help, it is appreciated.\u003c/p\u003e","accepted_answer_id":"14036278","answer_count":"1","comment_count":"0","creation_date":"2012-12-26 05:12:38.843 UTC","last_activity_date":"2012-12-26 05:49:05.327 UTC","last_edit_date":"2012-12-26 05:18:24.53 UTC","last_editor_display_name":"","last_editor_user_id":"1850910","owner_display_name":"","owner_user_id":"1850910","post_type_id":"1","score":"0","tags":"c++|c|portable-executable","view_count":"1646"} {"id":"31416051","title":"When to use deleteOnExit and not delete?","body":"\u003cp\u003eFirst of all I am not asking for difference between the two. I am wondering what will be a scenario where one will choose to use \u003ccode\u003edeleteOnExit()\u003c/code\u003e over \u003ccode\u003edelete()\u003c/code\u003e.\u003c/p\u003e","accepted_answer_id":"31416172","answer_count":"2","comment_count":"0","creation_date":"2015-07-14 19:52:23.593 UTC","last_activity_date":"2015-07-14 19:59:57.643 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"3254669","post_type_id":"1","score":"1","tags":"java|io","view_count":"80"} @@ -1380,12 +1380,12 @@ {"id":"44633106","title":"Implement \"Catch Block\" like behavior in Spring using AOP","body":"\u003cp\u003eI'm working on Spring application and I want to implement exception handling in following way:\nImplement an Aspect class for specific exception type where that exception is diverted\nHave such aspect classes based on exception types hierarchy and implement catch block like behavior \nfor example,\nthere're two aspect classes: ExceptionHandler for Exception and SQLExceptionHandler for SQLException\nBoth of them are exactly same pointcut expression.\nNow, if SQLException is raised from any method which is covered in point expression, SQLExceptionHandler's method should be executed.\nIf FileNotFoundException or any other type of exception occurs then ExceptionHandler's method should be executed.\nAny help would be much appreciated.\u003c/p\u003e","answer_count":"1","comment_count":"1","creation_date":"2017-06-19 14:21:20.443 UTC","last_activity_date":"2017-07-12 07:27:39.623 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"4174478","post_type_id":"1","score":"0","tags":"spring|exception-handling|spring-aop","view_count":"38"} {"id":"40475480","title":"ffmpeg - convert image sequence to video with reversed order","body":"\u003cp\u003eLooking at \u003ca href=\"https://trac.ffmpeg.org/wiki/Create%20a%20video%20slideshow%20from%20images\" rel=\"nofollow noreferrer\"\u003ethe docs\u003c/a\u003e, it is not apparent to me whether ffmpeg would allow me to convert an image sequence to a video in reverse order, for example using this sequence:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eframe-1000.jpg\nframe-999.jpg\nframe-998.jpg\n...\nframe-1.jpg\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eIs it possible to give a \"step direction\" for the frame indices?\u003c/p\u003e","accepted_answer_id":"40479257","answer_count":"2","comment_count":"0","creation_date":"2016-11-07 22:02:56.243 UTC","last_activity_date":"2017-04-08 23:35:47.023 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"515054","post_type_id":"1","score":"2","tags":"ffmpeg","view_count":"739"} {"id":"19131037","title":"edit each row in html using javascript","body":"\u003cp\u003eHelp! I can't edit the other rows on my table\u003c/p\u003e\n\n\u003cp\u003ehere is my script.. and it's working. but only on the first row.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;script\u0026gt;\nfunction showInput(e)\n{\ndocument.getElementById(e.id).type = \"text\";\ndocument.getElementById(e.id).focus();\n}\n\u0026lt;/script\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eand here is my table. coming from my database.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;table class=\"table table-bordered\"\u0026gt;\n\u0026lt;tr class=\"green\"\u0026gt;\n \u0026lt;th\u0026gt;Job Title\u0026lt;/th\u0026gt;\n \u0026lt;th\u0026gt;Job Description\u0026lt;/th\u0026gt;\n \u0026lt;th colspan=\"2\"\u0026gt;actions\u0026lt;/th\u0026gt;\n \u0026lt;/tr\u0026gt;\n\u0026lt;?php foreach ($fill_data as $row): ?\u0026gt;enter code here\n\n\n\u0026lt;tr\u0026gt;\n \u0026lt;td\u0026gt;\n \u0026lt;?php echo $row['title'];?\u0026gt;\n \u0026lt;div style=\"position:absolute; margin-top:-20px; margin-left:4px;\"\u0026gt;\n \u0026lt;input type=\"hidden\" id=\"\u0026lt;?php echo $row['title'];?\u0026gt;\" name=\"\u0026lt;?php echo $row['title'];?\u0026gt;\" value=\"\u0026lt;?php echo $row['title'];?\u0026gt;\"\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;/td\u0026gt;\n \u0026lt;td\u0026gt;\u0026lt;?php echo $row['description'];?\u0026gt;\u0026lt;/td\u0026gt;\n \u0026lt;td width=\"40px\"\u0026gt;\u0026lt;img src=\"\u0026lt;?php echo base_url(); ?\u0026gt;images/edit1.png\" width=\"30\" height=\"30\" title=\"Edit\" onclick=\"showInput(\u0026lt;?php echo $row['title'];?\u0026gt;)\" style=\"cursor: pointer\"\u0026gt;\u0026lt;/td\u0026gt;\n \u0026lt;td\u0026gt;\u0026lt;img data-toggle=\"modal\" data-id=\"\u0026lt;?php echo $row['id']?\u0026gt;\" class=\"delete-data\" href=\"#delete\" style=\"margin-top: 5px; cursor:pointer\" height=\"15\" width=\"15\" src=\"\u0026lt;?php echo base_url(); ?\u0026gt;images/remove.gif\"\u0026gt;\u0026lt;/td\u0026gt;\n\u0026lt;/tr\u0026gt;\n\u0026lt;?php endforeach?\u0026gt;\n\u0026lt;/table\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ethe $rows comes from my database.\u003c/p\u003e","answer_count":"1","comment_count":"1","creation_date":"2013-10-02 06:22:07.09 UTC","last_activity_date":"2013-10-02 07:02:43.877 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"2789695","post_type_id":"1","score":"0","tags":"javascript|php","view_count":"106"} -{"id":"17686998","title":"How to show recorded value in Edit Ruby on Rails","body":"\u003cp\u003eI have a master detail working, but when I go to the edit form the select field isn't shown as recorded in the database, it's showing the first \u003ccode\u003eoption_for_select\u003c/code\u003e: \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;div class='fields'\u0026gt;\n \u0026lt;div class='span-24 last'\u0026gt;\n \u0026lt;div class='span-11'\u0026gt;\n \u0026lt;%= f.select :ordem, options_for_select([[\"0\", 0], [\"1\", 1], [\"2\", 2], [\"3\", 3], [\"4\", 4], [\"5\", 5]]) %\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;div class='span-8'\u0026gt;\u0026lt;%= f.text_field :opcao %\u0026gt;\u0026lt;/div\u0026gt;\n\n \u0026lt;div class='last'\u0026gt;\n \u0026lt;%= f.hidden_field :_destroy %\u0026gt; \n \u0026lt;%= link_to_function '(X)', \"remove_fields(this)\" %\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;/div\u0026gt;\n\u0026lt;/div\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eSo what do I have to do to show the recorded content for this select?\u003c/p\u003e","accepted_answer_id":"17687341","answer_count":"1","comment_count":"0","creation_date":"2013-07-16 21:07:20.57 UTC","last_activity_date":"2013-07-18 18:31:45.193 UTC","last_edit_date":"2013-07-18 18:31:45.193 UTC","last_editor_display_name":"","last_editor_user_id":"359957","owner_display_name":"","owner_user_id":"2589059","post_type_id":"1","score":"1","tags":"ruby-on-rails|ruby-on-rails-3","view_count":"67"} +{"id":"17686998","title":"How to show recorded value in Edit Ruby on Rails","body":"\u003cp\u003eI have a cluster manager detail working, but when I go to the edit form the select field isn't shown as recorded in the database, it's showing the first \u003ccode\u003eoption_for_select\u003c/code\u003e: \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;div class='fields'\u0026gt;\n \u0026lt;div class='span-24 last'\u0026gt;\n \u0026lt;div class='span-11'\u0026gt;\n \u0026lt;%= f.select :ordem, options_for_select([[\"0\", 0], [\"1\", 1], [\"2\", 2], [\"3\", 3], [\"4\", 4], [\"5\", 5]]) %\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;div class='span-8'\u0026gt;\u0026lt;%= f.text_field :opcao %\u0026gt;\u0026lt;/div\u0026gt;\n\n \u0026lt;div class='last'\u0026gt;\n \u0026lt;%= f.hidden_field :_destroy %\u0026gt; \n \u0026lt;%= link_to_function '(X)', \"remove_fields(this)\" %\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;/div\u0026gt;\n\u0026lt;/div\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eSo what do I have to do to show the recorded content for this select?\u003c/p\u003e","accepted_answer_id":"17687341","answer_count":"1","comment_count":"0","creation_date":"2013-07-16 21:07:20.57 UTC","last_activity_date":"2013-07-18 18:31:45.193 UTC","last_edit_date":"2013-07-18 18:31:45.193 UTC","last_editor_display_name":"","last_editor_user_id":"359957","owner_display_name":"","owner_user_id":"2589059","post_type_id":"1","score":"1","tags":"ruby-on-rails|ruby-on-rails-3","view_count":"67"} {"id":"25354805","title":"How do I use the command \"heroku pg:transfer\"?","body":"\u003cp\u003eI am very new to heroku/ruby on rails and git. I just went through Michael Hartl's Ruby on Rails tutorial and want to push my local database to heroku but am having trouble. \u003c/p\u003e\n\n\u003cp\u003eAfter doing some research I found this article:\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"http://www.higherorderheroku.com/articles/pgtransfer-is-the-new-taps/\" rel=\"nofollow\"\u003epg transfer is the new taps\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eIt seems like it should work, but I do not understand how to set my env var \u003ccode\u003eDATABASE_URL\u003c/code\u003e:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e$ env DATABASE_URL=postgres://localhost/someapp-dev heroku pg:transfer\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eSpecifically I have no idea what I am supposed to directly copy and what to change. I believe I need to enter my own local host and my own database name. \u003c/p\u003e\n\n\u003cp\u003eIs this correct? If so how do I find my localhost and how do I find my database name? \u003c/p\u003e\n\n\u003cp\u003eMy database.yml file looks like this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003edevelopment:\n adapter: sqlite3\n database: db/development.sqlite3\n pool: 5\n timeout: 5000\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"1","comment_count":"3","creation_date":"2014-08-18 00:09:30.45 UTC","last_activity_date":"2014-08-18 01:16:13.927 UTC","last_edit_date":"2014-08-18 01:16:13.927 UTC","last_editor_display_name":"","last_editor_user_id":"585456","owner_display_name":"","owner_user_id":"3911994","post_type_id":"1","score":"1","tags":"ruby-on-rails|ruby|git|postgresql|heroku","view_count":"261"} {"id":"5491389","title":"CakePHP - Html-\u003elink - why use controller=\u003e and action=\u003e instead of just controller/action","body":"\u003cp\u003e\u003cstrong\u003eWhy this:\u003c/strong\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eecho $this-\u0026gt;Html-\u0026gt;link('Add a User', array('controller'=\u0026gt;'users', 'action'=\u0026gt;'add'));\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003cstrong\u003eInstead of just this:\u003c/strong\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eecho $this-\u0026gt;Html-\u0026gt;link('Add a User', 'users/add');\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"5491498","answer_count":"2","comment_count":"0","creation_date":"2011-03-30 19:39:32.257 UTC","last_activity_date":"2015-04-07 04:53:13.97 UTC","last_edit_date":"2014-10-09 18:32:03.317 UTC","last_editor_display_name":"","last_editor_user_id":"759866","owner_display_name":"","owner_user_id":"673664","post_type_id":"1","score":"4","tags":"php|cakephp|cakephp-1.3","view_count":"7734"} {"id":"44617797","title":"Google cloud compute engine high latency","body":"\u003cp\u003eI just started using google cloud, and I've been having issues with my instance. The connection is really unstable and has really high ping. Used speedtest to test it, and has over 150 ms. Is this normal? It shouldnt be. I'd appreciate anyones help.\u003c/p\u003e","answer_count":"0","comment_count":"4","creation_date":"2017-06-18 17:42:36.333 UTC","favorite_count":"1","last_activity_date":"2017-06-18 17:42:36.333 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"8179674","post_type_id":"1","score":"2","tags":"google-cloud-platform","view_count":"118"} {"id":"14071320","title":"rotation along x and y axis","body":"\u003cp\u003eI'm using GLKit along with PowerVR library for my opengl-opensearch 2.0 3D app. The 3D scene loads with several meshes, which simulate a garage environment. I have a car in the center of the garage. I am trying to add touch handling to the app, where the user can rotate the room around (e.g., to see all 4 walls surrounding the car). I also want to allow a rotation on the x axis, though limited to a small range. Basically they can see from a little bit of the top of the car to just above the floor level.\u003c/p\u003e\n\n\u003cp\u003eI am able to rotate on the Y OR on the X, but not both. As soon as I rotate on both axis, the car is thrown off-axis. The car isn't level with the camera anymore. I wish I could explain this better, but hopefully you guys will understand.\u003c/p\u003e\n\n\u003cp\u003eHere is my touches implementation:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {\n\n UITouch * touch = [touches anyObject];\n CGPoint location = [touch locationInView:self.view]; \n CGPoint lastLoc = [touch previousLocationInView:self.view];\n CGPoint diff = CGPointMake(lastLoc.x - location.x, lastLoc.y - location.y);\n\n float rotX = -1 * GLKMathDegreesToRadians(diff.x / 4.0);\n float rotY = GLKMathDegreesToRadians(diff.y / 5.0);\n\n PVRTVec3 xAxis = PVRTVec3(1, 0, 0);\n PVRTVec3 yAxis = PVRTVec3(0,1,0);\n\n PVRTMat4 yRotMatrix, xRotMatrix;\n\n // create rotation matrices with angle\n PVRTMatrixRotationXF(yRotMatrix, rotY);\n PVRTMatrixRotationYF(xRotMatrix, -rotX);\n\n _rotationY = _rotationY * yRotMatrix;\n _rotationX = _rotationX * xRotMatrix;\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHere's my update method:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e- (void)update {\n\n // Use the loaded effect\n m_pEffect-\u0026gt;Activate();\n\n\n PVRTVec3 vFrom, vTo, vUp;\n VERTTYPE fFOV;\n vUp.x = 0.0f;\n vUp.y = 1.0f;\n vUp.z = 0.0f;\n\n // We can get the camera position, target and field of view (fov) with GetCameraPos()\n fFOV = m_Scene.GetCameraPos(vFrom, vTo, 0);\n\n /*\n We can build the world view matrix from the camera position, target and an up vector.\n For this we use PVRTMat4LookAtRH().\n */\n m_mView = PVRTMat4::LookAtRH(vFrom, vTo, vUp);\n\n // rotate the camera based on the users swipe in the X direction (THIS WORKS)\n m_mView = m_mView * _rotationX;\n\n // Calculates the projection matrix\n bool bRotate = false;\n m_mProjection = PVRTMat4::PerspectiveFovRH(fFOV, (float)1024.0/768.0, CAM_NEAR, CAM_FAR, PVRTMat4::OGL, bRotate);\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI've tried multiplying the new X rotation matrix to the current scene rotation first, and then multiplying the new Y rotation matrix second. I've tried the reverse of that, thinking the order of multiplication was my problem. That didn't help. Then I tried adding the new X and Y rotation matrices together before multiplying to the current rotation, but that didn't work either. I feel that I'm close, but at this point I'm just out of ideas.\u003c/p\u003e\n\n\u003cp\u003eCan you guys help? Thanks. -Valerie\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eUpdate:\u003c/strong\u003e In an effort to solve this, I'm trying to simplify it a little. I've updated the above code, removing any limit in the range of the Y rotation. Basically I calculate the X and Y rotation based on the user swipe on the screen. \u003c/p\u003e\n\n\u003cp\u003eIf I understand this correctly, I think I want to rotate the View matrix (camera/eye) with the calculation for the _rotationX. \u003c/p\u003e\n\n\u003cp\u003eI think I need to use the World matrix (origin 0,0,0) for the _rotationY calculation. I'll try and get some images of exactly what I'm talking about.\u003c/p\u003e","accepted_answer_id":"14084821","answer_count":"1","comment_count":"0","creation_date":"2012-12-28 14:52:53.007 UTC","last_activity_date":"2012-12-29 18:45:17.603 UTC","last_edit_date":"2012-12-29 03:59:45.12 UTC","last_editor_display_name":"","last_editor_user_id":"574623","owner_display_name":"","owner_user_id":"574623","post_type_id":"1","score":"1","tags":"ios|opengl-opensearch-2.0|powervr-sgx","view_count":"375"} -{"id":"32443890","title":"How to make Google map fill available height between dynamic header and footer","body":"\u003cp\u003eI have a header and footer, each with dynamic content. This is actually an aspx page with a master page which contains header/footer content which may vary in size. I can not enforce a px height for header or footer as they may have images or just text, etc. I want to make the Google map fill the available page height (and width) between them. I'll give the map canvas a minimum height of say 200px, just in case, but otherwise it should force the footer to bottom of the page without scrolling (unless the screen is short enough for the 200px minimum to require scrolling).\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;body\u0026gt;\n\u0026lt;div id=\"wrapper\"\u0026gt;\n \u0026lt;div id=\"header\"\u0026gt;Title\u0026lt;br /\u0026gt;of\u0026lt;br /\u0026gt;variable\u0026lt;br/\u0026gt;height\u0026lt;/div\u0026gt;\n \u0026lt;div id=\"body\"\u0026gt;\n \u0026lt;div id=\"map-canvas\"\u0026gt;\u0026lt;/div\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;div id=\"footer\"\u0026gt;\n Footer\u0026lt;br /\u0026gt;of\u0026lt;br /\u0026gt;variable\u0026lt;br /\u0026gt;height\n \u0026lt;/div\u0026gt;\n\u0026lt;/div\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003c/p\u003e\n\n\u003cp\u003eHere is a Fiddle showing it very close using flex approach... It seems to work in Chrome/FireFox but this does not work in IE11.\n\u003ca href=\"https://jsfiddle.net/randbrown/7dc8u6ja/4/\" rel=\"nofollow\"\u003ehttps://jsfiddle.net/randbrown/7dc8u6ja/4/\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eIs the flex-based approach best for this and if so what am I missing to get it working in IE? Or is there a better way to achieve this?\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2015-09-07 17:53:41.91 UTC","last_activity_date":"2015-09-09 14:24:28.733 UTC","last_edit_date":"2015-09-08 03:20:14.767 UTC","last_editor_display_name":"","last_editor_user_id":"1213296","owner_display_name":"","owner_user_id":"438365","post_type_id":"1","score":"-1","tags":"html|css|google-maps|flexbox","view_count":"1187"} +{"id":"32443890","title":"How to make Google map fill available height between dynamic header and footer","body":"\u003cp\u003eI have a header and footer, each with dynamic content. This is actually an aspx page with a cluster manager page which contains header/footer content which may vary in size. I can not enforce a px height for header or footer as they may have images or just text, etc. I want to make the Google map fill the available page height (and width) between them. I'll give the map canvas a minimum height of say 200px, just in case, but otherwise it should force the footer to bottom of the page without scrolling (unless the screen is short enough for the 200px minimum to require scrolling).\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;body\u0026gt;\n\u0026lt;div id=\"wrapper\"\u0026gt;\n \u0026lt;div id=\"header\"\u0026gt;Title\u0026lt;br /\u0026gt;of\u0026lt;br /\u0026gt;variable\u0026lt;br/\u0026gt;height\u0026lt;/div\u0026gt;\n \u0026lt;div id=\"body\"\u0026gt;\n \u0026lt;div id=\"map-canvas\"\u0026gt;\u0026lt;/div\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;div id=\"footer\"\u0026gt;\n Footer\u0026lt;br /\u0026gt;of\u0026lt;br /\u0026gt;variable\u0026lt;br /\u0026gt;height\n \u0026lt;/div\u0026gt;\n\u0026lt;/div\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003c/p\u003e\n\n\u003cp\u003eHere is a Fiddle showing it very close using flex approach... It seems to work in Chrome/FireFox but this does not work in IE11.\n\u003ca href=\"https://jsfiddle.net/randbrown/7dc8u6ja/4/\" rel=\"nofollow\"\u003ehttps://jsfiddle.net/randbrown/7dc8u6ja/4/\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eIs the flex-based approach best for this and if so what am I missing to get it working in IE? Or is there a better way to achieve this?\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2015-09-07 17:53:41.91 UTC","last_activity_date":"2015-09-09 14:24:28.733 UTC","last_edit_date":"2015-09-08 03:20:14.767 UTC","last_editor_display_name":"","last_editor_user_id":"1213296","owner_display_name":"","owner_user_id":"438365","post_type_id":"1","score":"-1","tags":"html|css|google-maps|flexbox","view_count":"1187"} {"id":"46786847","title":"How can I read single-channel 32-bit integer images with python?","body":"\u003cp\u003eI want to read single-channel 32-bit integer image saved as ssv file.\nI have tried so far(see the following code) but without much success. \u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"https://i.stack.imgur.com/J1LEG.png\" rel=\"nofollow noreferrer\"\u003eHere is the code\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003ePlease let me know if you have any idea of what is missing?\u003c/p\u003e","accepted_answer_id":"46792308","answer_count":"1","comment_count":"2","creation_date":"2017-10-17 09:26:28.537 UTC","last_activity_date":"2017-10-17 14:14:08.91 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"8287770","post_type_id":"1","score":"-1","tags":"python|numpy|import|text-files","view_count":"27"} {"id":"24650309","title":"Update cannot proceed due to validation errors.","body":"\u003cp\u003ebelow is my code \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eCREATE TABLE [dbo].[tbl_company] (\n [Id] INT IDENTITY (1, 1) NOT NULL,\n [company_Id] INT NOT NULL,\n [typeOfCompany] VARCHAR (250) NULL,\n [ownership_Id] INT NULL, \n CONSTRAINT [PK_tbl_company] PRIMARY KEY ([Id])\n);\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ei am getting below error:\nThe referenced table '[dbo].[tbl_company]' contains no primary or candidate keys that match the referencing column list in the foreign key. If the referenced column is a computed column, it should be persisted.\u003c/p\u003e","answer_count":"1","comment_count":"1","creation_date":"2014-07-09 09:43:50.89 UTC","last_activity_date":"2014-07-09 09:50:35.91 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"3819789","post_type_id":"1","score":"0","tags":"sql-server","view_count":"626"} {"id":"15060218","title":"how to add bootstrap responsive features to my navigation without changing my styling","body":"\u003cp\u003eI'm working on a navigation and I want to add bootstrap responsive feature to it, but without changing my original styling, like color, height and etc. appreciate if any one can help me on this.\u003c/p\u003e\n\n\u003cp\u003ebelow is the navigation mark up.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e \u0026lt;header id=\"pageHeader\"\u0026gt;\n \u0026lt;div class=\"container\"\u0026gt;\n \u0026lt;div id=\"logo\"\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;div id=\"navMain\"\u0026gt;\n \u0026lt;ul id=\"navContainer\"\u0026gt;\n \u0026lt;li\u0026gt;\u0026lt;a class=\"selected\" href=\"index.html\"\u0026gt;HOME\u0026lt;/a\u0026gt;\u0026lt;/li\u0026gt;\n \u0026lt;li\u0026gt;\u0026lt;a href=\"about.html\"\u0026gt;ABOUT\u0026lt;/a\u0026gt;\u0026lt;/li\u0026gt;\n \u0026lt;li\u0026gt;\u0026lt;a href=\"services.html\"\u0026gt;SERVICES\u0026lt;/a\u0026gt;\u0026lt;/li\u0026gt;\n \u0026lt;li\u0026gt;\u0026lt;a href=\"portfolio.html\"\u0026gt;PORTFOLIO\u0026lt;/a\u0026gt;\u0026lt;/li\u0026gt;\n \u0026lt;li\u0026gt;\u0026lt;a href=\"contact.html\"\u0026gt;CONTACT\u0026lt;/a\u0026gt;\u0026lt;/li\u0026gt;\n \u0026lt;/ul\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;/header\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eand this is the styling I have used.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e#pageHeader{\n background-color: rgb(250,210,0);\n width: 100%;\n}\n/* 3.2. Logo Styling */\n#logoTop{\n float:left;\n}\n/* 3.3. Main Navigation Styling */ \n#navMain{\n float: right;\n position: relative;\n margin: 84px 10px 21px 10px;\n}\nul#navContainer{\n display: block;\n position: inherit;\n}\n#navMain ul li{\n float: left;\n display: block;\n margin: 0px auto;\n font-weight: bold;\n list-style-image: none;\n}\n#navMain ul li a{\n color: rgb(99,99,99);\n font-size: 18px;\n padding: 10px 3px 10px 12px;\n font-family: \"nexa_500\", Tahoma, Geneva, sans-serif;\n font-size: 16px;\n text-transform: uppercase;\n text-decoration: none;\n -webkit-transition: color ease 0.7s;\n -moz-transition: color ease 0.7s;\n -o-transition: color ease 0.7s;\n transition: color ease 0.7s;\n}\n#navMain li a:hover,\n#navMain li a:active {\n text-decoration: none;\n color: rgb(33,33,33);\n -webkit-transition: color ease 0.7s;\n -moz-transition: color ease 0.7s;\n -o-transition: color ease 0.7s;\n transition: color ease 0.7s;\n}\n#navMain ul li a.selected{\n color: rgb(33,33,33);\n}\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"15060401","answer_count":"1","comment_count":"2","creation_date":"2013-02-25 04:39:02.817 UTC","last_activity_date":"2013-02-25 04:58:48.277 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1184185","post_type_id":"1","score":"0","tags":"html5|css3|twitter-bootstrap|navigation|responsive-design","view_count":"336"} @@ -1631,7 +1631,7 @@ {"id":"18600668","title":"Overriding SilverStripe 3 CommentsInterface.ss","body":"\u003cp\u003eI've installed the comments module for my SS 3.0 blog and it's working.\u003c/p\u003e\n\n\u003cp\u003eBut I want to override the CommentsInterface.ss template and I can't figure out where to put the overriding file. I've tried in themes/mytheme/template and themes/mytheme/templates/Includes and neither seem to work.\u003c/p\u003e\n\n\u003cp\u003eThis should not be hard, so I must be missing something easy.\u003c/p\u003e\n\n\u003cp\u003eClues?\u003c/p\u003e\n\n\u003cp\u003eBob\u003c/p\u003e","accepted_answer_id":"18602502","answer_count":"2","comment_count":"0","creation_date":"2013-09-03 20:11:21.75 UTC","last_activity_date":"2013-09-04 18:15:08.183 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1938118","post_type_id":"1","score":"0","tags":"comments|blogs|silverstripe","view_count":"88"} {"id":"11782766","title":"Trigonometric functions in R","body":"\u003cp\u003eI have a data.frame which contain a series of values, Xg, to which I am applying trigonometric functions to create a new column in the data.frame called \"angle\":\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003edt$angle \u0026lt;- sin(asin(dt$Xg / 9.8))\ndt$angle \u0026lt;- asin(dt$angle)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHowever when I apply the second line of code here it's not giving me the correct values, which I can work out using a calculator that are wrong.\nIs this code applying the arcsine function to each data point individually or am I missing something?\u003c/p\u003e","answer_count":"1","comment_count":"3","creation_date":"2012-08-02 17:31:44.697 UTC","last_activity_date":"2012-08-02 18:35:45.217 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1517860","post_type_id":"1","score":"0","tags":"r|dataframe|trigonometry","view_count":"313"} {"id":"27333543","title":"Unity 3D - Too many errors","body":"\u003cp\u003eTwo scripts are generating these errors by the looks of it, they are listed below:\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003e-------------------------------\u003c/strong\u003e\n\u003cstrong\u003eGameInformation - Coding listed below:\u003c/strong\u003e\n\u003cstrong\u003e-------------------------------\u003c/strong\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eusing UnityEngine;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eusing System.Collections;\u003c/p\u003e\n\n\u003cp\u003epublic class GameInformation : MonoBehaviour {\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003evoid Awake(){\n DontDestroyOnLoad (transform.gameObject);\n}\n\npublic static string PlayerName{ get; set; }\npublic static int PlayerLevel{ get; set; }\npublic static BaseCharacterClass PlayerClass{ get; set; }\npublic static int Speed{ get; set; }\npublic static int Endurance{ get; set; }\npublic static int Strength{ get; set; }\npublic static int Health{ get; set; }\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003cstrong\u003e-------------------------------\u003c/strong\u003e\n \u003cstrong\u003eThe other script is SaveInformation:\u003c/strong\u003e\n\u003cstrong\u003e-------------------------------\u003c/strong\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eusing UnityEngine;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eusing System.Collections;\u003c/p\u003e\n\n\u003cp\u003epublic class SaveInformation {\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epublic static void SaveAllInformation(){\n PlayerPrefs.SetInt(\"PLAYERLEVEL\", GameInformation.PlayerLevel);\n PlayerPrefs.SetString(\"PLAYERNAME\", GameInformation.PlayerName);\n PlayerPrefs.SetString(\"SPEED\", GameInformation.Speed);\n PlayerPrefs.SetString(\"ENDURANCE\", GameInformation.Endurance);\n PlayerPrefs.SetString(\"STRENGTH\", GameInformation.Strength);\n PlayerPrefs.SetString(\"HEALTH\", GameInformation.Health);\n }\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e}\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003e-------------------------------\u003c/strong\u003e\n\u003cstrong\u003eErrors :\u003c/strong\u003e\n\u003cstrong\u003e-------------------------------\u003c/strong\u003e\u003c/p\u003e\n\n\u003cblockquote\u003e\n \u003cp\u003eAssets/Standard\n Assets/Scripts/SavingAndLoading/SaveInformation.cs(7,67): error\n CS0117: \u003ccode\u003eGameInformation' does not contain a definition for\n \u003c/code\u003ePlayerLevel'\u003c/p\u003e\n \n \u003cp\u003eAssets/Standard\n Assets/Scripts/SavingAndLoading/SaveInformation.cs(7,29): error\n CS1502: The best overloaded method match for\n `UnityEngine.PlayerPrefs.SetInt(string, int)' has some invalid\n arguments\u003c/p\u003e\n \n \u003cp\u003eAssets/Standard\n Assets/Scripts/SavingAndLoading/SaveInformation.cs(7,29): error\n CS1503: Argument \u003ccode\u003e#2' cannot convert\u003c/code\u003eobject' expression to type `int'\u003c/p\u003e\n \n \u003cp\u003eAssets/Standard\n Assets/Scripts/SavingAndLoading/SaveInformation.cs(8,69): error\n CS0117: \u003ccode\u003eGameInformation' does not contain a definition for\n \u003c/code\u003ePlayerName'\u003c/p\u003e\n \n \u003cp\u003eAssets/Standard\n Assets/Scripts/SavingAndLoading/SaveInformation.cs(8,29): error\n CS1503: Argument \u003ccode\u003e#2' cannot convert\u003c/code\u003eobject' expression to type\n `string'\u003c/p\u003e\n \n \u003cp\u003eAssets/Standard\n Assets/Scripts/SavingAndLoading/SaveInformation.cs(9,64): error\n CS0117: \u003ccode\u003eGameInformation' does not contain a definition for\u003c/code\u003eSpeed'\u003c/p\u003e\n \n \u003cp\u003eAssets/Standard\n Assets/Scripts/SavingAndLoading/SaveInformation.cs(9,29): error\n CS1502: The best overloaded method match for\n `UnityEngine.PlayerPrefs.SetString(string, string)' has some invalid\n arguments\u003c/p\u003e\n \n \u003cp\u003eAssets/Standard\n Assets/Scripts/SavingAndLoading/SaveInformation.cs(9,29): error\n CS1503: Argument \u003ccode\u003e#2' cannot convert\u003c/code\u003eobject' expression to type\n `string'\u003c/p\u003e\n \n \u003cp\u003eAssets/Standard\n Assets/Scripts/SavingAndLoading/SaveInformation.cs(10,68): error\n CS0117: \u003ccode\u003eGameInformation' does not contain a definition for\n \u003c/code\u003eEndurance'\u003c/p\u003e\n \n \u003cp\u003eAssets/Standard\n Assets/Scripts/SavingAndLoading/SaveInformation.cs(10,29): error\n CS1502: The best overloaded method match for\n `UnityEngine.PlayerPrefs.SetString(string, string)' has some invalid\n arguments\u003c/p\u003e\n \n \u003cp\u003eAssets/Standard\n Assets/Scripts/SavingAndLoading/SaveInformation.cs(10,29): error\n CS1503: Argument \u003ccode\u003e#2' cannot convert\u003c/code\u003eobject' expression to type\n `string'\u003c/p\u003e\n \n \u003cp\u003eAssets/Standard\n Assets/Scripts/SavingAndLoading/SaveInformation.cs(11,67): error\n CS0117: \u003ccode\u003eGameInformation' does not contain a definition for\u003c/code\u003eStrength'\u003c/p\u003e\n \n \u003cp\u003eAssets/Standard\n Assets/Scripts/SavingAndLoading/SaveInformation.cs(11,29): error\n CS1502: The best overloaded method match for\n `UnityEngine.PlayerPrefs.SetString(string, string)' has some invalid\n arguments\u003c/p\u003e\n \n \u003cp\u003eAssets/Standard\n Assets/Scripts/SavingAndLoading/SaveInformation.cs(11,29): error\n CS1503: Argument \u003ccode\u003e#2' cannot convert\u003c/code\u003eobject' expression to type\n `string'\u003c/p\u003e\n \n \u003cp\u003eAssets/Standard\n Assets/Scripts/SavingAndLoading/SaveInformation.cs(12,65): error\n CS0117: \u003ccode\u003eGameInformation' does not contain a definition for\u003c/code\u003eHealth'\u003c/p\u003e\n \n \u003cp\u003eAssets/Standard\n Assets/Scripts/SavingAndLoading/SaveInformation.cs(12,29): error\n CS1502: The best overloaded method match for\n `UnityEngine.PlayerPrefs.SetString(string, string)' has some invalid\n arguments\u003c/p\u003e\n \n \u003cp\u003eAssets/Standard\n Assets/Scripts/SavingAndLoading/SaveInformation.cs(12,29): error\n CS1503: Argument \u003ccode\u003e#2' cannot convert\u003c/code\u003eobject' expression to type\n `string'\u003c/p\u003e\n\u003c/blockquote\u003e\n\n\u003cp\u003e\u003cstrong\u003e-------------------------------\u003c/strong\u003e\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003ePlease keep in mind when replying that I am rather new to coding. Thanks!\u003c/strong\u003e\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003e-------------------------------\u003c/strong\u003e\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2014-12-06 16:07:25.37 UTC","favorite_count":"1","last_activity_date":"2014-12-06 19:13:44.377 UTC","last_edit_date":"2014-12-06 16:26:12.87 UTC","last_editor_display_name":"","last_editor_user_id":"4330830","owner_display_name":"","owner_user_id":"4330830","post_type_id":"1","score":"-5","tags":"c#|unity3d","view_count":"547"} -{"id":"33984095","title":"How to get validation correct according to Radio Button","body":"\u003cpre\u003e\u003ccode\u003e\u003cdiv class=\"snippet\" data-lang=\"js\" data-hide=\"false\"\u003e\r\n\u003cdiv class=\"snippet-code\"\u003e\r\n\u003cpre class=\"snippet-code-js lang-js prettyprint-override\"\u003e\u003ccode\u003e$(document).ready(function(){\r\n var form = $(\"#Form-3\");\r\n var FName = $(\"#fname\"); //Creates Variables for elements in form\r\n var Tele = $(\"#tele\"); \r\n var Address = $(\"#address\");\r\n var Email = $(\"#email\");\r\n var Credit = $(\"#Card\")\r\n var regexp = /^[a-zA-Z0-9]+[a-zA-Z0-9_.-]+[a-zA-Z0-9_.-]+@[a-zA-Z0-9]+[a-zA-Z0-9.-]+[a-zA-Z0-9.]+.[a-z]{2,4}$/; //ragex code- used to validate email \r\n \r\n\r\n \r\n FName.blur(validateFName); //blur is a method which attaches a functiom to run when an event occurs\r\n Email.blur(validateEmail); \r\n Tele.blur(validateTele);\r\n Address.blur(validateAddress);\r\n Credit.blur(validateCard);\r\n \r\n\r\n form.submit (function(){\r\n \r\n if (validateFName() \u0026amp; validateTele() \u0026amp; validateEmail() \u0026amp; validateAddress() \u0026amp; validateCard()){ //If it passes all of these then return true \r\n \r\n return true; \r\n }\r\n else {\r\n return false; \r\n }\r\n\r\n \r\n });\r\n function validateCard(){ //Validates Credit Card \r\n var Visa = /^(?:4[0-9]{12}(?:[0-9]{3})?)$/; //Ragex code for Credit Cards \r\n var MasterCard = /^(?:5[1-5][0-9]{14})$/; \r\n var CC = Credit.val();\r\n \r\n $(\"#Visa\").click(function() { //Tick Radio Button\r\n $(\"#Card\").show(); \r\n if (Visa.test(CC) ){ // If user input is equal to both Visa Or Mastercard Then Valid \r\n document.getElementById(\"CardError\").textContent =\"\";\r\n return true;\r\n }\r\n }); \r\n \r\n $(\"#Master\").click(function() { //Checks MasterCard button. \r\n $(\"#Card\").show();\r\n if(MasterCard.test(CC)){\r\n document.getElementById(\"CardError\").textContent =\"\"; //Display Error\r\n return true;\r\n } \r\n else {\r\n document.getElementById(\"CardError\").textContent =\"Please Ensure Card Detail Is Correct\"; //Display Error\r\n return false;\r\n }\r\n});\r\n}\r\n\r\n});\r\n \u003c/code\u003e\u003c/pre\u003e\r\n\u003cpre class=\"snippet-code-html lang-html prettyprint-override\"\u003e\u003ccode\u003e \u0026lt;label for=\"Card\"\u0026gt;Credit Card (16 Digit Number)\u0026lt;/label\u0026gt;\r\n \u0026lt;br/\u0026gt;\r\n \u0026lt;input type=\"radio\" id=\"Visa\" name=\"Type1\"\u0026gt;\r\n \u0026lt;label\u0026gt;Visa\u0026lt;/label\u0026gt;\r\n \u0026lt;br/\u0026gt;\r\n \u0026lt;input type=\"radio\" id=\"Master\" name=\"Type1\"\u0026gt;\r\n \u0026lt;label\u0026gt;MasterCard\u0026lt;/label\u0026gt;\r\n \u0026lt;input id=\"Card\" name=\"Card\" type=\"text\" hidden=\"true\" /\u0026gt;\r\n \u0026lt;label id=\"CardError\"\u0026gt;\u0026lt;/label\u0026gt;\u003c/code\u003e\u003c/pre\u003e\r\n\u003c/div\u003e\r\n\u003c/div\u003e\r\n\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eIn here I have two radio Buttons one for Visa Card and the other for MasterCard I want it that when user clicks on visa radio button only visa validation works and not Mastercard number vice versa, right now nothing is happening, however I can it get it to when the user clicks on Visa or Mastercard both validation apply i.e. Visa validation works when Mastercard radio buton is chosen. How can I specifically set it to one form of validation?\u003c/p\u003e","answer_count":"1","comment_count":"3","creation_date":"2015-11-29 14:51:12.13 UTC","last_activity_date":"2015-11-29 15:38:48.573 UTC","last_edit_date":"2015-11-29 15:38:48.573 UTC","last_editor_display_name":"","last_editor_user_id":"4381637","owner_display_name":"","owner_user_id":"4381637","post_type_id":"1","score":"0","tags":"javascript|jquery|html","view_count":"41"} +{"id":"33984095","title":"How to get validation correct according to Radio Button","body":"\u003cpre\u003e\u003ccode\u003e\u003cdiv class=\"snippet\" data-lang=\"js\" data-hide=\"false\"\u003e\r\n\u003cdiv class=\"snippet-code\"\u003e\r\n\u003cpre class=\"snippet-code-js lang-js prettyprint-override\"\u003e\u003ccode\u003e$(document).ready(function(){\r\n var form = $(\"#Form-3\");\r\n var FName = $(\"#fname\"); //Creates Variables for elements in form\r\n var Tele = $(\"#tele\"); \r\n var Address = $(\"#address\");\r\n var Email = $(\"#email\");\r\n var Credit = $(\"#Card\")\r\n var regexp = /^[a-zA-Z0-9]+[a-zA-Z0-9_.-]+[a-zA-Z0-9_.-]+@[a-zA-Z0-9]+[a-zA-Z0-9.-]+[a-zA-Z0-9.]+.[a-z]{2,4}$/; //ragex code- used to validate email \r\n \r\n\r\n \r\n FName.blur(validateFName); //blur is a method which attaches a functiom to run when an event occurs\r\n Email.blur(validateEmail); \r\n Tele.blur(validateTele);\r\n Address.blur(validateAddress);\r\n Credit.blur(validateCard);\r\n \r\n\r\n form.submit (function(){\r\n \r\n if (validateFName() \u0026amp; validateTele() \u0026amp; validateEmail() \u0026amp; validateAddress() \u0026amp; validateCard()){ //If it passes all of these then return true \r\n \r\n return true; \r\n }\r\n else {\r\n return false; \r\n }\r\n\r\n \r\n });\r\n function validateCard(){ //Validates Credit Card \r\n var Visa = /^(?:4[0-9]{12}(?:[0-9]{3})?)$/; //Ragex code for Credit Cards \r\n var MasterCard = /^(?:5[1-5][0-9]{14})$/; \r\n var CC = Credit.val();\r\n \r\n $(\"#Visa\").click(function() { //Tick Radio Button\r\n $(\"#Card\").show(); \r\n if (Visa.test(CC) ){ // If user input is equal to both Visa Or Mastercard Then Valid \r\n document.getElementById(\"CardError\").textContent =\"\";\r\n return true;\r\n }\r\n }); \r\n \r\n $(\"#ClusterManager\").click(function() { //Checks MasterCard button. \r\n $(\"#Card\").show();\r\n if(MasterCard.test(CC)){\r\n document.getElementById(\"CardError\").textContent =\"\"; //Display Error\r\n return true;\r\n } \r\n else {\r\n document.getElementById(\"CardError\").textContent =\"Please Ensure Card Detail Is Correct\"; //Display Error\r\n return false;\r\n }\r\n});\r\n}\r\n\r\n});\r\n \u003c/code\u003e\u003c/pre\u003e\r\n\u003cpre class=\"snippet-code-html lang-html prettyprint-override\"\u003e\u003ccode\u003e \u0026lt;label for=\"Card\"\u0026gt;Credit Card (16 Digit Number)\u0026lt;/label\u0026gt;\r\n \u0026lt;br/\u0026gt;\r\n \u0026lt;input type=\"radio\" id=\"Visa\" name=\"Type1\"\u0026gt;\r\n \u0026lt;label\u0026gt;Visa\u0026lt;/label\u0026gt;\r\n \u0026lt;br/\u0026gt;\r\n \u0026lt;input type=\"radio\" id=\"ClusterManager\" name=\"Type1\"\u0026gt;\r\n \u0026lt;label\u0026gt;MasterCard\u0026lt;/label\u0026gt;\r\n \u0026lt;input id=\"Card\" name=\"Card\" type=\"text\" hidden=\"true\" /\u0026gt;\r\n \u0026lt;label id=\"CardError\"\u0026gt;\u0026lt;/label\u0026gt;\u003c/code\u003e\u003c/pre\u003e\r\n\u003c/div\u003e\r\n\u003c/div\u003e\r\n\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eIn here I have two radio Buttons one for Visa Card and the other for MasterCard I want it that when user clicks on visa radio button only visa validation works and not Mastercard number vice versa, right now nothing is happening, however I can it get it to when the user clicks on Visa or Mastercard both validation apply i.e. Visa validation works when Mastercard radio buton is chosen. How can I specifically set it to one form of validation?\u003c/p\u003e","answer_count":"1","comment_count":"3","creation_date":"2015-11-29 14:51:12.13 UTC","last_activity_date":"2015-11-29 15:38:48.573 UTC","last_edit_date":"2015-11-29 15:38:48.573 UTC","last_editor_display_name":"","last_editor_user_id":"4381637","owner_display_name":"","owner_user_id":"4381637","post_type_id":"1","score":"0","tags":"javascript|jquery|html","view_count":"41"} {"id":"43801199","title":"How can I integrate a Qt Virtual Keyboard with PyQt 5.8?","body":"\u003cp\u003eI am using PyQt5.8 on a raspberry Pi 3, my application had a login form. So how can i prompt a virtual keyboard when user touchs one of the form fields in the touchscreen?\u003c/p\u003e\n\n\u003cp\u003eI tried \u003ca href=\"http://code.activestate.com/recipes/579118-pyqt-touch-input/\" rel=\"nofollow noreferrer\"\u003ethis\u003c/a\u003e but it does not working with pyQt5 after porting it (it work fine with pyQt4), making the cursor in the field does not prompt the virtual keyboard.\u003c/p\u003e\n\n\u003cp\u003eBest regards!\u003c/p\u003e","answer_count":"0","comment_count":"0","creation_date":"2017-05-05 09:22:32.467 UTC","last_activity_date":"2017-05-26 00:59:48.46 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"4940053","post_type_id":"1","score":"1","tags":"qt|keyboard|pyqt5|raspberry-pi3","view_count":"272"} {"id":"10814428","title":"OnActivityResult is not calling in TabGroupActivity","body":"\u003cp\u003eI have an tabactivity with four tabs \u003c/p\u003e\n\n\u003cp\u003eHome-\u003eTab1-\u003eActivity1-\u003eActivity2\u003cimg src=\"https://i.stack.imgur.com/Zvkn1.png\" alt=\"enter image description here\"\u003e\u003c/p\u003e\n\n\u003cp\u003eIn Activity2 I have a text box. When I click textbox I am showing CalenderActivity like below\n \u003cimg src=\"https://i.stack.imgur.com/RUoLc.png\" alt=\"activity2\"\u003e\u003c/p\u003e\n\n\u003cp\u003eWhen click date it has to display the date in text box; for that I write onActivityResult in Activity3 but that is not calling. What do I have to do to display date in textbox? I am using TabGroupActivity to navigate between activities in a single tab...\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2012-05-30 10:24:54.887 UTC","last_activity_date":"2013-12-06 11:16:23.963 UTC","last_edit_date":"2013-12-06 11:16:14.493 UTC","last_editor_display_name":"","last_editor_user_id":"759866","owner_display_name":"","owner_user_id":"1237073","post_type_id":"1","score":"0","tags":"android|tabs|activitygroup","view_count":"295"} {"id":"44781199","title":"MobileFirst 7.1 javascript adapter - how to read clob data?","body":"\u003cpre\u003e\u003ccode\u003efunction getUser(userId) {\n\n var obj = {};\n\n var resultSet = WL.Server.invokeSQLStatement({\n preparedStatement: getUserSQL,\n parameters: [userId]\n });\n\n obj = {\n name: result.resultSet[0]['NAME'],\n image: result.resultSet[0]['IMAGE'] // ???\n }\n\n return obj;\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThis returns clob.toString. I need to get the string (32K) from CLOB, how can I do this?\u003c/p\u003e","accepted_answer_id":"44892019","answer_count":"1","comment_count":"0","creation_date":"2017-06-27 13:11:36.417 UTC","favorite_count":"1","last_activity_date":"2017-07-03 18:33:32.39 UTC","last_edit_date":"2017-06-27 13:16:47.22 UTC","last_editor_display_name":"","last_editor_user_id":"8220654","owner_display_name":"","owner_user_id":"8220654","post_type_id":"1","score":"1","tags":"javascript|ibm-mobilefirst|mobilefirst-adapters|mobilefirst-server","view_count":"69"} @@ -1750,7 +1750,7 @@ {"id":"19913000","title":"Frustration with emberjs data transfering with its backend method as PHP","body":"\u003cp\u003eI tried to do these three simple things but I can not in a world to figure out in almost ONE MONTH already, one word---FRUSTRATION! Now I doubt if emberjs is really worth it...\u003c/p\u003e\n\n\u003cp\u003eI want to:\u003c/p\u003e\n\n\u003col\u003e\n\u003cli\u003e\u003cp\u003eGet data from database with just a .php file and data will be in json format \u003c/p\u003e\n\n\u003cp\u003eNOTE: I did this, \u003ca href=\"https://stackoverflow.com/questions/19791068/return-jason-data-from-php-for-emberjs-in-the-right-format-with-getjson\"\u003ein other SO question I asked\u003c/a\u003e, so I will not repeat.\u003c/p\u003e\u003c/li\u003e\n\u003cli\u003e\u003cp\u003eNow, the problem, how can I save those data in a \"store\" without ember data?\u003c/p\u003e\u003c/li\u003e\n\u003cli\u003e\u003cp\u003eIs there any available tutorial on how php can connect with emberjs? I tried to read about its REST adapter, but seem it needs some type of JSON API. Do I need to develop a JSON API if I use pure PHP code as back end?\u003c/p\u003e\u003c/li\u003e\n\u003c/ol\u003e\n\n\u003cp\u003eIf anything part is not clear, please reply in comment! Thanks a lot.\u003c/p\u003e","accepted_answer_id":"19914056","answer_count":"2","comment_count":"3","creation_date":"2013-11-11 18:12:19.81 UTC","last_activity_date":"2014-03-05 15:09:29.033 UTC","last_edit_date":"2017-05-23 12:06:22.393 UTC","last_editor_display_name":"","last_editor_user_id":"-1","owner_display_name":"","owner_user_id":"2646226","post_type_id":"1","score":"2","tags":"php|jquery|json|ember.js|ember-data","view_count":"1213"} {"id":"39867393","title":"Where to put third party JavaScript in my html document?","body":"\u003cp\u003e\u003ca href=\"https://css-tricks.com/async-attribute-scripts-bottom/\" rel=\"nofollow\"\u003eUseful Article\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eI read this article which suggest putting external javascript in the head section of html.\u003c/p\u003e\n\n\u003cp\u003eI am still confused if i have external async javascript, what is the best place to put it in my html? head, end of body or exactly where?\u003c/p\u003e\n\n\u003cp\u003eIt would be great if someone can suggest me best place along with the reason.\u003c/p\u003e","answer_count":"0","comment_count":"2","creation_date":"2016-10-05 07:02:14.967 UTC","last_activity_date":"2016-10-05 07:48:46.22 UTC","last_edit_date":"2016-10-05 07:48:46.22 UTC","last_editor_display_name":"","last_editor_user_id":"6249864","owner_display_name":"","owner_user_id":"5285062","post_type_id":"1","score":"0","tags":"javascript|asynchronous","view_count":"28"} {"id":"12821609","title":"Make ASP.Net (C#) Web App Available Offline","body":"\u003cp\u003eI have been tasked with making my company's Web App available offline. Before I move to the actual development phase, I want to be sure that my current strategy will not turn out to be a bust. \u003c/p\u003e\n\n\u003cp\u003eI first thought about using html5 app cache but after doing some tests I found that it seems to not cache the server side operations but the actual html that is rendered (Please correct me if I'm wrong). This will not work because the rendered html depends upon who is currently logged in. From my tests, it always rendered the html as if the last person that logged in (online) is logging in.\u003c/p\u003e\n\n\u003cp\u003eMy current strategy is this:\nI cache only the login page and an offline (.html) page to correspond to each aspx page that will need to be available offline. Every successful login (online) results in creating or updating Web SQL Database or IndexDB (depending on browser) with all data needed for that person to operate offline including a table that will be used for login credentials. In this way the only requirement for logging in offline is logging in with your login credentials at least one time.\u003c/p\u003e\n\n\u003cp\u003eMy concern is that I am overcomplicating it. In order to make this work, I will need to create an html page for each current page (a lot of pages) and I will have to rewrite everything that is currently being done on the server in JavaScript including validation, database calls, populating controls such as dropdown lists and data grids, etc. Also everything that I change in the future will require a subsequent offline change.\u003c/p\u003e\n\n\u003cp\u003eIs there an established best practice for what I am trying to do that I am overlooking or am I venturing into new ground?\u003c/p\u003e","answer_count":"1","comment_count":"3","creation_date":"2012-10-10 14:19:05.043 UTC","favorite_count":"3","last_activity_date":"2012-10-15 09:25:56.613 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1569817","post_type_id":"1","score":"6","tags":"asp.net|html5|web-applications|html5-appcache|offline-web-app","view_count":"2835"} -{"id":"17163652","title":"MasterPages and relative url issue","body":"\u003cp\u003eI have a masterpage on which I have included a search bar. i retrieve the record with the ajax method. the problem now is that when I navigate accross the pages the context of the relative path changes. because some pages are in different folders. I have used this url\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e url: \"WebServiceSearchUsers.asmx/SearchUser\",\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ebut this is not suitable method. Now how to write this code to fix the relative path issue. I don't want to use absolute path.\u003c/p\u003e","accepted_answer_id":"17163788","answer_count":"1","comment_count":"0","creation_date":"2013-06-18 08:07:41.72 UTC","last_activity_date":"2013-06-18 08:15:58.26 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"2277002","post_type_id":"1","score":"0","tags":"asp.net|url|navigation|master-pages","view_count":"40"} +{"id":"17163652","title":"ClusterManagerPages and relative url issue","body":"\u003cp\u003eI have a clustermanagerpage on which I have included a search bar. i retrieve the record with the ajax method. the problem now is that when I navigate accross the pages the context of the relative path changes. because some pages are in different folders. I have used this url\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e url: \"WebServiceSearchUsers.asmx/SearchUser\",\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ebut this is not suitable method. Now how to write this code to fix the relative path issue. I don't want to use absolute path.\u003c/p\u003e","accepted_answer_id":"17163788","answer_count":"1","comment_count":"0","creation_date":"2013-06-18 08:07:41.72 UTC","last_activity_date":"2013-06-18 08:15:58.26 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"2277002","post_type_id":"1","score":"0","tags":"asp.net|url|navigation|cluster-manager-pages","view_count":"40"} {"id":"8251237","title":"How do I create a canvas element in Dart?","body":"\u003cp\u003eI want to create a canvas element that I can add to an html document. The Dart recommendations seem to be to use \u003ccode\u003edart:html\u003c/code\u003e rather then \u003ccode\u003edart:dom\u003c/code\u003e, but as far as I can see, \u003ccode\u003edart:html\u003c/code\u003e only contains an interface definition for a \u003ccode\u003eCanvasElement\u003c/code\u003e interface, not a class.\u003c/p\u003e\n\n\u003cp\u003eHow do I instantiate a canvas object?\u003c/p\u003e","accepted_answer_id":"8251570","answer_count":"2","comment_count":"0","creation_date":"2011-11-24 01:25:33.88 UTC","last_activity_date":"2011-12-10 04:05:23.877 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"41742","post_type_id":"1","score":"11","tags":"html|canvas|dart","view_count":"1904"} {"id":"22033664","title":"how to dynamically add labels to my checklist in jquery","body":"\u003cp\u003eI want to populate my checklist from an array dynamically. How should I populate the values and labels for this checklist using jquery/javascript? \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;div class=\"container\" id=\"check\"\u0026gt;\n \u0026lt;input type=\"checkbox\" value= array[0]/\u0026gt; \u0026lt;label\u0026gt;\u0026lt;/label\u0026gt;\n \u0026lt;input type=\"checkbox\" value= array[1]/\u0026gt; \u0026lt;label\u0026gt;\u0026lt;/label\u0026gt;\n \u0026lt;input type=\"checkbox\" value= array[2]/\u0026gt; \u0026lt;label\u0026gt;\u0026lt;/label\u0026gt;\n\u0026lt;/div\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHow to populate the label tag with the elements of the array?\u003c/p\u003e","accepted_answer_id":"22033808","answer_count":"2","comment_count":"2","creation_date":"2014-02-26 06:37:05.11 UTC","last_activity_date":"2014-02-26 06:46:05.2 UTC","last_edit_date":"2014-02-26 06:42:14.913 UTC","last_editor_display_name":"","last_editor_user_id":"2307753","owner_display_name":"","owner_user_id":"1694364","post_type_id":"1","score":"0","tags":"javascript|jquery|html|dynamic|checkboxlist","view_count":"370"} {"id":"27662542","title":"Instantiating various inherited classes through one method, without reflection","body":"\u003cp\u003eIn a project I'm working on, I have a set of blocks that make up a 3D voxel based environment (like Minecraft). These worlds are stored in an external data file.\u003c/p\u003e\n\n\u003cp\u003eThis file contains the data for:\nEach block,\nits location,\nand its type.\u003c/p\u003e\n\n\u003cp\u003eWhen the LoadLevel method is called, I want it to iterate over the data for every block in the file, creating a new instance of the Block object for every one. It's no problem to pass things like location. It's as simple as\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eCreateBlock(Vector3 position)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe issue is with the type. All types are child classes (think Abstract Block, and then subtypes like GrassBlock or WaterBlock that inherit the abstract Block's properties.) Assuming there's a child class like \"GrassBlock\" that I want to be created, rather than a generic block, how do I make it do this through the method? The only way I know of is through reflection, which I've been advised to stay away from. Is it possible that I can do this through generic typing or something?\u003c/p\u003e\n\n\u003cp\u003eThis seems like such an important question in game design, but no one I've asked seems to have any idea. Any help?\u003c/p\u003e","accepted_answer_id":"27662594","answer_count":"4","comment_count":"3","creation_date":"2014-12-26 22:19:21.39 UTC","last_activity_date":"2014-12-26 23:29:53.62 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"3097154","post_type_id":"1","score":"0","tags":"c#|reflection|polymorphism|abstract-class","view_count":"93"} @@ -1842,7 +1842,7 @@ {"id":"35169375","title":"How to check if two drawString() strings intersect?","body":"\u003cp\u003eLike the title says, I need to see if two string locations intersect before drawing them with graphics2d. This way I don't have strings over each other so you can't read them. \u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eSome details:\u003c/strong\u003e \u003c/p\u003e\n\n\u003cp\u003eScreen size is 1000x1000 px. I am randomly generating coordinate locations and fonts at a fixed interval of 10 miliseconds. Then (also every 10 miliseconds) I use g2d.drawString() to draw the word \"popup!\" to the screen in my paintComponent() method with the random fonts and random locations I store previously. However, since I am randomly generating coordinates, this means that ocasionally I have the messages overlap. How can I ensure that this wont happen by either not allowing it to generate the coordinates that overlap or by not printing messages that overlap? \u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eCode:\u003c/strong\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eFont[] popups = new Font[20];\nint[][] popupsLoc = new int[20][2];\nRandom rn = new Random();\npublic void addPopup() { //is being called every 10 miliseconds by timer \n boolean needPopup = false;\n int where = 0;\n for(int i = 0; i \u0026lt; popups.length; i++) {\n if(popups[i] == null) {\n needPopup = true;\n where = i;\n }\n }\n if(needPopup == true) {\n popups[where] = new Font(\"STENCIL\", Font.BOLD, rn.nextInt(100) + 10);\n popupsLoc[where][0] = rn.nextInt(800);\n popupsLoc[where][1] = rn.nextInt(800);\n }\n }\n} //in paintComponent() I iterate through the popups[] array and draw the element with the font\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003cstrong\u003ePaint Code:\u003c/strong\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epublic void paintComponent(Graphics g) {\n super.paintComponent(g);\n\n setBackground(Color.BLACK);\n Graphics2D g2d = (Graphics2D) g;\n\n\n for(int i = 0; i \u0026lt; popups.length; i++) {\n if(popups[i] != null) {\n g2d.setColor(popupColor);\n g2d.setFont(popups[i]);\n g2d.drawString(\"Popup!\", popupsLoc[i][0], popupsLoc[i][1]);\n }\n }\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003cstrong\u003eExample\u003c/strong\u003e\n\u003ca href=\"https://i.stack.imgur.com/fUTer.png\" rel=\"nofollow noreferrer\"\u003e\u003cimg src=\"https://i.stack.imgur.com/fUTer.png\" alt=\"enter image description here\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eAs you can see, two of the messages are overlapping here in the bottom right of the screen. How can I prevent that?\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eEdit:\u003c/strong\u003e I have found a very simple solution.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epublic void addPopup() {\n\n boolean needPopup = false;\n int where = 0;\n for (int i = 0; i \u0026lt; popups.length; i++) {\n\n if (popups[i] == null) {\n needPopup = true;\n where = i;\n }\n }\n if (needPopup == true) {\n boolean doesIntersect = false;\n popups[where] = new Font(\"STENCIL\", Font.BOLD, rn.nextInt(100) + 10);\n popupsLoc[where][0] = rn.nextInt(800);\n popupsLoc[where][1] = rn.nextInt(800);\n\n FontMetrics metrics = getFontMetrics(popups[where]);\n int hgt = metrics.getHeight();\n int wdh = metrics.stringWidth(\"Popup!\");\n popupsHitbox[where] = new Rectangle(popupsLoc[where][0], popupsLoc[where][1], wdh, hgt);\n //System.out.println(hgt);\n\n for (int i = where + 1; i \u0026lt; popups.length; i++) {\n if (popupsHitbox[i] != null) {\n if (popupsHitbox[where].intersects(popupsHitbox[i]))\n doesIntersect = true;\n\n }\n }\n if (doesIntersect == true) {\n popups[where] = null;\n popupsLoc[where][0] = 0;\n popupsLoc[where][1] = 0;\n popupsHitbox[where] = null;\n addPopup();\n }\n }\n\n }\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThen when I draw:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003efor (int i = 0; i \u0026lt; popups.length; i++) {\n if (popups[i] != null) {\n g2d.setColor(popupColor);\n g2d.setFont(popups[i]);\n FontMetrics metrics = getFontMetrics(popups[i]);\n g2d.drawString(\"Popup!\", popupsLoc[i][0], popupsLoc[i][1]+metrics.getHeight());\n //g2d.draw(popupsHitbox[i]);\n }\n }\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe explanation is this: When I create a popup font/coord location, I also create a rectangle \"hitbox\" using the coord location and FontMetrics to get the size the message will be in pixels, then I store this rectangle to an array. After that, I have a boolean flag called doesIntersect which is initalized to false. I loop through all the hitboxes and check if the current one intersects() with any others. If so, I set the flag to true. Then, after it checks, if the flag is true it resets that location in the array to null and recalls addPopup(). (There could be some recursion here) Finally, when I paint I just draw the string at the coordinate location, (with y+height since strings paint from bottom left). May not be very clean, but it works. \u003c/p\u003e","answer_count":"1","comment_count":"10","creation_date":"2016-02-03 05:45:16.993 UTC","last_activity_date":"2016-02-15 06:44:14.287 UTC","last_edit_date":"2016-02-04 00:38:19.443 UTC","last_editor_display_name":"","last_editor_user_id":"4484072","owner_display_name":"","owner_user_id":"4484072","post_type_id":"1","score":"1","tags":"java|swing|graphics|awt|java-2d","view_count":"125"} {"id":"27548193","title":"ggplot2 continous values for discrete scale","body":"\u003cp\u003eI have a data.table formated like this (but bigger) and named data3 :\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e V1 V2 V3 V4 V5\n1 6 1 50000000 100000000 0.000000e+00\n2 5 1 50000000 100000000 0.000000e+00\n3 4 1 50000000 100000000 0.000000e+00\n4 3 1 50000000 100000000 0.000000e+00\n5 2 1 50000000 100000000 7.407407e-01\n6 1 1 50000000 100000000 5.925926e+00\n7 -1 1 50000000 100000000 -4.370370e+01\n8 -2 1 50000000 100000000 -7.407407e-01\n9 6 1 150000000 100000000 0.000000e+00\n10 5 1 150000000 100000000 0.000000e+00\n11 4 1 150000000 100000000 0.000000e+00\n12 3 1 150000000 100000000 0.000000e+00\n13 2 1 150000000 100000000 3.703704e+00\n14 1 1 150000000 100000000 5.925926e+00\n15 -1 1 150000000 100000000 -1.481481e+01\n16 -2 1 150000000 100000000 0.000000e+00\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI separated positive and negative values with :\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003esubdat1=subset(data3, V1\u0026gt;0)\nsubdat2=subset(data3, V1\u0026lt;0)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI made an histogram using this code :\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eggplot(data=data3) + \n facet_grid(~V2, space=\"free_x\", scales=\"free_x\", labeller=label_value)+ \n theme(axis.text.x=element_blank(), axis.ticks=element_blank(), axis.title.x=element_blank()) +\n geom_hline(yintercept=0, colour=\"red\", size=1) + \n geom_bar(data=subdat1,aes(x=V3, y=V5, fill=V1, width=V4), stat=\"identity\")+\n geom_bar(data=subdat2,aes(x=V3, y=V5, fill=V1, width=V4), stat=\"identity\") + \n guides(fill=guide_legend(title=\"CNV\"))\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAnd I obtained something close to what I want :\n\u003cimg src=\"https://i.stack.imgur.com/AHYGR.png\" alt=\"enter image description here\"\u003e\u003c/p\u003e\n\n\u003cp\u003eBut legend is not discrete (one color per value of V1) and is not in good order.\nSo I tryed this :\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eggplot(data=data3)+ \n facet_grid(~V2, space=\"free_x\", scales=\"free_x\", labeller=label_value)+\n theme(axis.text.x=element_blank(), axis.ticks=element_blank(), axis.title.x=element_blank()) +\n geom_hline(yintercept=0, colour=\"red\", size=1) + \n geom_bar(data=subdat1,aes(x=V3, y=V5, fill=V1, width=V4), stat=\"identity\")+\n geom_bar(data=subdat2,aes(x=V3, y=V5, fill=V1, width=V4), stat=\"identity\") + \n guides(fill=guide_legend(title=\"CNV\"))+\n scale_colour_gradient(trans=\"identity\")\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ebut had the following error :\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eErreur : Continuous value supplied to discrete scale\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI thus tried this, to transform values and use discrete levels :\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003esubdat1$V1 \u0026lt;- factor(subdat1$V1, levels = rev(levels(factor(subdat1$V1))))\nsubdat2$V1 \u0026lt;- factor(subdat2$V1, levels = levels(factor(subdat2$V1)))\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eand tried again the ggplot but I had this error now :\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eErreur dans unit(tic_pos.c, \"mm\") : 'x' and 'units' must have length \u0026gt; 0\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAnd I have no more idea....\u003cbr\u003e\nHelp would be greatly appreciated !\u003c/p\u003e\n\n\u003cp\u003eEDIT :\nI just tried again with :\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eggplot(data=data3)+ \n facet_grid(~V2, space=\"free_x\", scales=\"free_x\", labeller=label_value)+ \n theme(axis.text.x=element_blank(), axis.ticks=element_blank(), axis.title.x=element_blank())+ \n geom_hline(yintercept=0, colour=\"red\", size=1)+ \n geom_bar(data=subdat1,aes(x=V3, y=V5, fill=V1, width=V4), stat=\"identity\")+ \n geom_bar(data=subdat2,aes(x=V3, y=V5, fill=V1, width=V4), stat=\"identity\")+ \n guides(fill=guide_legend(title=\"CNV\"))\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eand succeed to obtain :\u003c/p\u003e\n\n\u003cp\u003e\u003cimg src=\"https://i.stack.imgur.com/dZ0vq.png\" alt=\"enter image description here\"\u003e\u003c/p\u003e\n\n\u003cp\u003eSo, I am getting closer.\nHow could I just inverse not only the legend, but also the order in the upper histogram ?\u003c/p\u003e","answer_count":"1","comment_count":"6","creation_date":"2014-12-18 13:53:22.64 UTC","last_activity_date":"2014-12-18 14:55:58.803 UTC","last_edit_date":"2014-12-18 14:55:58.803 UTC","last_editor_display_name":"","last_editor_user_id":"3573401","owner_display_name":"","owner_user_id":"3058063","post_type_id":"1","score":"0","tags":"r|ggplot2","view_count":"420"} {"id":"12949358","title":"how to get latest 'n' updated row from a table","body":"\u003cblockquote\u003e\n \u003cp\u003e\u003cstrong\u003ePossible Duplicate:\u003c/strong\u003e\u003cbr\u003e\n \u003ca href=\"https://stackoverflow.com/questions/2306744/oracle-sql-how-to-retrieve-highest-5-values-of-a-column\"\u003eOracle SQL - How to Retrieve highest 5 values of a column\u003c/a\u003e \u003c/p\u003e\n\u003c/blockquote\u003e\n\n\n\n\u003cp\u003ei have a table abc, where i have following columns\u003c/p\u003e\n\n\u003cp\u003e\u003ccode\u003eact_id,cust_id,lastUpdatedDate,custActivity\u003c/code\u003e. Where \u003cstrong\u003eact_id is primary key\u003c/strong\u003e .\u003c/p\u003e\n\n\u003cp\u003elastUpdatedDate store last activity done for this customer.\u003c/p\u003e\n\n\u003cp\u003ei am trying to get latest 10 rows for given custid based on lastUpdatedDate.\u003c/p\u003e\n\n\u003cp\u003eHow can i achieve it.\u003c/p\u003e\n\n\u003cp\u003e-vivek\u003c/p\u003e","accepted_answer_id":"12949427","answer_count":"3","comment_count":"0","creation_date":"2012-10-18 07:30:35.7 UTC","last_activity_date":"2012-10-18 08:12:14.807 UTC","last_edit_date":"2017-05-23 12:18:51.213 UTC","last_editor_display_name":"","last_editor_user_id":"-1","owner_display_name":"","owner_user_id":"517066","post_type_id":"1","score":"1","tags":"sql|oracle|oracle10g|top-n","view_count":"203"} -{"id":"38868666","title":"MySQL The table is full on query","body":"\u003cp\u003eI can't find the source of the issue on our Master/Slave replication .\u003c/p\u003e\n\n\u003cp\u003eToday i was updating the Master and suddenly got the following error from the slave\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eError 'The table 'caching_api' is full' on query.\n\nQuery: '\nALTER TABLE `caching_api`\nADD UNIQUE INDEX `id` (`id`) USING BTREE ,\nADD INDEX `search` (`component`, `method`) USING BTREE \n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eIt's not a disk issue , the Slave is an exact replicate of the Master \u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"https://i.stack.imgur.com/NaPil.jpg\" rel=\"nofollow noreferrer\"\u003e\u003cimg src=\"https://i.stack.imgur.com/NaPil.jpg\" alt=\"enter image description here\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"https://i.stack.imgur.com/gaZ5Y.jpg\" rel=\"nofollow noreferrer\"\u003e\u003cimg src=\"https://i.stack.imgur.com/gaZ5Y.jpg\" alt=\"enter image description here\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"https://i.stack.imgur.com/JyTmZ.jpg\" rel=\"nofollow noreferrer\"\u003e\u003cimg src=\"https://i.stack.imgur.com/JyTmZ.jpg\" alt=\"enter image description here\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eAnd my.cnf config :\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e[mysqld]\n#\n# * Basic Settings\n#\nuser = mysql\npid-file = /var/run/mysqld/mysqld.pid\nsocket = /var/run/mysqld/mysqld.sock\nport = 3306\nbasedir = /usr\ndatadir = /data/mysql\ntmpdir = /tmp\nlc-messages-dir = /usr/share/mysql\nskip-external-locking\n\nkey_buffer = 16M\nmax_allowed_packet = 128M\nthread_stack = 192K\nthread_cache_size = 64\n\ntable_open_cache = 3000\njoin_buffer_size = 128k\n\n# This replaces the startup script and checks MyISAM tables if needed\n# the first time they are touched\nmyisam-recover = BACKUP\nmax_connections = 4000\nwait_timeout = 150\ninteractive_timeout = 30\ninnodb_buffer_pool_size = 25G\ninnodb_log_file_size = 1G\n\ninnodb_buffer_pool_instances = 10\ntmp_table_size = 256M\nmax_heap_table_size = 256M\ninnodb_flush_log_at_trx_commit = 2\nquery_cache_limit = 64M\nquery_cache_size = 256M\nrelay_log_space_limit = 10G\nserver-id = 2\nrelay-log = /var/log/mysql/mysqld-relay-bin\nexpire_logs_days = 1\nmax_binlog_size = 100M\nslave-skip-errors = 1062,1054\n\n[mysqldump]\nquick\nquote-names\n\n\n[mysql]\n#no-auto-rehash # faster start of mysql but no tab completition\n\n[isamchk]\nkey_buffer = 16M\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003cstrong\u003eUpdate to questions from comments :\u003c/strong\u003e\n\u003ca href=\"https://i.stack.imgur.com/HHrro.jpg\" rel=\"nofollow noreferrer\"\u003e\u003cimg src=\"https://i.stack.imgur.com/HHrro.jpg\" alt=\"enter image description here\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"https://i.stack.imgur.com/0smEC.jpg\" rel=\"nofollow noreferrer\"\u003e\u003cimg src=\"https://i.stack.imgur.com/0smEC.jpg\" alt=\"enter image description here\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"https://i.stack.imgur.com/OfnQT.jpg\" rel=\"nofollow noreferrer\"\u003e\u003cimg src=\"https://i.stack.imgur.com/OfnQT.jpg\" alt=\"enter image description here\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eWhen i try to run the query directly on the SLAVE :\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"https://i.stack.imgur.com/xf3E9.jpg\" rel=\"nofollow noreferrer\"\u003e\u003cimg src=\"https://i.stack.imgur.com/xf3E9.jpg\" alt=\"enter image description here\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003ecaching_api table status\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"https://i.stack.imgur.com/CTHP2.jpg\" rel=\"nofollow noreferrer\"\u003e\u003cimg src=\"https://i.stack.imgur.com/CTHP2.jpg\" alt=\"enter image description here\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eSlave Disk Info\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"https://i.stack.imgur.com/zUZLI.jpg\" rel=\"nofollow noreferrer\"\u003e\u003cimg src=\"https://i.stack.imgur.com/zUZLI.jpg\" alt=\"enter image description here\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eibdata1 about 36GB\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"https://i.stack.imgur.com/BR3QV.jpg\" rel=\"nofollow noreferrer\"\u003e\u003cimg src=\"https://i.stack.imgur.com/BR3QV.jpg\" alt=\"enter image description here\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eulimit -a\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"https://i.stack.imgur.com/BX9JF.jpg\" rel=\"nofollow noreferrer\"\u003e\u003cimg src=\"https://i.stack.imgur.com/BX9JF.jpg\" alt=\"enter image description here\"\u003e\u003c/a\u003e\u003c/p\u003e","answer_count":"1","comment_count":"18","creation_date":"2016-08-10 08:59:39.72 UTC","last_activity_date":"2016-08-11 06:45:36.317 UTC","last_edit_date":"2016-08-11 06:45:36.317 UTC","last_editor_display_name":"","last_editor_user_id":"503412","owner_display_name":"","owner_user_id":"503412","post_type_id":"1","score":"0","tags":"mysql|database-replication","view_count":"272"} +{"id":"38868666","title":"MySQL The table is full on query","body":"\u003cp\u003eI can't find the source of the issue on our ClusterManager/Slave replication .\u003c/p\u003e\n\n\u003cp\u003eToday i was updating the Cluster Manager and suddenly got the following error from the slave\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eError 'The table 'caching_api' is full' on query.\n\nQuery: '\nALTER TABLE `caching_api`\nADD UNIQUE INDEX `id` (`id`) USING BTREE ,\nADD INDEX `search` (`component`, `method`) USING BTREE \n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eIt's not a disk issue , the Slave is an exact replicate of the Cluster Manager \u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"https://i.stack.imgur.com/NaPil.jpg\" rel=\"nofollow noreferrer\"\u003e\u003cimg src=\"https://i.stack.imgur.com/NaPil.jpg\" alt=\"enter image description here\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"https://i.stack.imgur.com/gaZ5Y.jpg\" rel=\"nofollow noreferrer\"\u003e\u003cimg src=\"https://i.stack.imgur.com/gaZ5Y.jpg\" alt=\"enter image description here\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"https://i.stack.imgur.com/JyTmZ.jpg\" rel=\"nofollow noreferrer\"\u003e\u003cimg src=\"https://i.stack.imgur.com/JyTmZ.jpg\" alt=\"enter image description here\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eAnd my.cnf config :\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e[mysqld]\n#\n# * Basic Settings\n#\nuser = mysql\npid-file = /var/run/mysqld/mysqld.pid\nsocket = /var/run/mysqld/mysqld.sock\nport = 3306\nbasedir = /usr\ndatadir = /data/mysql\ntmpdir = /tmp\nlc-messages-dir = /usr/share/mysql\nskip-external-locking\n\nkey_buffer = 16M\nmax_allowed_packet = 128M\nthread_stack = 192K\nthread_cache_size = 64\n\ntable_open_cache = 3000\njoin_buffer_size = 128k\n\n# This replaces the startup script and checks MyISAM tables if needed\n# the first time they are touched\nmyisam-recover = BACKUP\nmax_connections = 4000\nwait_timeout = 150\ninteractive_timeout = 30\ninnodb_buffer_pool_size = 25G\ninnodb_log_file_size = 1G\n\ninnodb_buffer_pool_instances = 10\ntmp_table_size = 256M\nmax_heap_table_size = 256M\ninnodb_flush_log_at_trx_commit = 2\nquery_cache_limit = 64M\nquery_cache_size = 256M\nrelay_log_space_limit = 10G\nserver-id = 2\nrelay-log = /var/log/mysql/mysqld-relay-bin\nexpire_logs_days = 1\nmax_binlog_size = 100M\nslave-skip-errors = 1062,1054\n\n[mysqldump]\nquick\nquote-names\n\n\n[mysql]\n#no-auto-rehash # faster start of mysql but no tab completition\n\n[isamchk]\nkey_buffer = 16M\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003cstrong\u003eUpdate to questions from comments :\u003c/strong\u003e\n\u003ca href=\"https://i.stack.imgur.com/HHrro.jpg\" rel=\"nofollow noreferrer\"\u003e\u003cimg src=\"https://i.stack.imgur.com/HHrro.jpg\" alt=\"enter image description here\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"https://i.stack.imgur.com/0smEC.jpg\" rel=\"nofollow noreferrer\"\u003e\u003cimg src=\"https://i.stack.imgur.com/0smEC.jpg\" alt=\"enter image description here\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"https://i.stack.imgur.com/OfnQT.jpg\" rel=\"nofollow noreferrer\"\u003e\u003cimg src=\"https://i.stack.imgur.com/OfnQT.jpg\" alt=\"enter image description here\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eWhen i try to run the query directly on the SLAVE :\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"https://i.stack.imgur.com/xf3E9.jpg\" rel=\"nofollow noreferrer\"\u003e\u003cimg src=\"https://i.stack.imgur.com/xf3E9.jpg\" alt=\"enter image description here\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003ecaching_api table status\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"https://i.stack.imgur.com/CTHP2.jpg\" rel=\"nofollow noreferrer\"\u003e\u003cimg src=\"https://i.stack.imgur.com/CTHP2.jpg\" alt=\"enter image description here\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eSlave Disk Info\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"https://i.stack.imgur.com/zUZLI.jpg\" rel=\"nofollow noreferrer\"\u003e\u003cimg src=\"https://i.stack.imgur.com/zUZLI.jpg\" alt=\"enter image description here\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eibdata1 about 36GB\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"https://i.stack.imgur.com/BR3QV.jpg\" rel=\"nofollow noreferrer\"\u003e\u003cimg src=\"https://i.stack.imgur.com/BR3QV.jpg\" alt=\"enter image description here\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eulimit -a\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"https://i.stack.imgur.com/BX9JF.jpg\" rel=\"nofollow noreferrer\"\u003e\u003cimg src=\"https://i.stack.imgur.com/BX9JF.jpg\" alt=\"enter image description here\"\u003e\u003c/a\u003e\u003c/p\u003e","answer_count":"1","comment_count":"18","creation_date":"2016-08-10 08:59:39.72 UTC","last_activity_date":"2016-08-11 06:45:36.317 UTC","last_edit_date":"2016-08-11 06:45:36.317 UTC","last_editor_display_name":"","last_editor_user_id":"503412","owner_display_name":"","owner_user_id":"503412","post_type_id":"1","score":"0","tags":"mysql|database-replication","view_count":"272"} {"id":"44537344","title":"How can I add/substract an integer to every value of an dictionary in Python?","body":"\u003cp\u003eAs the title indicates, i have a dictionary that looks like similar to this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003edic = {0: 3.2, 1: 3.7, 2: 4.2, 3: 4.7, 4: 5.2, 5: 5.7}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI now want to add or substract an integer value to every value from the dic, but my simple attempt \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003edic.values() = dic.values() + 1\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003edidn't work, since we use the .values() function here. Is there a fast and simple way to modify every value of an dictionary in Python?\u003c/p\u003e","accepted_answer_id":"44537368","answer_count":"3","comment_count":"0","creation_date":"2017-06-14 06:44:37.243 UTC","favorite_count":"0","last_activity_date":"2017-06-14 07:00:19.2 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"5097398","post_type_id":"1","score":"0","tags":"python|dictionary","view_count":"38"} {"id":"45884971","title":"Laravel: how to get nested models","body":"\u003cp\u003eCould not you to direct me in right way.\u003c/p\u003e\n\n\u003cp\u003eI have four models: \u003ccode\u003e\"Item\"\u003c/code\u003e belongs to several \u003ccode\u003e\"Category\"\u003c/code\u003e belongs to \u003ccode\u003e\"Shop\"\u003c/code\u003e belongs to \"City\"\u003c/p\u003e\n\n\u003cp\u003eHow can i select Item with all nested models (for json response, for example, it is not important).\u003c/p\u003e\n\n\u003cp\u003eIn other words, i want to get sctructure like that:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e item\n category_1\n shop_1\n shop_2\n city_1\n category_2\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI able to get categories by \u003ccode\u003e$item-\u0026gt;with('categories')\u003c/code\u003e statement, but how i can get nested items in \u003ccode\u003ecategory\u003c/code\u003e (\u003ccode\u003eshops\u003c/code\u003e, and then - \u003ccode\u003ecities\u003c/code\u003e).\u003c/p\u003e\n\n\u003cp\u003eThank you for your help!\u003c/p\u003e","accepted_answer_id":"45885103","answer_count":"1","comment_count":"0","creation_date":"2017-08-25 15:38:19.333 UTC","last_activity_date":"2017-08-25 15:46:41.95 UTC","last_edit_date":"2017-08-25 15:43:04.04 UTC","last_editor_display_name":"","last_editor_user_id":"5436458","owner_display_name":"","owner_user_id":"2822389","post_type_id":"1","score":"3","tags":"php|laravel|nested|models","view_count":"40"} {"id":"27729499","title":"Not able to display text below icon on button","body":"\u003cp\u003e\u003cimg src=\"https://i.stack.imgur.com/v82cx.png\" alt=\"enter image description here\"\u003eI want to display text below each image but i am not able to do this how i set this?\nthrough this coding i get my text side by side to my image but i want to display it below image.\u003c/p\u003e\n\n\u003cp\u003ehow i get text exact below of my icon.\u003c/p\u003e\n\n\u003cp\u003ethis is my xml.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n xmlns:tools=\"http://schemas.android.com/tools\"\n android:id=\"@+id/rl\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"match_parent\"\n android:background=\"#FFFFFF\"\n android:paddingBottom=\"@dimen/activity_vertical_margin\"\n android:paddingTop=\"@dimen/activity_vertical_margin\"\n tools:context=\".MainActivity\" \u0026gt;\n\n \u0026lt;TextView\n android:layout_width=\"match_parent\"\n android:layout_height=\"wrap_content\"\n android:background=\"#2F4F4F\"\n android:gravity=\"center\"\n android:text=\"Select Drinks\"\n android:textColor=\"#FFFFFF\" /\u0026gt;\n\n \u0026lt;LinearLayout\n android:id=\"@+id/ll1\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"wrap_content\"\n android:layout_marginTop=\"@dimen/activity_button_margin_top\"\n android:background=\"#ffffff\"\n android:paddingLeft=\"@dimen/activity_horizontal_margin\"\n android:paddingRight=\"@dimen/activity_horizontal_margin\"\n android:weightSum=\"2\" \u0026gt;\n\n \u0026lt;LinearLayout\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"\n android:layout_marginTop=\"@dimen/activity_button_margin_top\"\n android:background=\"@android:drawable/btn_default\"\n android:clickable=\"true\" \u0026gt;\n\n \u0026lt;ImageView\n android:id=\"@+id/imgfirst\"\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"\n android:layout_gravity=\"center_vertical\"\n android:layout_marginLeft=\"15dp\"\n android:src=\"@drawable/beer_cider\" /\u0026gt;\n\n \u0026lt;TextView\n android:id=\"@+id/txt_beer\"\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"\n android:layout_gravity=\"center_vertical\"\n android:text=\"Do stuff\" /\u0026gt;\n \u0026lt;/LinearLayout\u0026gt;\n\n \u0026lt;LinearLayout\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"\n android:layout_marginLeft=\"10dp\"\n android:layout_marginTop=\"@dimen/activity_button_margin_top\"\n android:background=\"@android:drawable/btn_default\"\n android:clickable=\"true\" \u0026gt;\n\n \u0026lt;ImageView\n android:id=\"@+id/imgsecond\"\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"\n android:layout_gravity=\"center_vertical\"\n android:layout_marginLeft=\"15dp\"\n android:src=\"@drawable/wine_champagne\" /\u0026gt;\n\n \u0026lt;TextView\n android:id=\"@+id/txtwine\"\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"\n android:layout_gravity=\"center_vertical\"\n android:text=\"Do stuff\" /\u0026gt;\n \u0026lt;/LinearLayout\u0026gt;\n \u0026lt;/LinearLayout\u0026gt;\n\n \u0026lt;RelativeLayout\n android:layout_width=\"match_parent\"\n android:layout_height=\"wrap_content\"\n android:layout_below=\"@+id/ll1\" \u0026gt;\n\n \u0026lt;LinearLayout\n android:id=\"@+id/ll2\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"wrap_content\"\n android:layout_marginTop=\"@dimen/activity_button_margin_top\"\n android:background=\"#ffffff\"\n android:paddingLeft=\"@dimen/activity_horizontal_margin\"\n android:paddingRight=\"@dimen/activity_horizontal_margin\"\n android:weightSum=\"2\" \u0026gt;\n\n \u0026lt;LinearLayout\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"\n android:layout_marginTop=\"@dimen/activity_button_margin_top\"\n android:background=\"@android:drawable/btn_default\"\n android:clickable=\"true\" \u0026gt;\n\n \u0026lt;ImageView\n android:id=\"@+id/imgthird\"\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"\n android:layout_gravity=\"center_vertical\"\n android:layout_marginLeft=\"15dp\"\n android:src=\"@drawable/spirits_shots\" /\u0026gt;\n\n \u0026lt;TextView\n android:id=\"@+id/txt_spirits\"\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"\n android:layout_gravity=\"center_vertical\"\n android:text=\"Do stuff\" /\u0026gt;\n \u0026lt;/LinearLayout\u0026gt;\n\n \u0026lt;LinearLayout\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"\n android:layout_marginLeft=\"10dp\"\n android:layout_marginTop=\"@dimen/activity_button_margin_top\"\n android:background=\"@android:drawable/btn_default\"\n android:clickable=\"true\" \u0026gt;\n\n \u0026lt;ImageView\n android:id=\"@+id/imgforth\"\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"\n android:layout_gravity=\"center_vertical\"\n android:layout_marginLeft=\"15dp\"\n android:src=\"@drawable/other\" /\u0026gt;\n\n \u0026lt;TextView\n android:id=\"@+id/txtother\"\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"\n android:layout_gravity=\"center_vertical\"\n android:text=\"Do\" /\u0026gt;\n \u0026lt;/LinearLayout\u0026gt;\n \u0026lt;/LinearLayout\u0026gt;\n \u0026lt;/RelativeLayout\u0026gt;\n\n \u0026lt;RelativeLayout\n android:layout_width=\"match_parent\"\n android:layout_height=\"wrap_content\"\n android:layout_alignParentBottom=\"true\" \u0026gt;\n\n \u0026lt;LinearLayout\n android:id=\"@+id/ll3\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"wrap_content\"\n android:background=\"#cccccc\"\n android:weightSum=\"3\" \u0026gt;\n\n \u0026lt;LinearLayout\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"\n android:layout_marginTop=\"@dimen/activity_button_margin_top\"\n android:layout_weight=\"1\" \u0026gt;\n\n \u0026lt;ImageView\n android:id=\"@+id/imgfifth\"\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"\n android:layout_gravity=\"left\"\n android:layout_marginLeft=\"15dp\"\n android:src=\"@drawable/drink_icon\" /\u0026gt;\n \u0026lt;/LinearLayout\u0026gt;\n\n \u0026lt;LinearLayout\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"\n android:layout_marginLeft=\"10dp\"\n android:layout_marginTop=\"@dimen/activity_button_margin_top\"\n android:layout_weight=\"1\" \u0026gt;\n\n \u0026lt;ImageView\n android:id=\"@+id/imgsixth\"\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"\n android:layout_gravity=\"center_vertical\"\n android:layout_marginLeft=\"15dp\"\n android:src=\"@drawable/date_icon\" /\u0026gt;\n \u0026lt;/LinearLayout\u0026gt;\n\n \u0026lt;LinearLayout\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"\n android:layout_marginLeft=\"10dp\"\n android:layout_marginTop=\"@dimen/activity_button_margin_top\"\n android:layout_weight=\"1\" \u0026gt;\n\n \u0026lt;ImageView\n android:id=\"@+id/imgseven\"\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"\n android:layout_marginLeft=\"15dp\"\n android:src=\"@drawable/info_icon\" /\u0026gt;\n \u0026lt;/LinearLayout\u0026gt;\n \u0026lt;/LinearLayout\u0026gt;\n \u0026lt;/RelativeLayout\u0026gt;\n\n\u0026lt;/RelativeLayout\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"3","comment_count":"5","creation_date":"2015-01-01 09:01:55.393 UTC","last_activity_date":"2015-01-01 10:19:59.613 UTC","last_edit_date":"2015-01-01 09:50:13.847 UTC","last_editor_display_name":"","last_editor_user_id":"3354610","owner_display_name":"","owner_user_id":"3354610","post_type_id":"1","score":"-1","tags":"android","view_count":"383"} @@ -1852,7 +1852,7 @@ {"id":"22090521","title":"How can an element of a string array be used as a variable of another string array in java?","body":"\u003cp\u003efor example i have following code\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eString[] subject = new String[6];\nsubject[1] = JOptionPane.showInputDialog(null, \"Enter subject\");\nString[] subject[1]=new String[6];\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eit will not work.There is any other way to do this?\u003c/p\u003e","answer_count":"3","comment_count":"0","creation_date":"2014-02-28 09:02:29.167 UTC","last_activity_date":"2014-02-28 09:51:53.537 UTC","last_edit_date":"2014-02-28 09:03:14.133 UTC","last_editor_display_name":"","last_editor_user_id":"515034","owner_display_name":"","owner_user_id":"3364012","post_type_id":"1","score":"0","tags":"java|arrays","view_count":"50"} {"id":"47175642","title":"How to Decouple Inheritence in Objective-C","body":"\u003cp\u003eWe have legacy code base and trying to modularise it. Idea is to create frameworks out of individual modules. But these models have lot of dependencies. \u003c/p\u003e\n\n\u003cp\u003eWe have a Base Class A, and two derived classes B and C. We wanted to build separate framework for B and C but not A. In-order to build the framework we had to copy A to B and C which we don't want, because A also has dependency on other classes.\u003c/p\u003e\n\n\u003cp\u003eHow do we seperate the classes so that framework B and C can be built.\u003c/p\u003e\n\n\u003cp\u003eI tried \u003c/p\u003e\n\n\u003col\u003e\n\u003cli\u003eMaking A as an instance of B, will solve half problem because when some other class refers B using A's Pointer it would not be able to access A's variables because B is not inherited from A.\u003c/li\u003e\n\u003cli\u003eTried using objective c runtime, but no luck there as well.\u003c/li\u003e\n\u003c/ol\u003e\n\n\u003cp\u003eSuggestions are required. \u003c/p\u003e\n\n\u003cp\u003eThanks,\nK.Prabhakar\u003c/p\u003e","answer_count":"0","comment_count":"1","creation_date":"2017-11-08 09:12:53.563 UTC","last_activity_date":"2017-11-09 13:35:05.507 UTC","last_edit_date":"2017-11-09 13:35:05.507 UTC","last_editor_display_name":"","last_editor_user_id":"5366426","owner_display_name":"","owner_user_id":"7105262","post_type_id":"1","score":"-2","tags":"objective-c|oop|design-patterns|objective-c-runtime","view_count":"24"} {"id":"45968849","title":"How to make Kendo-ui tabs load content (iframes with source as java controllers) on demand","body":"\u003cp\u003eI am very new to Kendo-ui. I have been working on creating a page which will have kendo-ui tabs. Each tab has got atleast one iframe which loads the content from the source (which are java controllers). Here is the trimmed version of my jsp\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;div class=\"demo-section k-content\"\u0026gt;\n \u0026lt;div id=\"tabstrip\"\u0026gt;\n \u0026lt;ul\u0026gt;\n \u0026lt;%} if(helpFlag.equals(\"true\") || helpFlag.equals(\"1\")) {%\u0026gt;\n \u0026lt;li\u0026gt;Help\u0026lt;/li\u0026gt;\n \u0026lt;%} if(materialsFlag.equals(\"true\") || materialsFlag.equals(\"1\")) {%\u0026gt;\n \u0026lt;li class=\"k-state-active\"\u0026gt;Materials\u0026lt;/li\u0026gt;\n \u0026lt;%}else{%\u0026gt;\n \u0026lt;script type=\"text/javascript\"\u0026gt;$(document).ready(function(){$(\"#tabstrip\").kendoTabStrip().data(\"kendoTabStrip\").select(0);});\u0026lt;/script\u0026gt;\n \u0026lt;%} if(jobsFlag.equals(\"true\") || jobsFlag.equals(\"1\")) {%\u0026gt;\n \u0026lt;li\u0026gt;Jobs\u0026lt;/li\u0026gt;\n \u0026lt;%} if(eProfileFlag.equals(\"true\") || eProfileFlag.equals(\"1\")) {%\u0026gt;\n \u0026lt;li\u0026gt;eProfile\u0026lt;/li\u0026gt;\n \u0026lt;%}%\u0026gt;\n \u0026lt;/ul\u0026gt;\n \u0026lt;%} if(helpFlag.equals(\"true\") || helpFlag.equals(\"1\")) {%\u0026gt;\n \u0026lt;div\u0026gt;\n \u0026lt;span class=\"\"\u0026gt;\u0026amp;nbsp;\u0026lt;/span\u0026gt;\n \u0026lt;table style=\"width: 100%;\"\u0026gt;\n \u0026lt;tr\u0026gt;\n \u0026lt;td style=\"\"\u0026gt;\n \u0026lt;div class=\"panelbar\"\u0026gt;\n \u0026lt;li class=\"k-state-active\" style=\"font-weight: bold;\"\u0026gt;Help\n \u0026lt;div class=\"tabBody\"\u0026gt;\n \u0026lt;iframe src=\"${pageContext.servletContext.contextPath}/help.do\"\n width=\"850px\" height=\"650px\"\u0026gt;\u0026lt;/iframe\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;/li\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;/td\u0026gt;\n \u0026lt;/tr\u0026gt;\n \u0026lt;/table\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;%} if(materialsFlag.equals(\"true\") || materialsFlag.equals(\"1\")) {%\u0026gt;\n \u0026lt;div\u0026gt;\n \u0026lt;span class=\"\"\u0026gt;\u0026amp;nbsp;\u0026lt;/span\u0026gt;\n \u0026lt;table style=\"width: 100%;\"\u0026gt;\n \u0026lt;tr\u0026gt;\n \u0026lt;td style=\"\"\u0026gt;\n \u0026lt;div class=\"panelbar\"\u0026gt;\n \u0026lt;li class=\"k-state-active\" style=\"font-weight: bold;\"\u0026gt;Materials\n \u0026lt;div class=\"panelBody\"\u0026gt;\n \u0026lt;img id=\"matloader\" src=\"../loading.gif\" width=\"36\" height=\"36\" alt=\"loading gif\"/\u0026gt;\n \u0026lt;iframe id=\"matFrame\" style=\"display:none;\" src=\"${pageContext.servletContext.contextPath}/materials.do\"\n width=\"100%\" height=\"500px\"\u0026gt;\u0026lt;/iframe\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;script\u0026gt;\n $(document).ready(function () {\n $('#matFrame').on('load', function () {\n $('#matFrame').show();\n $('#matloader').hide();\n });\n });\n \u0026lt;/script\u0026gt;\n \u0026lt;/li\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;/td\u0026gt;\n \u0026lt;td style=\"\"\u0026gt;\n \u0026lt;div class=\"panelbar\"\u0026gt;\n \u0026lt;li class=\"k-state-active\" style=\"font-weight: bold;\"\u0026gt;PURCHASING\n \u0026lt;div class=\"panelBody\"\u0026gt;\n \u0026lt;img id=\"purchasingloader\" src=\"../loading.gif\" width=\"36\" height=\"36\" alt=\"loading gif\"/\u0026gt;\n \u0026lt;iframe id=\"purchasingFrame\" style=\"display:none;\" src=\"${pageContext.servletContext.contextPath}/purch.do\"\n width=\"100%\" height=\"500px\"\u0026gt;\u0026lt;/iframe\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;script\u0026gt;\n $(document).ready(function () {\n $('#purchasingFrame').on('load', function () {\n $('#purchasingFrame').show();\n $('#purchasingloader').hide();\n });\n });\n \u0026lt;/script\u0026gt;\n \u0026lt;/li\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;/td\u0026gt;\n \u0026lt;/tr\u0026gt;\n \u0026lt;/table\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;%} if(jobsFlag.equals(\"true\") || jobsFlag.equals(\"1\")) {%\u0026gt;\n \u0026lt;div\u0026gt;\n \u0026lt;span class=\"\"\u0026gt;\u0026amp;nbsp;\u0026lt;/span\u0026gt;\n \u0026lt;div class=\"jobs\"\u0026gt;\n \u0026lt;div class=\"panelbar\"\u0026gt;\n \u0026lt;li class=\"k-state-active\" style=\"font-weight: bold;\"\u0026gt;Jobs\n \u0026lt;div class=\"panelBody\"\u0026gt;\n \u0026lt;img id=\"loader1\" src=\"../loading.gif\" width=\"36\" height=\"36\" alt=\"loading gif\"/\u0026gt;\n \u0026lt;iframe id=\"jobsFrame\" style=\"display:none;\" src=\"${pageContext.servletContext.contextPath}/jobs.do\"\n width=\"100%\" height=\"500px\"\u0026gt;\u0026lt;/iframe\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;script\u0026gt;\n $(document).ready(function () {\n $('#jobsFrame').on('load', function () {\n $('#jobsFrame').show();\n $('#loader1').hide();\n });\n });\n \u0026lt;/script\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;%} if(eProfileFlag.equals(\"true\") || eProfileFlag.equals(\"1\")) {%\u0026gt;\n \u0026lt;div\u0026gt;\n \u0026lt;span class=\"\"\u0026gt;\u0026amp;nbsp;\u0026lt;/span\u0026gt;\n \u0026lt;div class=\"eProfile\"\u0026gt;\n \u0026lt;div class=\"panelbar\"\u0026gt;\n \u0026lt;li class=\"k-state-active\" style=\"font-weight: bold;\"\u0026gt;eProfile \u0026lt;div class=\"panelBody\"\u0026gt;\n \u0026lt;img id=\"eProLoader\" src=\"../loading.gif\" width=\"36\" height=\"36\" alt=\"loading gif\"/\u0026gt;\n \u0026lt;iframe id=\"eProFrame\" style=\"display:none;\" src=\"${pageContext.servletContext.contextPath}/eProfile.do\"\n width=\"100%\" height=\"500px\"\u0026gt;\u0026lt;/iframe\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;script\u0026gt;\n $(document).ready(function () {\n $('#eProFrame').on('load', function () {\n $('#eProFrame').show();\n $('#eProLoader').hide();\n });\n });\n \u0026lt;/script\u0026gt;\n \u0026lt;/li\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;%} %\u0026gt;\n \u0026lt;/div\u0026gt;\n\u0026lt;/div\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe tabs are configurable, I am reading a properties file to see which tabs needs to be displayed. So the starting part of the jsp check which tabs needs to be displayed and accordingly I am making a list. Rest of the portion does not have much conditions except if the tab needs to be displayed. Now, what is happening is that all the tabs are loading the iFrame content which makes the spinner shown for quite sometime and page takes more time to get fully loaded. I am trying to load the content selectively i.e the default tab should be loaded first and the rest of the tabs should be loaded only when those are clicked. I looked at the kendo-ui API but I did not find any relevant solution.\u003c/p\u003e\n\n\u003cp\u003eI am looking for a solution which can be implemented in JSP using javascript or if there is a need I can call controllers as well.\u003c/p\u003e","accepted_answer_id":"46002862","answer_count":"1","comment_count":"5","creation_date":"2017-08-30 20:05:29.32 UTC","last_activity_date":"2017-09-01 14:50:11.003 UTC","last_edit_date":"2017-08-30 21:00:17.03 UTC","last_editor_display_name":"","last_editor_user_id":"1790283","owner_display_name":"","owner_user_id":"1790283","post_type_id":"1","score":"1","tags":"javascript|java|jsp|kendo-ui|kendo-tabstrip","view_count":"71"} -{"id":"42171836","title":"Can youtube-dl perform multiple downloads to different directories?","body":"\u003cp\u003e\u003ca href=\"https://github.com/rg3/youtube-dl/blob/master/README.md#readme\" rel=\"nofollow noreferrer\"\u003eYoutube-dl\u003c/a\u003e runs with python\u003c/p\u003e\n\n\u003cp\u003eI would like to download multiple YouTube playlists (using the archive feature), but I want those to be downloaded to different local directories.\u003c/p\u003e\n\n\u003cp\u003eI can get this to work for one playlist going to one directory: \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e youtube-dl --download-archive \"F:\\Videos\\Online Videos\\Comics\n Explained\\Marvel Major Storylines (Constantly Updated)\\Marvel Major\n Storylines Archive.txt\"\n \"https://www.youtube.com/playlist?list=PL9sO35KZL50yZh5dXW-7l93VZp7Ct4vYA\"\n -o \"F:\\Videos\\Online Videos\\Comics Explained\\%(playlist_title)s\\%(title)s.%(ext)s\" -f\n \"bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best\"\n --ffmpeg-location \"H:\\Documents\\FFMpeg\\bin\"\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ebut I don't know if I can do this for multiple playlists going to a separate directory for each playlist. \u003c/p\u003e","accepted_answer_id":"42174549","answer_count":"2","comment_count":"0","creation_date":"2017-02-11 03:25:56.64 UTC","last_activity_date":"2017-02-11 09:58:42.703 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1947026","post_type_id":"1","score":"0","tags":"python|youtube-dl","view_count":"312"} +{"id":"42171836","title":"Can youtube-dl perform multiple downloads to different directories?","body":"\u003cp\u003e\u003ca href=\"https://github.com/rg3/youtube-dl/blob/main/README.md#readme\" rel=\"nofollow noreferrer\"\u003eYoutube-dl\u003c/a\u003e runs with python\u003c/p\u003e\n\n\u003cp\u003eI would like to download multiple YouTube playlists (using the archive feature), but I want those to be downloaded to different local directories.\u003c/p\u003e\n\n\u003cp\u003eI can get this to work for one playlist going to one directory: \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e youtube-dl --download-archive \"F:\\Videos\\Online Videos\\Comics\n Explained\\Marvel Major Storylines (Constantly Updated)\\Marvel Major\n Storylines Archive.txt\"\n \"https://www.youtube.com/playlist?list=PL9sO35KZL50yZh5dXW-7l93VZp7Ct4vYA\"\n -o \"F:\\Videos\\Online Videos\\Comics Explained\\%(playlist_title)s\\%(title)s.%(ext)s\" -f\n \"bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best\"\n --ffmpeg-location \"H:\\Documents\\FFMpeg\\bin\"\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ebut I don't know if I can do this for multiple playlists going to a separate directory for each playlist. \u003c/p\u003e","accepted_answer_id":"42174549","answer_count":"2","comment_count":"0","creation_date":"2017-02-11 03:25:56.64 UTC","last_activity_date":"2017-02-11 09:58:42.703 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1947026","post_type_id":"1","score":"0","tags":"python|youtube-dl","view_count":"312"} {"id":"32548236","title":"How to resume background audio in Swift 2 / AVPlayer?","body":"\u003cp\u003eI am learning Swift as my first programming language.\u003c/p\u003e\n\n\u003cp\u003eI've struggled for many hours to \u003cstrong\u003eresume background audio playback\u003c/strong\u003e after interruption (eg call)\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eWhat should happen:\u003c/strong\u003e\u003c/p\u003e\n\n\u003col\u003e\n\u003cli\u003eAudio keeps playing when app goes to background (works) \u003c/li\u003e\n\u003cli\u003eWhen interrupted by a call, get the notification for interruption began\n(works) \u003c/li\u003e\n\u003cli\u003eWhen call ends, get the notification for interruption\nends (works) \u003c/li\u003e\n\u003cli\u003eResume playing the audio (\u003cstrong\u003edoes NOT work - hear nothing\u003c/strong\u003e)\u003c/li\u003e\n\u003c/ol\u003e\n\n\u003cp\u003eReally appreciate any help! Thanks\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eNotes:\u003c/strong\u003e\u003c/p\u003e\n\n\u003col\u003e\n\u003cli\u003eThe app is registered for background audio and plays fine before interruption \u003c/li\u003e\n\u003cli\u003eI have tried with and without the time delay to resume playing - neither work\u003c/li\u003e\n\u003c/ol\u003e\n\n\u003cp\u003e\u003cstrong\u003eCode:\u003c/strong\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eimport UIKit\nimport AVFoundation\n\nvar player: AVQueuePlayer!\n\nclass ViewController: UIViewController {\n\n override func viewDidLoad() {\n super.viewDidLoad()\n do {\n try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayback)\n try AVAudioSession.sharedInstance().setActive(true, withOptions: .NotifyOthersOnDeactivation)\n } catch { }\n let songNames = [\"music\"]\n let songs = songNames.map { AVPlayerItem(URL:\n NSBundle.mainBundle().URLForResource($0, withExtension: \"mp3\")!) }\n player = AVQueuePlayer(items: songs)\n\n let theSession = AVAudioSession.sharedInstance()\n NSNotificationCenter.defaultCenter().addObserver(self,\n selector:\"playInterrupt:\",\n name:AVAudioSessionInterruptionNotification,\n object: theSession)\n\n player.play()\n }\n\n func playInterrupt(notification: NSNotification) {\n\n if notification.name == AVAudioSessionInterruptionNotification\n \u0026amp;\u0026amp; notification.userInfo != nil {\n\n var info = notification.userInfo!\n var intValue: UInt = 0\n (info[AVAudioSessionInterruptionTypeKey] as! NSValue).getValue(\u0026amp;intValue)\n if let type = AVAudioSessionInterruptionType(rawValue: intValue) {\n switch type {\n case .Began:\n print(\"aaaaarrrrgggg you stole me\")\n player.pause()\n\n case .Ended:\n let timer = NSTimer.scheduledTimerWithTimeInterval(3, target: self, selector: \"resumeNow:\", userInfo: nil, repeats: false)\n }\n }\n }\n }\n func resumeNow(timer : NSTimer) {\n player.play()\n print(\"attempted restart\")\n }\n}\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"32635113","answer_count":"4","comment_count":"2","creation_date":"2015-09-13 09:29:14.72 UTC","favorite_count":"9","last_activity_date":"2017-04-19 18:43:26.383 UTC","last_edit_date":"2015-09-13 09:47:35.483 UTC","last_editor_display_name":"","last_editor_user_id":"5205191","owner_display_name":"","owner_user_id":"5205191","post_type_id":"1","score":"6","tags":"ios|swift|audio|avfoundation|avplayer","view_count":"4878"} {"id":"9257813","title":"Are there standard naming conventions for a catalog override module in Magento?","body":"\u003cp\u003eIf writing a module to add and modify some catalog logic. Is there anything wrong or against any standards/best practices in creating a module named \"Catalog\" that lives in the app/code/local directory?\u003c/p\u003e\n\n\u003cp\u003eexample:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eapp/\n--code/\n----local/\n------Catalog/\n--------controllers/\n--------etc/\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e-or should it be prefixed, something like: Foo_Catalog\u003c/p\u003e\n\n\u003cp\u003eI'm specifically looking if best practices/standards for Magento exist for this. (not just opinion)\u003c/p\u003e","accepted_answer_id":"9258018","answer_count":"1","comment_count":"0","creation_date":"2012-02-13 09:02:21.977 UTC","last_activity_date":"2012-02-13 09:19:53.28 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"711852","post_type_id":"1","score":"0","tags":"magento","view_count":"301"} {"id":"6824482","title":"Why Base Class Library in .NET?","body":"\u003cp\u003eI am bit confused about the way C# program get executed.\nWhat I learnt till now is,\u003c/p\u003e\n\n\u003col\u003e\n\u003cli\u003eC# program + Base Class library forms a Source code\u003c/li\u003e\n\u003cli\u003eThis source code is given to C# compiler to get converted into MSILIL code.\u003c/li\u003e\n\u003cli\u003eThis MSIL code is handed over to .NET Framework to converted into native code.\u003c/li\u003e\n\u003c/ol\u003e\n\n\u003cp\u003eSo my question is why do we need Base Classes in .NET Framework, as the required Base Classes are already \nconverted to MSIL code?\u003c/p\u003e\n\n\u003cp\u003eAm I getting the above process wrong?\nPlease help!\nI googled it but not able to clear the dought.\nThanks for your kind Attention!\u003c/p\u003e","accepted_answer_id":"6824527","answer_count":"3","comment_count":"2","creation_date":"2011-07-26 02:08:00.823 UTC","favorite_count":"1","last_activity_date":"2015-05-13 15:24:29.523 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"827573","post_type_id":"1","score":"0","tags":"c#","view_count":"949"} @@ -1862,10 +1862,10 @@ {"id":"22866131","title":"background-attachment: fixed - Reverse scroll?","body":"\u003cp\u003eI would like to know how some of the websites use this for their background to scroll upward when you scroll downward.. how do they do it? Is there a jquery code to add to this?\u003c/p\u003e\n\n\u003cp\u003eI have this: \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e.featured-container{ \n margin-left: 0px;\n margin-right: 0px; \n\n left:0px;\n\n width: 100%;\n z-index:-6;\n overflow: hidden;\n position: absolute; \n background-image: url(\"../images/subtle.png\");\n background-attachment: fixed;\n}\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"22866952","answer_count":"1","comment_count":"5","creation_date":"2014-04-04 14:53:59.423 UTC","last_activity_date":"2014-04-04 15:29:51.67 UTC","last_edit_date":"2014-04-04 14:59:23.98 UTC","last_editor_display_name":"","last_editor_user_id":"1248177","owner_display_name":"","owner_user_id":"3451555","post_type_id":"1","score":"0","tags":"html|css","view_count":"1325"} {"id":"45430983","title":"How to define database generated column values as readonly fields in JPA and Hibernate?","body":"\u003cp\u003eWith MariaDB 10.2 it's possible to define default value for Datetime e.g. created and lastModified.\u003c/p\u003e\n\n\u003cp\u003eHow I should access this columns as readonly field? Because this values should only be under control of the database and should not be modify from code, but I want read access to this property in code. \u003c/p\u003e","accepted_answer_id":"45431128","answer_count":"2","comment_count":"0","creation_date":"2017-08-01 06:58:17.77 UTC","last_activity_date":"2017-10-04 06:17:19.903 UTC","last_edit_date":"2017-08-01 07:07:06.937 UTC","last_editor_display_name":"","last_editor_user_id":"1025118","owner_display_name":"","owner_user_id":"1116758","post_type_id":"1","score":"2","tags":"java|hibernate|jpa|mariadb|readonly","view_count":"98"} {"id":"41526769","title":"Text going over the \u003cdiv\u003e","body":"\u003cp\u003eA user inserts a message into the database, then I SELECT the message and do a echo to put the message in the div.\nFor some reason the text is going over the right border of the div\u003c/p\u003e\n\n\u003cp\u003eI tried using a blockquote and it worked with a random text that W3Schools had there and when I put the echo inside the blockquote it happens anyway. See on the prints: \u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"https://i.stack.imgur.com/0Hjt2.png\" rel=\"nofollow noreferrer\"\u003e\u003cimg src=\"https://i.stack.imgur.com/0Hjt2.png\" alt=\"enter image description here\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eThe parts from the code:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;?php\n$sql_post = \"SELECT `dataTopico`,`username`,`titulo`,`mensagem` FROM `\".$bd.\"` WHERE `idTopico`='$id_topico'\";\n$exePost = mysql_query($sql_post);\n$post=mysql_fetch_array($exePost);\n?\u0026gt;\n\n\u0026lt;blockquote\u0026gt;\n WWF has been protecting the future of nature. The world \n leading conservation organization, WWF works in 100 countries and is \n supported by 1.2 million members in the United States and close \n to 5 million globally.\n\u0026lt;/blockquote\u0026gt;\n\n\u0026lt;blockquote\u0026gt;\n \u0026lt;?php echo $post['mensagem'];?\u0026gt;\n\u0026lt;/blockquote\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe query is right; it gets the test message but the text goes over the borders. I want it to go down like the text above.\u003c/p\u003e","accepted_answer_id":"41526848","answer_count":"1","comment_count":"9","creation_date":"2017-01-07 21:29:10.337 UTC","favorite_count":"1","last_activity_date":"2017-01-07 22:50:03.717 UTC","last_edit_date":"2017-01-07 22:50:03.717 UTC","last_editor_display_name":"","last_editor_user_id":"483779","owner_display_name":"","owner_user_id":"6832877","post_type_id":"1","score":"-2","tags":"html|css","view_count":"57"} -{"id":"27084586","title":"Generic typealias in Swift","body":"\u003cp\u003eIn haskell you can do this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003etype Parser a = String -\u0026gt; [(a, String)]\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI tried to make something similar in Swift. So far I wrote these codes with no luck.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003etypealias Parser\u0026lt;A\u0026gt; = String -\u0026gt; [(A, String)]\ntypealias Parser a = String -\u0026gt; [(a, String)]\ntypealias Parser = String -\u0026gt; [(A, String)]\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eSo is this simply impossible in swift? And if it is is there another ways to implement this behavior?\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eUPDATE:\u003c/strong\u003e It seems generic typealiases are now supported in swift 3\n\u003ca href=\"https://github.com/apple/swift/blob/master/CHANGELOG.md\"\u003ehttps://github.com/apple/swift/blob/master/CHANGELOG.md\u003c/a\u003e\u003c/p\u003e","accepted_answer_id":"27084702","answer_count":"3","comment_count":"0","creation_date":"2014-11-23 01:26:48.797 UTC","favorite_count":"11","last_activity_date":"2017-01-22 08:43:31.907 UTC","last_edit_date":"2016-03-24 10:04:49.303 UTC","last_editor_display_name":"","last_editor_user_id":"216129","owner_display_name":"","owner_user_id":"3068061","post_type_id":"1","score":"40","tags":"swift|generics","view_count":"8235"} +{"id":"27084586","title":"Generic typealias in Swift","body":"\u003cp\u003eIn haskell you can do this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003etype Parser a = String -\u0026gt; [(a, String)]\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI tried to make something similar in Swift. So far I wrote these codes with no luck.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003etypealias Parser\u0026lt;A\u0026gt; = String -\u0026gt; [(A, String)]\ntypealias Parser a = String -\u0026gt; [(a, String)]\ntypealias Parser = String -\u0026gt; [(A, String)]\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eSo is this simply impossible in swift? And if it is is there another ways to implement this behavior?\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eUPDATE:\u003c/strong\u003e It seems generic typealiases are now supported in swift 3\n\u003ca href=\"https://github.com/apple/swift/blob/main/CHANGELOG.md\"\u003ehttps://github.com/apple/swift/blob/main/CHANGELOG.md\u003c/a\u003e\u003c/p\u003e","accepted_answer_id":"27084702","answer_count":"3","comment_count":"0","creation_date":"2014-11-23 01:26:48.797 UTC","favorite_count":"11","last_activity_date":"2017-01-22 08:43:31.907 UTC","last_edit_date":"2016-03-24 10:04:49.303 UTC","last_editor_display_name":"","last_editor_user_id":"216129","owner_display_name":"","owner_user_id":"3068061","post_type_id":"1","score":"40","tags":"swift|generics","view_count":"8235"} {"id":"28573536","title":"How to store points (coordinates x,y) from a text file in c++ then calculate/display the number of points in that file","body":"\u003cp\u003eThis is what i have done so far , but then I am stuck on how to display x,y or count the number of points in that file. So let's assume we have these points with test1.txt :\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e0,1\n0,4\n6,3\n2,4\n5,4\n5,6\n6,4\n5,4\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThank you \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e#include \u0026lt;iostream\u0026gt;\n#include \u0026lt;fstream\u0026gt;\n#include \u0026lt;vector\u0026gt;\n\nusing namespace std;\n\ntypedef struct\n{\n int x;\n int y; \n} point;\n\nint main()\n{\n ifstream input;\n string filename;\n cout \u0026lt;\u0026lt; \"Enter the file name :\" \u0026lt;\u0026lt; endl;\n cin \u0026gt;\u0026gt; filename;\n input.open(filename.c_str());\n\n while(input.fail())\n {\n input.clear();\n cout \u0026lt;\u0026lt;\"Incorrect filename, please enter again\" \u0026lt;\u0026lt; endl;\n cin \u0026gt;\u0026gt; filename ;\n input.open(filename.c_str()) ;\n }\n vector\u0026lt;point\u0026gt; points;\n point tmp;\n while (input \u0026gt;\u0026gt; tmp.x \u0026amp;\u0026amp; input \u0026gt;\u0026gt; tmp.y)\n {\n points.push_back(tmp);\n }; \n cout \u0026lt;\u0026lt; points.size() \u0026lt;\u0026lt; endl; \n return 0;\n}\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"2","comment_count":"1","creation_date":"2015-02-17 23:57:48.597 UTC","last_activity_date":"2015-02-18 00:43:56.437 UTC","last_edit_date":"2015-02-18 00:00:25.883 UTC","last_editor_display_name":"","last_editor_user_id":"1870232","owner_display_name":"","owner_user_id":"4250969","post_type_id":"1","score":"-3","tags":"c++|vector","view_count":"2452"} {"id":"46477678","title":"Interface Error: (0, \"\")","body":"\u003cp\u003eI have this error. When I go to a page the second time I get this error and I don't now how to resolve it. I use for connections \u003ccode\u003epymysql\u003c/code\u003e.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eInterfaceError: (0, '')\n127.0.0.1 - - [28/Sep/2017 13:17:46] \"GET /magazin HTTP/1.1\" 302 -\n[2017-09-28 13:17:46,433] ERROR in app: Exception on /magazin [GET]\nTraceback (most recent call last):\n File \"D:\\python2\\lib\\site-packages\\flask\\app.py\", line 1982, in wsgi_app\n response = self.full_dispatch_request()\n File \"D:\\python2\\lib\\site-packages\\flask\\app.py\", line 1614, in full_dispatch_request\n rv = self.handle_user_exception(e)\n File \"D:\\python2\\lib\\site-packages\\flask\\app.py\", line 1517, in handle_user_exception\n reraise(exc_type, exc_value, tb)\n File \"D:\\python2\\lib\\site-packages\\flask\\app.py\", line 1612, in full_dispatch_request\n rv = self.dispatch_request()\n File \"D:\\python2\\lib\\site-packages\\flask\\app.py\", line 1598, in dispatch_request\n return self.view_functions[rule.endpoint](**req.view_args)\n File \"C:\\Users\\Bogdanel\\Desktop\\python\\lifesaver\\index.py\", line 588, in magazin\n con.execute(sql_new_3)\n File \"D:\\python2\\lib\\site-packages\\pymysql\\cursors.py\", line 166, in execute\n result = self._query(query)\n File \"D:\\python2\\lib\\site-packages\\pymysql\\cursors.py\", line 322, in _query\n conn.query(q)\n File \"D:\\python2\\lib\\site-packages\\pymysql\\connections.py\", line 855, in query\n self._execute_command(COMMAND.COM_QUERY, sql)\n File \"D:\\python2\\lib\\site-packages\\pymysql\\connections.py\", line 1071, in _execute_command\n raise err.InterfaceError(\"(0, '')\")\nInterfaceError: (0, '')\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe cursor is never close and i think that it may be the problem but when i close i get another error .I should use multiple cursor and close it after i open ? Please give me an example how i should use ?\nI am a beginner in flask ,pymysql ,python and i need help. \u003c/p\u003e\n\n\u003cp\u003eExemple:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e connection=pymysql.connect(host='localhost',use_unicode=True,charset=\"utf8\",user='root',password='',db='savelives',autocommit=True) \n con=connection.cursor()\n\n @app.route('/magazin',methods=[\"POST\",\"GET\"])\n def magazin():\n sql_new_3=\"SELECT * FROM magazin \"\n con.execute(sql_new_3)\n\n products=con.fetchall()\n\n return render_template('magazin.html',products=products,j=0)\n\n@app.route('/likes',methods=[\"POST\",\"GET\"])\ndef likes():\n com_id=request.args['com_id']\n sle=\"SELECT * FROM likes WHERE user_id='\"+str(session['id'])+\"' AND friend_id='\"+str(session['id'])+\"' AND com_id='\"+str(com_id)+\"'\"\n lee2=con.execute(sle)\n if lee2==0:\n sqlmyqsl=\"INSERT INTO likes VALUES('','\"+str(session['id'])+\"','\"+str(session['user_friend_id'])+\"','\"+com_id+\"','\"+str(1)+\"')\"\n con.execute(sqlmyqsl) \n return \"liked \"\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAbove are 2 of my functions that i used in my project and how i used pymysql to connect to database \u003c/p\u003e","answer_count":"0","comment_count":"1","creation_date":"2017-09-28 20:22:05.027 UTC","last_activity_date":"2017-09-29 07:05:35.35 UTC","last_edit_date":"2017-09-29 07:05:35.35 UTC","last_editor_display_name":"","last_editor_user_id":"3968623","owner_display_name":"","owner_user_id":"7906290","post_type_id":"1","score":"0","tags":"python|python-2.7|pymysql","view_count":"73"} -{"id":"23257293","title":"What does this line of Javascript Regex do?","body":"\u003cp\u003eThe line in question is this one:\u003c/p\u003e\n\n\u003cp\u003e\u003ccode\u003evar extendedXmp = (data.match(/xmpNote:HasExtendedXMP=\"(.+?)\"/i) || [])[1];\u003c/code\u003e\u003c/p\u003e\n\n\u003cp\u003eIt is part of the bigger code chunk here:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ethis.parseCompoundImage = function(data) {\nvar extendedXmp = (data.match(/xmpNote:HasExtendedXMP=\"(.+?)\"/i) || [])[1];\nif (extendedXmp) {\n // we need to clear out JPEG's block headers. Let's be juvenile and don't care about checking this for now, shall we?\n // 2b + 2b + http://ns.adobe.com/xmp/extension/ + 1b + extendedXmp + 4b + 4b\n data = data.replace(new RegExp('[\\\\s\\\\S]{4}http:\\\\/\\\\/ns\\\\.adobe\\\\.com\\\\/xmp\\\\/extension\\\\/[\\\\s\\\\S]' + extendedXmp + '[\\\\s\\\\S]{8}', 'g'), '')\n}\n\nvar xmp = data.match(/\u0026lt;x:xmpmeta [\\s\\S]+?\u0026lt;\\/x:xmpmeta\u0026gt;/g),\n result = {}\nif (!xmp) throw \"No XMP metadata found!\";\nxmp = xmp.join(\"\\n\", xmp);\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhich comes from \u003ca href=\"https://github.com/panrafal/depthy/blob/master/app/scripts/controllers/main.js#L77-87\" rel=\"nofollow\"\u003ethe source code of the depthy app\u003c/a\u003e. This chunk of code gets XMP metadata and cleans out the JPEG exif headers using regex. The second line of this code is what confuses me. From what I understand is it tries to match a certain pattern in the data, but I'm not familiar enough with javascript to understand it. Can someone explain to me what that line does?\u003c/p\u003e\n\n\u003cp\u003eThanks\u003c/p\u003e","accepted_answer_id":"23257436","answer_count":"1","comment_count":"3","creation_date":"2014-04-23 23:50:13.14 UTC","last_activity_date":"2014-04-24 00:15:34.35 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"2079775","post_type_id":"1","score":"0","tags":"javascript|regex","view_count":"72"} +{"id":"23257293","title":"What does this line of Javascript Regex do?","body":"\u003cp\u003eThe line in question is this one:\u003c/p\u003e\n\n\u003cp\u003e\u003ccode\u003evar extendedXmp = (data.match(/xmpNote:HasExtendedXMP=\"(.+?)\"/i) || [])[1];\u003c/code\u003e\u003c/p\u003e\n\n\u003cp\u003eIt is part of the bigger code chunk here:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ethis.parseCompoundImage = function(data) {\nvar extendedXmp = (data.match(/xmpNote:HasExtendedXMP=\"(.+?)\"/i) || [])[1];\nif (extendedXmp) {\n // we need to clear out JPEG's block headers. Let's be juvenile and don't care about checking this for now, shall we?\n // 2b + 2b + http://ns.adobe.com/xmp/extension/ + 1b + extendedXmp + 4b + 4b\n data = data.replace(new RegExp('[\\\\s\\\\S]{4}http:\\\\/\\\\/ns\\\\.adobe\\\\.com\\\\/xmp\\\\/extension\\\\/[\\\\s\\\\S]' + extendedXmp + '[\\\\s\\\\S]{8}', 'g'), '')\n}\n\nvar xmp = data.match(/\u0026lt;x:xmpmeta [\\s\\S]+?\u0026lt;\\/x:xmpmeta\u0026gt;/g),\n result = {}\nif (!xmp) throw \"No XMP metadata found!\";\nxmp = xmp.join(\"\\n\", xmp);\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhich comes from \u003ca href=\"https://github.com/panrafal/depthy/blob/main/app/scripts/controllers/main.js#L77-87\" rel=\"nofollow\"\u003ethe source code of the depthy app\u003c/a\u003e. This chunk of code gets XMP metadata and cleans out the JPEG exif headers using regex. The second line of this code is what confuses me. From what I understand is it tries to match a certain pattern in the data, but I'm not familiar enough with javascript to understand it. Can someone explain to me what that line does?\u003c/p\u003e\n\n\u003cp\u003eThanks\u003c/p\u003e","accepted_answer_id":"23257436","answer_count":"1","comment_count":"3","creation_date":"2014-04-23 23:50:13.14 UTC","last_activity_date":"2014-04-24 00:15:34.35 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"2079775","post_type_id":"1","score":"0","tags":"javascript|regex","view_count":"72"} {"id":"33380593","title":"p5.js creating a new Vector error","body":"\u003cp\u003eSo i'm trying to rewrite some of main proccessing sketches to p5.js, but (there is always a but..) i have a problem with creating Vecotrs. I think i'm lacking some simple java script uderstanding here. \u003c/p\u003e\n\n\u003cp\u003eSo i use the example provided with p5.js, and my code looks like that:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003evar location ;\n\nfunction setup() {\n createCanvas(1000, 1000);\n background(0);\n location = new Vector(0, 0);\n //location = createVector(0, 0); \n //location = new p5.Vector(0, 0);\n}\n\nfunction draw() {\n ellipse(location.x, location.y, 80, 80);\n}\n\nfunction Vector (x,y) {\n this.x = x;\n this.y = x; \n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI tryied 3 ways of creating vectors, the one right now, with creating custom \"class\" Vector, and those 2 commented out. And if i try it out, i have page not found and address bar is changed to \"address to my index.html/p5.Vector%20Object%20:%20[0,%200,%200]\".\u003c/p\u003e\n\n\u003cp\u003eI really have now idea what is wrong.\u003c/p\u003e","accepted_answer_id":"33380768","answer_count":"1","comment_count":"3","creation_date":"2015-10-27 23:57:02.377 UTC","last_activity_date":"2015-10-28 00:15:22.427 UTC","last_edit_date":"2015-10-28 00:08:16.153 UTC","last_editor_display_name":"","last_editor_user_id":"229044","owner_display_name":"","owner_user_id":"3187553","post_type_id":"1","score":"2","tags":"javascript|processing|p5.js","view_count":"409"} {"id":"27228964","title":"read csv-data with missing values into python using pandas","body":"\u003cp\u003eI have a CSV-file looking like this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\"row ID\",\"label\",\"val\"\n\"Row0\",\"5\",6\n\"Row1\",\"\",6\n\"Row2\",\"\",6\n\"Row3\",\"5\",7\n\"Row4\",\"5\",8\n\"Row5\",,9\n\"Row6\",\"nan\",\n\"Row7\",\"nan\",\n\"Row8\",\"nan\",0\n\"Row9\",\"nan\",3\n\"Row10\",\"nan\",\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAll quoted entries are strings. Non-quoted entries are numerical. Empty fields are missing values (NaN), Quoted empty fields still should be considered as empty strings.\nI tried to read it in with pandas read_csv but I cannot get it working the way I would like to have it... It still consideres ,\"\", and ,, as NaN, while it's not true for the first one.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ed = pd.read_csv(csv_filename, sep=',', keep_default_na=False, na_values=[''], quoting = csv.QUOTE_NONNUMERIC)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eCan anybody help? Is it possible at all?\u003c/p\u003e","accepted_answer_id":"27267969","answer_count":"3","comment_count":"0","creation_date":"2014-12-01 13:00:01.857 UTC","last_activity_date":"2014-12-03 09:29:17.46 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"815455","post_type_id":"1","score":"0","tags":"python|csv|pandas|missing-data","view_count":"2560"} {"id":"5705580","title":"contentEditable - Firefox \u003cbr /\u003e tag","body":"\u003cp\u003eFirefox inserts a \u003ccode\u003e\u0026lt;br /\u0026gt;\u003c/code\u003e tag on press enter whereas the other browsers are adding either a \u003ccode\u003e\u0026lt;p\u0026gt;\u003c/code\u003e or \u003ccode\u003e\u0026lt;div\u0026gt;\u003c/code\u003e. I know that chrome and safari are inserting the same tag of the firstchild of the contentEditable div. So do Firefox, however, if the first tag's innerHTML is empty firefox is just ignoring the tag and creating a new line by pushing the default node in the second line and writes directly inside the editor instead of inside a child node. So basically, I want Firefox to write inside the given tag and continue to insert that kind of node on each press on enter. How can it be done? Any suggestions? \u003c/p\u003e","accepted_answer_id":"5721576","answer_count":"2","comment_count":"2","creation_date":"2011-04-18 15:55:44.913 UTC","favorite_count":"2","last_activity_date":"2011-04-20 00:49:12.713 UTC","last_edit_date":"2011-04-20 00:49:12.713 UTC","last_editor_display_name":"","last_editor_user_id":"697529","owner_display_name":"","owner_user_id":"697529","post_type_id":"1","score":"7","tags":"javascript|firefox|contenteditable|enter","view_count":"7061"} @@ -1912,7 +1912,7 @@ {"id":"37235179","title":"How to read gvfs file by TStream","body":"\u003cp\u003eLinux feature is gvfs. I see TFileStream don't support gvfs files. So I need some other TStream object to read gvfs files. Do such streams exist?\u003c/p\u003e\n\n\u003cp\u003eLazarus 1.7, fpc 3.0\u003c/p\u003e\n\n\u003cp\u003egvfs exposed to system as files:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e/run/user/1000/gvfs/ftp:host=ftp.scene.org/ls-lR\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"1","comment_count":"2","creation_date":"2016-05-15 06:17:36.003 UTC","last_activity_date":"2016-05-15 11:24:27.813 UTC","last_edit_date":"2016-05-15 09:51:03.397 UTC","last_editor_display_name":"","last_editor_user_id":"1789574","owner_display_name":"","owner_user_id":"1789574","post_type_id":"1","score":"-1","tags":"freepascal","view_count":"46"} {"id":"16101409","title":"Is there some elegant way to pause \u0026 resume any other goroutine in golang?","body":"\u003cp\u003eIn my case, I have thousands of goroutines working simultaneously as \u003ccode\u003ework()\u003c/code\u003e. I also had a \u003ccode\u003esync()\u003c/code\u003e goroutine. When \u003ccode\u003esync\u003c/code\u003e starts, I need any other goroutine to pause for a while after sync job is done. Here is my code:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003evar channels []chan int\nvar channels_mutex sync.Mutex\n\nfunc work() {\n channel := make(chan int, 1)\n channels_mutex.Lock() \n channels = append(channels, channel)\n channels_mutex.Unlock()\n for {\n for {\n sync_stat := \u0026lt;- channel // blocked here\n if sync_stat == 0 { // if sync complete\n break \n }\n }\n // Do some jobs\n if (some condition) {\n return\n }\n }\n}\n\nfunc sync() {\n channels_mutex.Lock()\n // do some sync\n\n for int i := 0; i != len(channels); i++ {\n channels[i] \u0026lt;- 0\n }\n channels_mutex.Unlock()\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eNow the problem is, since \u003ccode\u003e\u0026lt;-\u003c/code\u003e is always blocking on read, every time goes to \u003ccode\u003esync_stat := \u0026lt;- channel\u003c/code\u003e is blocking. I know if the channel was closed it won't be blocked, but since I have to use this channel until \u003ccode\u003ework()\u003c/code\u003e exits, and I didn't find any way to reopen a closed channel.\u003c/p\u003e\n\n\u003cp\u003eI suspect myself on a wrong way, so any help is appreciated. Is there some \"elegant\" way to pause \u0026amp; resume any other goroutine in golang?\u003c/p\u003e","accepted_answer_id":"16102304","answer_count":"1","comment_count":"0","creation_date":"2013-04-19 09:26:05.76 UTC","favorite_count":"6","last_activity_date":"2013-04-20 19:15:30.677 UTC","last_edit_date":"2013-04-19 09:31:13.52 UTC","last_editor_display_name":"","last_editor_user_id":"1153066","owner_display_name":"","owner_user_id":"1153066","post_type_id":"1","score":"10","tags":"go|channel|goroutine","view_count":"4451"} {"id":"30193275","title":"Comparator return type is not compatible with integer","body":"\u003cp\u003eI am trying to sort an object via the object attribute NodeID which is long type.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e Collections.sort(PeerNodeInChord, new Comparator\u0026lt;PeerNode\u0026gt;() \n {\n @Override public long compare(PeerNode p1, PeerNode p2) \n {\n return p1.NodeID - p2.NodeID; // Ascending\n }\n\n });\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI am getting the following error : \u003c/p\u003e\n\n\u003cblockquote\u003e\n \u003cp\u003ecompare(PeerNode,PeerNode) in cannot implement\n compare(T,T) in Comparator return type long is not compatible with\n int where T is a type-variable:\n T extends Object declared in interface Comparator\u003c/p\u003e\n\u003c/blockquote\u003e\n\n\u003cp\u003eIt seems i cant have type \"long\" as return type and must have \"int\" as the return type. \u003c/p\u003e\n\n\u003cp\u003eI am not allowed to change NodeID type to int. \u003c/p\u003e\n\n\u003cp\u003eIs there any way to sort the ArrayList of PeerNode via the object attribute NodeID which is long type ??\u003c/p\u003e","answer_count":"2","comment_count":"0","creation_date":"2015-05-12 14:04:05.143 UTC","favorite_count":"1","last_activity_date":"2015-05-12 14:27:16.833 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1832057","post_type_id":"1","score":"1","tags":"java|sorting|debugging|comparator","view_count":"525"} -{"id":"44785926","title":"I only want the first occurrence of a node in XML/XSLT document. XPath is returning all even with [1]","body":"\u003cp\u003eI need to select only the first occurrence of the \u003ccode\u003e\u0026lt;fo:table ...\u0026gt;\u003c/code\u003e node in the following XSL-FO templace, but xPath is returning all of them. Here is the XPath statement I'm using after creating a wrapper element with all the namespaces:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;fo:wrapper xmlns:fo=\"http://www.w3.org/1999/XSL/Format\"\n xmlns:j4luserext=\"xalan://com.java4less.xreport.fop.XLSTDummyExtension\"\n xmlns:j4lext=\"xalan://com.java4less.xreport.fop.XLSTExtension\"\n xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns:j4lif=\"http://java4less.com/fop/iform\"\u0026gt;\n\n {xsl:stylesheet/xsl:template/fo:root/fo:page-sequence/fo:flow/fo:table/\n fo:table-body/fo:table-row/fo:table-cell/fo:block/fo:table[1]}\n\u0026lt;/fo:wrapper\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAnd here is the XSL-FO input:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;?xml version=\"1.0\" encoding=\"UTF-8\"?\u0026gt;\n\u0026lt;xsl:stylesheet version=\"1.0\" xmlns:j4lif=\"http://java4less.com/fop/iform\"\nxmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns:j4lext=\"xalan://com.java4less.xreport.fop.XLSTExtension\"\nextension-element-prefixes=\"j4lext j4luserext\"\nxmlns:j4luserext=\"xalan://com.java4less.xreport.fop.XLSTDummyExtension\"\u0026gt;\n\u0026lt;xsl:template match=\"/\"\u0026gt;\n \u0026lt;fo:root xmlns:fo=\"http://www.w3.org/1999/XSL/Format\"\u0026gt;\n \u0026lt;fo:layout-master-set\u0026gt;\n \u0026lt;fo:simple-page-master master-name=\"master0\"\n page-width=\"21.0cm\" page-height=\"29.7cm\" margin-top=\"2.0cm\"\n margin-bottom=\"2.0cm\" margin-left=\"2.0cm\" margin-right=\"2.0cm\"\u0026gt;\n \u0026lt;fo:region-body region-name=\"body0\" margin-top=\"1.5cm\"\n margin-bottom=\"1.5cm\" /\u0026gt;\n \u0026lt;fo:region-before region-name=\"header0\" extent=\"1.5cm\" /\u0026gt;\n \u0026lt;fo:region-after region-name=\"footer0\" extent=\"1.5cm\" /\u0026gt;\n \u0026lt;/fo:simple-page-master\u0026gt;\n \u0026lt;/fo:layout-master-set\u0026gt;\n \u0026lt;fo:page-sequence master-reference=\"master0\"\u0026gt;\n \u0026lt;fo:static-content flow-name=\"header0\"\u0026gt;\n \u0026lt;!-- 846098b14a344ae29ebeb7d3c3ae73c0 --\u0026gt;\n \u0026lt;fo:table width=\"17.0cm\"\u0026gt;\n \u0026lt;fo:table-column column-width=\"17.0cm\" /\u0026gt;\n \u0026lt;fo:table-body\u0026gt;\n \u0026lt;fo:table-row background-color=\"#ffffff\" height=\"1.5cm\"\u0026gt;\n \u0026lt;fo:table-cell\u0026gt;\n \u0026lt;fo:table\u0026gt;\n \u0026lt;fo:table-column column-width=\"17.0cm\" /\u0026gt;\n \u0026lt;fo:table-body\u0026gt;\n \u0026lt;fo:table-row background-color=\"#ffffff\" height=\"1.5cm\"\u0026gt;\n \u0026lt;fo:table-cell number-columns-spanned=\"1\"\u0026gt;\n \u0026lt;fo:block\u0026gt;\u0026lt;/fo:block\u0026gt;\n \u0026lt;/fo:table-cell\u0026gt;\n \u0026lt;/fo:table-row\u0026gt;\n \u0026lt;/fo:table-body\u0026gt;\n \u0026lt;/fo:table\u0026gt;\n \u0026lt;/fo:table-cell\u0026gt;\n \u0026lt;/fo:table-row\u0026gt;\n \u0026lt;/fo:table-body\u0026gt;\n \u0026lt;/fo:table\u0026gt;\n \u0026lt;/fo:static-content\u0026gt;\n \u0026lt;fo:static-content flow-name=\"footer0\"\u0026gt;\n \u0026lt;!-- b468381816be4ef8bb31f448a8bf5b09 --\u0026gt;\n \u0026lt;fo:table width=\"17.0cm\"\u0026gt;\n \u0026lt;fo:table-column column-width=\"17.0cm\" /\u0026gt;\n \u0026lt;fo:table-body\u0026gt;\n \u0026lt;fo:table-row background-color=\"#ffffff\" height=\"1.5cm\"\u0026gt;\n \u0026lt;fo:table-cell\u0026gt;\n \u0026lt;fo:table\u0026gt;\n \u0026lt;fo:table-column column-width=\"17.0cm\" /\u0026gt;\n \u0026lt;fo:table-body\u0026gt;\n \u0026lt;fo:table-row background-color=\"#ffffff\" height=\"1.5cm\"\u0026gt;\n \u0026lt;fo:table-cell number-columns-spanned=\"1\"\u0026gt;\n \u0026lt;fo:block\u0026gt;\u0026lt;/fo:block\u0026gt;\n \u0026lt;/fo:table-cell\u0026gt;\n \u0026lt;/fo:table-row\u0026gt;\n \u0026lt;/fo:table-body\u0026gt;\n \u0026lt;/fo:table\u0026gt;\n \u0026lt;/fo:table-cell\u0026gt;\n \u0026lt;/fo:table-row\u0026gt;\n \u0026lt;/fo:table-body\u0026gt;\n \u0026lt;/fo:table\u0026gt;\n \u0026lt;/fo:static-content\u0026gt;\n \u0026lt;fo:flow flow-name=\"body0\"\u0026gt;\n\n \u0026lt;!-- START Area Header --\u0026gt;\n \u0026lt;!-- 4ce697eac861472391f5eac35a51db48 --\u0026gt;\n \u0026lt;fo:table width=\"17.0cm\"\u0026gt;\n \u0026lt;fo:table-column column-width=\"17.0cm\" /\u0026gt;\n \u0026lt;fo:table-body\u0026gt;\n \u0026lt;fo:table-row background-color=\"#ffffff\" height=\"1.5cm\"\u0026gt;\n \u0026lt;fo:table-cell\u0026gt;\n \u0026lt;fo:table\u0026gt;\n \u0026lt;fo:table-column column-width=\"17.0cm\" /\u0026gt;\n \u0026lt;fo:table-body\u0026gt;\n \u0026lt;fo:table-row background-color=\"#ffffff\" height=\"1.5cm\"\u0026gt;\n \u0026lt;fo:table-cell number-columns-spanned=\"1\"\u0026gt;\n \u0026lt;fo:block\u0026gt;\u0026lt;/fo:block\u0026gt;\n \u0026lt;/fo:table-cell\u0026gt;\n \u0026lt;/fo:table-row\u0026gt;\n \u0026lt;/fo:table-body\u0026gt;\n \u0026lt;/fo:table\u0026gt;\n \u0026lt;/fo:table-cell\u0026gt;\n \u0026lt;/fo:table-row\u0026gt;\n \u0026lt;fo:table-row\u0026gt;\n \u0026lt;fo:table-cell number-columns-spanned=\"1\"\u0026gt;\n \u0026lt;fo:block\u0026gt;\n\n \u0026lt;!-- START Area Detail --\u0026gt;\n \u0026lt;!-- 7f22844da7e94220b5877bf7593e1dcb --\u0026gt;\n \u0026lt;fo:table width=\"17.0cm\"\u0026gt;\n \u0026lt;fo:table-column column-width=\"17.0cm\" /\u0026gt;\n \u0026lt;!-- 63bbf10b61f44321913cffd695225a53 --\u0026gt;\n \u0026lt;fo:table-header\u0026gt;\n \u0026lt;fo:table-row background-color=\"#ffffff\"\n height=\"2.0cm\"\u0026gt;\n \u0026lt;fo:table-cell\u0026gt;\n \u0026lt;fo:table\u0026gt;\n \u0026lt;fo:table-column column-width=\"17.0cm\" /\u0026gt;\n \u0026lt;fo:table-body\u0026gt;\n \u0026lt;fo:table-row background-color=\"#ffffff\"\n height=\"2.0cm\"\u0026gt;\n \u0026lt;fo:table-cell number-columns-spanned=\"1\"\u0026gt;\n \u0026lt;fo:block\u0026gt;\u0026lt;/fo:block\u0026gt;\n \u0026lt;/fo:table-cell\u0026gt;\n \u0026lt;/fo:table-row\u0026gt;\n \u0026lt;/fo:table-body\u0026gt;\n \u0026lt;/fo:table\u0026gt;\n \u0026lt;/fo:table-cell\u0026gt;\n \u0026lt;/fo:table-row\u0026gt;\n \u0026lt;/fo:table-header\u0026gt;\n \u0026lt;fo:table-body\u0026gt;\n \u0026lt;fo:table-row background-color=\"#ffffff\"\n height=\"4.0cm\"\u0026gt;\n \u0026lt;fo:table-cell\u0026gt;\n \u0026lt;fo:table\u0026gt;\n \u0026lt;fo:table-column column-width=\"17.0cm\" /\u0026gt;\n \u0026lt;fo:table-body\u0026gt;\n \u0026lt;fo:table-row background-color=\"#ffffff\"\n height=\"4.0cm\"\u0026gt;\n \u0026lt;fo:table-cell number-columns-spanned=\"1\"\u0026gt;\n \u0026lt;fo:block\u0026gt;\u0026lt;/fo:block\u0026gt;\n \u0026lt;/fo:table-cell\u0026gt;\n \u0026lt;/fo:table-row\u0026gt;\n \u0026lt;/fo:table-body\u0026gt;\n \u0026lt;/fo:table\u0026gt;\n \u0026lt;/fo:table-cell\u0026gt;\n \u0026lt;/fo:table-row\u0026gt;\n \u0026lt;/fo:table-body\u0026gt;\n \u0026lt;/fo:table\u0026gt;\n\n \u0026lt;!-- END Area Detail --\u0026gt;\n \u0026lt;/fo:block\u0026gt;\n \u0026lt;/fo:table-cell\u0026gt;\n \u0026lt;/fo:table-row\u0026gt;\n \u0026lt;fo:table-row\u0026gt;\n \u0026lt;fo:table-cell number-columns-spanned=\"1\"\u0026gt;\n \u0026lt;fo:block\u0026gt;\n\n \u0026lt;!-- START Area Footer --\u0026gt;\n \u0026lt;!-- ae182bb24f5648da9653ed5b997121c4 --\u0026gt;\n \u0026lt;fo:table width=\"17.0cm\"\u0026gt;\n \u0026lt;fo:table-column column-width=\"17.0cm\" /\u0026gt;\n \u0026lt;fo:table-body\u0026gt;\n \u0026lt;fo:table-row background-color=\"#ffffff\"\n height=\"1.5cm\"\u0026gt;\n \u0026lt;fo:table-cell\u0026gt;\n \u0026lt;fo:table\u0026gt;\n \u0026lt;fo:table-column column-width=\"17.0cm\" /\u0026gt;\n \u0026lt;fo:table-body\u0026gt;\n \u0026lt;fo:table-row background-color=\"#ffffff\"\n height=\"1.5cm\"\u0026gt;\n \u0026lt;fo:table-cell number-columns-spanned=\"1\"\u0026gt;\n \u0026lt;fo:block\u0026gt;\u0026lt;/fo:block\u0026gt;\n \u0026lt;/fo:table-cell\u0026gt;\n \u0026lt;/fo:table-row\u0026gt;\n \u0026lt;/fo:table-body\u0026gt;\n \u0026lt;/fo:table\u0026gt;\n \u0026lt;/fo:table-cell\u0026gt;\n \u0026lt;/fo:table-row\u0026gt;\n \u0026lt;/fo:table-body\u0026gt;\n \u0026lt;/fo:table\u0026gt;\n\n \u0026lt;!-- END Area Footer --\u0026gt;\n \u0026lt;/fo:block\u0026gt;\n \u0026lt;/fo:table-cell\u0026gt;\n \u0026lt;/fo:table-row\u0026gt;\n \u0026lt;/fo:table-body\u0026gt;\n \u0026lt;/fo:table\u0026gt;\n\n \u0026lt;!-- END Area Header --\u0026gt;\n \u0026lt;fo:block id=\"last-page\" /\u0026gt;\n \u0026lt;/fo:flow\u0026gt;\n \u0026lt;/fo:page-sequence\u0026gt;\n \u0026lt;/fo:root\u0026gt;\n\u0026lt;/xsl:template\u0026gt;\n\u0026lt;/xsl:stylesheet\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThis is what I expect as output:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;fo:wrapper xmlns:j4lif=\"http://java4less.com/fop/iform\"\nxmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns:j4lext=\"xalan://com.java4less.xreport.fop.XLSTExtension\"\nxmlns:j4luserext=\"xalan://com.java4less.xreport.fop.XLSTDummyExtension\"\nxmlns:fo=\"http://www.w3.org/1999/XSL/Format\"\u0026gt;\n\u0026lt;fo:table width=\"17.0cm\"\u0026gt;\n \u0026lt;fo:table-column column-width=\"17.0cm\" /\u0026gt;\n \u0026lt;!-- 63bbf10b61f44321913cffd695225a53 --\u0026gt;\n \u0026lt;fo:table-header\u0026gt;\n \u0026lt;fo:table-row background-color=\"#ffffff\" height=\"2.0cm\"\u0026gt;\n \u0026lt;fo:table-cell\u0026gt;\n \u0026lt;fo:table\u0026gt;\n \u0026lt;fo:table-column column-width=\"17.0cm\" /\u0026gt;\n \u0026lt;fo:table-body\u0026gt;\n \u0026lt;fo:table-row background-color=\"#ffffff\" height=\"2.0cm\"\u0026gt;\n \u0026lt;fo:table-cell number-columns-spanned=\"1\"\u0026gt;\n \u0026lt;fo:block /\u0026gt;\n \u0026lt;/fo:table-cell\u0026gt;\n \u0026lt;/fo:table-row\u0026gt;\n \u0026lt;/fo:table-body\u0026gt;\n \u0026lt;/fo:table\u0026gt;\n \u0026lt;/fo:table-cell\u0026gt;\n \u0026lt;/fo:table-row\u0026gt;\n \u0026lt;/fo:table-header\u0026gt;\n\u0026lt;/fo:table\u0026gt; \n\u0026lt;/fo:wrapper\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThis is what BaseX and Camel xQuery component actually outputs:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;fo:wrapper xmlns:j4lif=\"http://java4less.com/fop/iform\"\nxmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns:j4lext=\"xalan://com.java4less.xreport.fop.XLSTExtension\"\nxmlns:j4luserext=\"xalan://com.java4less.xreport.fop.XLSTDummyExtension\"\nxmlns:fo=\"http://www.w3.org/1999/XSL/Format\"\u0026gt;\n\u0026lt;fo:table width=\"17.0cm\"\u0026gt;\n \u0026lt;fo:table-column column-width=\"17.0cm\" /\u0026gt;\n \u0026lt;!-- 63bbf10b61f44321913cffd695225a53 --\u0026gt;\n \u0026lt;fo:table-header\u0026gt;\n \u0026lt;fo:table-row background-color=\"#ffffff\" height=\"2.0cm\"\u0026gt;\n \u0026lt;fo:table-cell\u0026gt;\n \u0026lt;fo:table\u0026gt;\n \u0026lt;fo:table-column column-width=\"17.0cm\" /\u0026gt;\n \u0026lt;fo:table-body\u0026gt;\n \u0026lt;fo:table-row background-color=\"#ffffff\" height=\"2.0cm\"\u0026gt;\n \u0026lt;fo:table-cell number-columns-spanned=\"1\"\u0026gt;\n \u0026lt;fo:block /\u0026gt;\n \u0026lt;/fo:table-cell\u0026gt;\n \u0026lt;/fo:table-row\u0026gt;\n \u0026lt;/fo:table-body\u0026gt;\n \u0026lt;/fo:table\u0026gt;\n \u0026lt;/fo:table-cell\u0026gt;\n \u0026lt;/fo:table-row\u0026gt;\n \u0026lt;/fo:table-header\u0026gt;\n \u0026lt;fo:table-body\u0026gt;\n \u0026lt;fo:table-row background-color=\"#ffffff\" height=\"4.0cm\"\u0026gt;\n \u0026lt;fo:table-cell\u0026gt;\n \u0026lt;fo:table\u0026gt;\n \u0026lt;fo:table-column column-width=\"17.0cm\" /\u0026gt;\n \u0026lt;fo:table-body\u0026gt;\n \u0026lt;fo:table-row background-color=\"#ffffff\" height=\"4.0cm\"\u0026gt;\n \u0026lt;fo:table-cell number-columns-spanned=\"1\"\u0026gt;\n \u0026lt;fo:block /\u0026gt;\n \u0026lt;/fo:table-cell\u0026gt;\n \u0026lt;/fo:table-row\u0026gt;\n \u0026lt;/fo:table-body\u0026gt;\n \u0026lt;/fo:table\u0026gt;\n \u0026lt;/fo:table-cell\u0026gt;\n \u0026lt;/fo:table-row\u0026gt;\n \u0026lt;/fo:table-body\u0026gt;\n\u0026lt;/fo:table\u0026gt;\n\u0026lt;fo:table width=\"17.0cm\"\u0026gt;\n \u0026lt;fo:table-column column-width=\"17.0cm\" /\u0026gt;\n \u0026lt;fo:table-body\u0026gt;\n \u0026lt;fo:table-row background-color=\"#ffffff\" height=\"1.5cm\"\u0026gt;\n \u0026lt;fo:table-cell\u0026gt;\n \u0026lt;fo:table\u0026gt;\n \u0026lt;fo:table-column column-width=\"17.0cm\" /\u0026gt;\n \u0026lt;fo:table-body\u0026gt;\n \u0026lt;fo:table-row background-color=\"#ffffff\" height=\"1.5cm\"\u0026gt;\n \u0026lt;fo:table-cell number-columns-spanned=\"1\"\u0026gt;\n \u0026lt;fo:block /\u0026gt;\n \u0026lt;/fo:table-cell\u0026gt;\n \u0026lt;/fo:table-row\u0026gt;\n \u0026lt;/fo:table-body\u0026gt;\n \u0026lt;/fo:table\u0026gt;\n \u0026lt;/fo:table-cell\u0026gt;\n \u0026lt;/fo:table-row\u0026gt;\n \u0026lt;/fo:table-body\u0026gt;\n\u0026lt;/fo:table\u0026gt;\n\u0026lt;/fo:wrapper\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI don't want that second table node. Since \u003ccode\u003e/fo:table[1]\u003c/code\u003e doesn't work, I've tried putting predicates in there such as \u003ccode\u003e/fo:table[fo:table-column/fo:table-row[2]]\u003c/code\u003e and nothing is returned. Oddly, even \u003ccode\u003e/fo:table[fo:table-column/fo:table-row]\u003c/code\u003e returns nothing, but \u003ccode\u003e/fo:table[fo:table-column]\u003c/code\u003e returns the same unwanted 2nd table node. Anyone have any idea what's going on here?\u003c/p\u003e","accepted_answer_id":"44786230","answer_count":"1","comment_count":"0","creation_date":"2017-06-27 16:58:34.423 UTC","last_activity_date":"2017-06-27 17:17:29.977 UTC","last_edit_date":"2017-06-27 17:17:29.977 UTC","last_editor_display_name":"","last_editor_user_id":"695343","owner_display_name":"","owner_user_id":"7959661","post_type_id":"1","score":"0","tags":"xml|xslt|xpath|xquery|fop","view_count":"87"} +{"id":"44785926","title":"I only want the first occurrence of a node in XML/XSLT document. XPath is returning all even with [1]","body":"\u003cp\u003eI need to select only the first occurrence of the \u003ccode\u003e\u0026lt;fo:table ...\u0026gt;\u003c/code\u003e node in the following XSL-FO templace, but xPath is returning all of them. Here is the XPath statement I'm using after creating a wrapper element with all the namespaces:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;fo:wrapper xmlns:fo=\"http://www.w3.org/1999/XSL/Format\"\n xmlns:j4luserext=\"xalan://com.java4less.xreport.fop.XLSTDummyExtension\"\n xmlns:j4lext=\"xalan://com.java4less.xreport.fop.XLSTExtension\"\n xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns:j4lif=\"http://java4less.com/fop/iform\"\u0026gt;\n\n {xsl:stylesheet/xsl:template/fo:root/fo:page-sequence/fo:flow/fo:table/\n fo:table-body/fo:table-row/fo:table-cell/fo:block/fo:table[1]}\n\u0026lt;/fo:wrapper\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAnd here is the XSL-FO input:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;?xml version=\"1.0\" encoding=\"UTF-8\"?\u0026gt;\n\u0026lt;xsl:stylesheet version=\"1.0\" xmlns:j4lif=\"http://java4less.com/fop/iform\"\nxmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns:j4lext=\"xalan://com.java4less.xreport.fop.XLSTExtension\"\nextension-element-prefixes=\"j4lext j4luserext\"\nxmlns:j4luserext=\"xalan://com.java4less.xreport.fop.XLSTDummyExtension\"\u0026gt;\n\u0026lt;xsl:template match=\"/\"\u0026gt;\n \u0026lt;fo:root xmlns:fo=\"http://www.w3.org/1999/XSL/Format\"\u0026gt;\n \u0026lt;fo:layout-cluster-manager-set\u0026gt;\n \u0026lt;fo:simple-page-cluster-manager cluster-manager-name=\"cluster-manager0\"\n page-width=\"21.0cm\" page-height=\"29.7cm\" margin-top=\"2.0cm\"\n margin-bottom=\"2.0cm\" margin-left=\"2.0cm\" margin-right=\"2.0cm\"\u0026gt;\n \u0026lt;fo:region-body region-name=\"body0\" margin-top=\"1.5cm\"\n margin-bottom=\"1.5cm\" /\u0026gt;\n \u0026lt;fo:region-before region-name=\"header0\" extent=\"1.5cm\" /\u0026gt;\n \u0026lt;fo:region-after region-name=\"footer0\" extent=\"1.5cm\" /\u0026gt;\n \u0026lt;/fo:simple-page-cluster-manager\u0026gt;\n \u0026lt;/fo:layout-cluster-manager-set\u0026gt;\n \u0026lt;fo:page-sequence cluster-manager-reference=\"cluster-manager0\"\u0026gt;\n \u0026lt;fo:static-content flow-name=\"header0\"\u0026gt;\n \u0026lt;!-- 846098b14a344ae29ebeb7d3c3ae73c0 --\u0026gt;\n \u0026lt;fo:table width=\"17.0cm\"\u0026gt;\n \u0026lt;fo:table-column column-width=\"17.0cm\" /\u0026gt;\n \u0026lt;fo:table-body\u0026gt;\n \u0026lt;fo:table-row background-color=\"#ffffff\" height=\"1.5cm\"\u0026gt;\n \u0026lt;fo:table-cell\u0026gt;\n \u0026lt;fo:table\u0026gt;\n \u0026lt;fo:table-column column-width=\"17.0cm\" /\u0026gt;\n \u0026lt;fo:table-body\u0026gt;\n \u0026lt;fo:table-row background-color=\"#ffffff\" height=\"1.5cm\"\u0026gt;\n \u0026lt;fo:table-cell number-columns-spanned=\"1\"\u0026gt;\n \u0026lt;fo:block\u0026gt;\u0026lt;/fo:block\u0026gt;\n \u0026lt;/fo:table-cell\u0026gt;\n \u0026lt;/fo:table-row\u0026gt;\n \u0026lt;/fo:table-body\u0026gt;\n \u0026lt;/fo:table\u0026gt;\n \u0026lt;/fo:table-cell\u0026gt;\n \u0026lt;/fo:table-row\u0026gt;\n \u0026lt;/fo:table-body\u0026gt;\n \u0026lt;/fo:table\u0026gt;\n \u0026lt;/fo:static-content\u0026gt;\n \u0026lt;fo:static-content flow-name=\"footer0\"\u0026gt;\n \u0026lt;!-- b468381816be4ef8bb31f448a8bf5b09 --\u0026gt;\n \u0026lt;fo:table width=\"17.0cm\"\u0026gt;\n \u0026lt;fo:table-column column-width=\"17.0cm\" /\u0026gt;\n \u0026lt;fo:table-body\u0026gt;\n \u0026lt;fo:table-row background-color=\"#ffffff\" height=\"1.5cm\"\u0026gt;\n \u0026lt;fo:table-cell\u0026gt;\n \u0026lt;fo:table\u0026gt;\n \u0026lt;fo:table-column column-width=\"17.0cm\" /\u0026gt;\n \u0026lt;fo:table-body\u0026gt;\n \u0026lt;fo:table-row background-color=\"#ffffff\" height=\"1.5cm\"\u0026gt;\n \u0026lt;fo:table-cell number-columns-spanned=\"1\"\u0026gt;\n \u0026lt;fo:block\u0026gt;\u0026lt;/fo:block\u0026gt;\n \u0026lt;/fo:table-cell\u0026gt;\n \u0026lt;/fo:table-row\u0026gt;\n \u0026lt;/fo:table-body\u0026gt;\n \u0026lt;/fo:table\u0026gt;\n \u0026lt;/fo:table-cell\u0026gt;\n \u0026lt;/fo:table-row\u0026gt;\n \u0026lt;/fo:table-body\u0026gt;\n \u0026lt;/fo:table\u0026gt;\n \u0026lt;/fo:static-content\u0026gt;\n \u0026lt;fo:flow flow-name=\"body0\"\u0026gt;\n\n \u0026lt;!-- START Area Header --\u0026gt;\n \u0026lt;!-- 4ce697eac861472391f5eac35a51db48 --\u0026gt;\n \u0026lt;fo:table width=\"17.0cm\"\u0026gt;\n \u0026lt;fo:table-column column-width=\"17.0cm\" /\u0026gt;\n \u0026lt;fo:table-body\u0026gt;\n \u0026lt;fo:table-row background-color=\"#ffffff\" height=\"1.5cm\"\u0026gt;\n \u0026lt;fo:table-cell\u0026gt;\n \u0026lt;fo:table\u0026gt;\n \u0026lt;fo:table-column column-width=\"17.0cm\" /\u0026gt;\n \u0026lt;fo:table-body\u0026gt;\n \u0026lt;fo:table-row background-color=\"#ffffff\" height=\"1.5cm\"\u0026gt;\n \u0026lt;fo:table-cell number-columns-spanned=\"1\"\u0026gt;\n \u0026lt;fo:block\u0026gt;\u0026lt;/fo:block\u0026gt;\n \u0026lt;/fo:table-cell\u0026gt;\n \u0026lt;/fo:table-row\u0026gt;\n \u0026lt;/fo:table-body\u0026gt;\n \u0026lt;/fo:table\u0026gt;\n \u0026lt;/fo:table-cell\u0026gt;\n \u0026lt;/fo:table-row\u0026gt;\n \u0026lt;fo:table-row\u0026gt;\n \u0026lt;fo:table-cell number-columns-spanned=\"1\"\u0026gt;\n \u0026lt;fo:block\u0026gt;\n\n \u0026lt;!-- START Area Detail --\u0026gt;\n \u0026lt;!-- 7f22844da7e94220b5877bf7593e1dcb --\u0026gt;\n \u0026lt;fo:table width=\"17.0cm\"\u0026gt;\n \u0026lt;fo:table-column column-width=\"17.0cm\" /\u0026gt;\n \u0026lt;!-- 63bbf10b61f44321913cffd695225a53 --\u0026gt;\n \u0026lt;fo:table-header\u0026gt;\n \u0026lt;fo:table-row background-color=\"#ffffff\"\n height=\"2.0cm\"\u0026gt;\n \u0026lt;fo:table-cell\u0026gt;\n \u0026lt;fo:table\u0026gt;\n \u0026lt;fo:table-column column-width=\"17.0cm\" /\u0026gt;\n \u0026lt;fo:table-body\u0026gt;\n \u0026lt;fo:table-row background-color=\"#ffffff\"\n height=\"2.0cm\"\u0026gt;\n \u0026lt;fo:table-cell number-columns-spanned=\"1\"\u0026gt;\n \u0026lt;fo:block\u0026gt;\u0026lt;/fo:block\u0026gt;\n \u0026lt;/fo:table-cell\u0026gt;\n \u0026lt;/fo:table-row\u0026gt;\n \u0026lt;/fo:table-body\u0026gt;\n \u0026lt;/fo:table\u0026gt;\n \u0026lt;/fo:table-cell\u0026gt;\n \u0026lt;/fo:table-row\u0026gt;\n \u0026lt;/fo:table-header\u0026gt;\n \u0026lt;fo:table-body\u0026gt;\n \u0026lt;fo:table-row background-color=\"#ffffff\"\n height=\"4.0cm\"\u0026gt;\n \u0026lt;fo:table-cell\u0026gt;\n \u0026lt;fo:table\u0026gt;\n \u0026lt;fo:table-column column-width=\"17.0cm\" /\u0026gt;\n \u0026lt;fo:table-body\u0026gt;\n \u0026lt;fo:table-row background-color=\"#ffffff\"\n height=\"4.0cm\"\u0026gt;\n \u0026lt;fo:table-cell number-columns-spanned=\"1\"\u0026gt;\n \u0026lt;fo:block\u0026gt;\u0026lt;/fo:block\u0026gt;\n \u0026lt;/fo:table-cell\u0026gt;\n \u0026lt;/fo:table-row\u0026gt;\n \u0026lt;/fo:table-body\u0026gt;\n \u0026lt;/fo:table\u0026gt;\n \u0026lt;/fo:table-cell\u0026gt;\n \u0026lt;/fo:table-row\u0026gt;\n \u0026lt;/fo:table-body\u0026gt;\n \u0026lt;/fo:table\u0026gt;\n\n \u0026lt;!-- END Area Detail --\u0026gt;\n \u0026lt;/fo:block\u0026gt;\n \u0026lt;/fo:table-cell\u0026gt;\n \u0026lt;/fo:table-row\u0026gt;\n \u0026lt;fo:table-row\u0026gt;\n \u0026lt;fo:table-cell number-columns-spanned=\"1\"\u0026gt;\n \u0026lt;fo:block\u0026gt;\n\n \u0026lt;!-- START Area Footer --\u0026gt;\n \u0026lt;!-- ae182bb24f5648da9653ed5b997121c4 --\u0026gt;\n \u0026lt;fo:table width=\"17.0cm\"\u0026gt;\n \u0026lt;fo:table-column column-width=\"17.0cm\" /\u0026gt;\n \u0026lt;fo:table-body\u0026gt;\n \u0026lt;fo:table-row background-color=\"#ffffff\"\n height=\"1.5cm\"\u0026gt;\n \u0026lt;fo:table-cell\u0026gt;\n \u0026lt;fo:table\u0026gt;\n \u0026lt;fo:table-column column-width=\"17.0cm\" /\u0026gt;\n \u0026lt;fo:table-body\u0026gt;\n \u0026lt;fo:table-row background-color=\"#ffffff\"\n height=\"1.5cm\"\u0026gt;\n \u0026lt;fo:table-cell number-columns-spanned=\"1\"\u0026gt;\n \u0026lt;fo:block\u0026gt;\u0026lt;/fo:block\u0026gt;\n \u0026lt;/fo:table-cell\u0026gt;\n \u0026lt;/fo:table-row\u0026gt;\n \u0026lt;/fo:table-body\u0026gt;\n \u0026lt;/fo:table\u0026gt;\n \u0026lt;/fo:table-cell\u0026gt;\n \u0026lt;/fo:table-row\u0026gt;\n \u0026lt;/fo:table-body\u0026gt;\n \u0026lt;/fo:table\u0026gt;\n\n \u0026lt;!-- END Area Footer --\u0026gt;\n \u0026lt;/fo:block\u0026gt;\n \u0026lt;/fo:table-cell\u0026gt;\n \u0026lt;/fo:table-row\u0026gt;\n \u0026lt;/fo:table-body\u0026gt;\n \u0026lt;/fo:table\u0026gt;\n\n \u0026lt;!-- END Area Header --\u0026gt;\n \u0026lt;fo:block id=\"last-page\" /\u0026gt;\n \u0026lt;/fo:flow\u0026gt;\n \u0026lt;/fo:page-sequence\u0026gt;\n \u0026lt;/fo:root\u0026gt;\n\u0026lt;/xsl:template\u0026gt;\n\u0026lt;/xsl:stylesheet\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThis is what I expect as output:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;fo:wrapper xmlns:j4lif=\"http://java4less.com/fop/iform\"\nxmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns:j4lext=\"xalan://com.java4less.xreport.fop.XLSTExtension\"\nxmlns:j4luserext=\"xalan://com.java4less.xreport.fop.XLSTDummyExtension\"\nxmlns:fo=\"http://www.w3.org/1999/XSL/Format\"\u0026gt;\n\u0026lt;fo:table width=\"17.0cm\"\u0026gt;\n \u0026lt;fo:table-column column-width=\"17.0cm\" /\u0026gt;\n \u0026lt;!-- 63bbf10b61f44321913cffd695225a53 --\u0026gt;\n \u0026lt;fo:table-header\u0026gt;\n \u0026lt;fo:table-row background-color=\"#ffffff\" height=\"2.0cm\"\u0026gt;\n \u0026lt;fo:table-cell\u0026gt;\n \u0026lt;fo:table\u0026gt;\n \u0026lt;fo:table-column column-width=\"17.0cm\" /\u0026gt;\n \u0026lt;fo:table-body\u0026gt;\n \u0026lt;fo:table-row background-color=\"#ffffff\" height=\"2.0cm\"\u0026gt;\n \u0026lt;fo:table-cell number-columns-spanned=\"1\"\u0026gt;\n \u0026lt;fo:block /\u0026gt;\n \u0026lt;/fo:table-cell\u0026gt;\n \u0026lt;/fo:table-row\u0026gt;\n \u0026lt;/fo:table-body\u0026gt;\n \u0026lt;/fo:table\u0026gt;\n \u0026lt;/fo:table-cell\u0026gt;\n \u0026lt;/fo:table-row\u0026gt;\n \u0026lt;/fo:table-header\u0026gt;\n\u0026lt;/fo:table\u0026gt; \n\u0026lt;/fo:wrapper\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThis is what BaseX and Camel xQuery component actually outputs:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;fo:wrapper xmlns:j4lif=\"http://java4less.com/fop/iform\"\nxmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns:j4lext=\"xalan://com.java4less.xreport.fop.XLSTExtension\"\nxmlns:j4luserext=\"xalan://com.java4less.xreport.fop.XLSTDummyExtension\"\nxmlns:fo=\"http://www.w3.org/1999/XSL/Format\"\u0026gt;\n\u0026lt;fo:table width=\"17.0cm\"\u0026gt;\n \u0026lt;fo:table-column column-width=\"17.0cm\" /\u0026gt;\n \u0026lt;!-- 63bbf10b61f44321913cffd695225a53 --\u0026gt;\n \u0026lt;fo:table-header\u0026gt;\n \u0026lt;fo:table-row background-color=\"#ffffff\" height=\"2.0cm\"\u0026gt;\n \u0026lt;fo:table-cell\u0026gt;\n \u0026lt;fo:table\u0026gt;\n \u0026lt;fo:table-column column-width=\"17.0cm\" /\u0026gt;\n \u0026lt;fo:table-body\u0026gt;\n \u0026lt;fo:table-row background-color=\"#ffffff\" height=\"2.0cm\"\u0026gt;\n \u0026lt;fo:table-cell number-columns-spanned=\"1\"\u0026gt;\n \u0026lt;fo:block /\u0026gt;\n \u0026lt;/fo:table-cell\u0026gt;\n \u0026lt;/fo:table-row\u0026gt;\n \u0026lt;/fo:table-body\u0026gt;\n \u0026lt;/fo:table\u0026gt;\n \u0026lt;/fo:table-cell\u0026gt;\n \u0026lt;/fo:table-row\u0026gt;\n \u0026lt;/fo:table-header\u0026gt;\n \u0026lt;fo:table-body\u0026gt;\n \u0026lt;fo:table-row background-color=\"#ffffff\" height=\"4.0cm\"\u0026gt;\n \u0026lt;fo:table-cell\u0026gt;\n \u0026lt;fo:table\u0026gt;\n \u0026lt;fo:table-column column-width=\"17.0cm\" /\u0026gt;\n \u0026lt;fo:table-body\u0026gt;\n \u0026lt;fo:table-row background-color=\"#ffffff\" height=\"4.0cm\"\u0026gt;\n \u0026lt;fo:table-cell number-columns-spanned=\"1\"\u0026gt;\n \u0026lt;fo:block /\u0026gt;\n \u0026lt;/fo:table-cell\u0026gt;\n \u0026lt;/fo:table-row\u0026gt;\n \u0026lt;/fo:table-body\u0026gt;\n \u0026lt;/fo:table\u0026gt;\n \u0026lt;/fo:table-cell\u0026gt;\n \u0026lt;/fo:table-row\u0026gt;\n \u0026lt;/fo:table-body\u0026gt;\n\u0026lt;/fo:table\u0026gt;\n\u0026lt;fo:table width=\"17.0cm\"\u0026gt;\n \u0026lt;fo:table-column column-width=\"17.0cm\" /\u0026gt;\n \u0026lt;fo:table-body\u0026gt;\n \u0026lt;fo:table-row background-color=\"#ffffff\" height=\"1.5cm\"\u0026gt;\n \u0026lt;fo:table-cell\u0026gt;\n \u0026lt;fo:table\u0026gt;\n \u0026lt;fo:table-column column-width=\"17.0cm\" /\u0026gt;\n \u0026lt;fo:table-body\u0026gt;\n \u0026lt;fo:table-row background-color=\"#ffffff\" height=\"1.5cm\"\u0026gt;\n \u0026lt;fo:table-cell number-columns-spanned=\"1\"\u0026gt;\n \u0026lt;fo:block /\u0026gt;\n \u0026lt;/fo:table-cell\u0026gt;\n \u0026lt;/fo:table-row\u0026gt;\n \u0026lt;/fo:table-body\u0026gt;\n \u0026lt;/fo:table\u0026gt;\n \u0026lt;/fo:table-cell\u0026gt;\n \u0026lt;/fo:table-row\u0026gt;\n \u0026lt;/fo:table-body\u0026gt;\n\u0026lt;/fo:table\u0026gt;\n\u0026lt;/fo:wrapper\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI don't want that second table node. Since \u003ccode\u003e/fo:table[1]\u003c/code\u003e doesn't work, I've tried putting predicates in there such as \u003ccode\u003e/fo:table[fo:table-column/fo:table-row[2]]\u003c/code\u003e and nothing is returned. Oddly, even \u003ccode\u003e/fo:table[fo:table-column/fo:table-row]\u003c/code\u003e returns nothing, but \u003ccode\u003e/fo:table[fo:table-column]\u003c/code\u003e returns the same unwanted 2nd table node. Anyone have any idea what's going on here?\u003c/p\u003e","accepted_answer_id":"44786230","answer_count":"1","comment_count":"0","creation_date":"2017-06-27 16:58:34.423 UTC","last_activity_date":"2017-06-27 17:17:29.977 UTC","last_edit_date":"2017-06-27 17:17:29.977 UTC","last_editor_display_name":"","last_editor_user_id":"695343","owner_display_name":"","owner_user_id":"7959661","post_type_id":"1","score":"0","tags":"xml|xslt|xpath|xquery|fop","view_count":"87"} {"id":"16748320","title":"Error in importing a csv file in mongoDB2.4","body":"\u003cp\u003eI have installed mongoDB2.4 installed in my windows 7 os. I am new to mongoDB. I would like to import data from a csv file into the database. I have used the mongoimport command but it shows: \nJavascript execution failed: Syntax error: Unexpected identifier\u003c/p\u003e\n\n\u003cp\u003emy command in mongo shell was:\u003c/p\u003e\n\n\u003cblockquote\u003e\n \u003cp\u003emongoimport --db mentalhealth --collection bidyut --type csv --file \\Users\\Adrian\\Desktop\\Data_sorted.csv\u003c/p\u003e\n\u003c/blockquote\u003e\n\n\u003cp\u003ePLEASE kindly provide an answer.\u003c/p\u003e","answer_count":"0","comment_count":"2","creation_date":"2013-05-25 09:47:29.707 UTC","last_activity_date":"2013-05-25 09:47:29.707 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"2419948","post_type_id":"1","score":"0","tags":"mongodb","view_count":"433"} {"id":"18898158","title":"Brew gettext on Mac OS X Terminal","body":"\u003cp\u003eI installed gettext with brew and the path to gettext is\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e/usr/local/Cellar/gettext/0.18.3.1/bin\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003emy PHP-Project is located under \u003ccode\u003e/Applications/XAMPP/xamppfiles/htdocs/projectMine\u003c/code\u003e\u003c/p\u003e\n\n\u003cp\u003eThe files I want to translate are in \u003ccode\u003e/Applications/XAMPP/xamppfiles/htdochs/projectMine/public_html\u003c/code\u003e\u003c/p\u003e\n\n\u003cp\u003eWhen I'm now in the \u003ccode\u003ebin\u003c/code\u003e folder I type\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e./gettext /Applications/XAMPP/xamppfiles/htdocs/projectMine/public_html\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI also tried this one here, but this didn't seem to work either.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e/usr/local/Cellar/gettext/0.18.3.1/bin/gettext -n /Applications/PATHTOFOLDER\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ebut this results in nothing. What is the exact command to achieve this. I'm new to Mac and Terminal, because I'm normally a Windows user. \u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2013-09-19 14:58:31.45 UTC","last_activity_date":"2013-09-24 13:54:00.407 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"2271652","post_type_id":"1","score":"-1","tags":"php|osx|gettext","view_count":"795"} {"id":"2536358","title":"Adding multile row in the girdview","body":"\u003cp\u003eAdding the row one by one in the button click..\n(i tried but its overwirting the same row)\u003c/p\u003e","accepted_answer_id":"2536960","answer_count":"3","comment_count":"2","creation_date":"2010-03-29 07:27:35.787 UTC","last_activity_date":"2010-03-30 08:17:19.813 UTC","last_edit_date":"2010-03-29 08:35:18.043 UTC","last_editor_display_name":"","last_editor_user_id":"304018","owner_display_name":"","owner_user_id":"304018","post_type_id":"1","score":"0","tags":"asp.net","view_count":"141"} @@ -1972,7 +1972,7 @@ {"id":"913745","title":"Interfacing zlib with ActiveTcl 8.5?","body":"\u003cp\u003eI'm trying to use the zlib extension in ActiveTcl 8.5 in order to save out a compressed blob to a file. Both ActiveTcl 8.5.5 and 8.5.6 on win32 have a zlibtcl 1.2.3 extension. I've tried both:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epackage require zlibtcl\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eand\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eload zlibtcl123.dll \n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhich both seem to indicate that the extension is properly loaded. However, I can't seem to figure out what command is necessary to access the extension. I am aware that ActiveTcl 8.6b1 onwards has the zlib functionality built in (\u003ca href=\"http://wiki.tcl.tk/4610\" rel=\"nofollow noreferrer\"\u003ehttp://wiki.tcl.tk/4610\u003c/a\u003e), however I need to deploy to existing systems that must use 8.5.x.\u003c/p\u003e\n\n\u003cp\u003eAs far as I can tell, loading the extension does not add any new commands to the interpreter, which is quite confusing. Running a \u003cstrong\u003estrings\u003c/strong\u003e on the dll does not seem to reveal any additional information.\u003c/p\u003e\n\n\u003cp\u003eNote: my backup plan is to SWIG zlib, but I'd prefer to use the existing extension if possible.\u003c/p\u003e","answer_count":"3","comment_count":"0","creation_date":"2009-05-27 02:58:49.97 UTC","favorite_count":"1","last_activity_date":"2010-09-17 12:19:56.437 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"6034","post_type_id":"1","score":"1","tags":"tcl|zlib|activetcl","view_count":"925"} {"id":"33729303","title":"how to make images responsive in a bootstrap template","body":"\u003cp\u003eI know this had been asked a lot and I did research and try a lot before posting this question, but nothing seems to work. I have two images and a text which I want to display all in one line. However, when I decrease my window size the images are displayed below and above the text instead of next to it. \nI have the following code and here's a \u003ca href=\"http://jsfiddle.net/hbedhdxo/\" rel=\"nofollow\"\u003efiddle\u003c/a\u003e: \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;div class=\"row\"\u0026gt;\n \u0026lt;div class=\"col-md-4\"\u0026gt;\n \u0026lt;img src=\"image.jpg\" class=\"images\"\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;div class=\"col-md-4\"\u0026gt;\n \u0026lt;div class=\"text\"\u0026gt;\n \u0026lt;h2 class=\"featurette-heading\"\u0026gt;What's Included with HTML?\u0026lt;/h2\u0026gt;\n \u0026lt;p class=\"lead\"\u0026gt;Tags to make words. And tons of CSS properties to style your page:\u0026lt;/p\u0026gt;\n \u0026lt;/div\u0026gt;\n\u0026lt;/div\u0026gt;\n \u0026lt;div class=\"col-md-4\"\u0026gt;\n \u0026lt;img src=\"image.jpg\" alt=\"Chrome Browser\" class=\"images\"\u0026gt;\u0026lt;/div\u0026gt;\n\u0026lt;/div\u0026gt; \n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e \u003c/p\u003e\n\n\u003cp\u003eHow do I make the images resize according to the window size so that images and text are all displayed in one line?\u003c/p\u003e\n\n\u003cp\u003eI tried \u003ccode\u003ewidth:100%;height auto;\u003c/code\u003e and \u003ccode\u003emax-width:100%;\u003c/code\u003e and all sorts of combinations in order to make them responsive but it nothing worked so far. \u003c/p\u003e\n\n\u003cp\u003eThanks in advance! \u003c/p\u003e","answer_count":"4","comment_count":"0","creation_date":"2015-11-16 05:58:16.977 UTC","last_activity_date":"2015-11-16 08:35:15.29 UTC","last_edit_date":"2015-11-16 06:15:00.427 UTC","last_editor_display_name":"","last_editor_user_id":"4930607","owner_display_name":"","owner_user_id":"4930607","post_type_id":"1","score":"1","tags":"html|css|image|twitter-bootstrap","view_count":"491"} {"id":"18316494","title":"running a java project from command line using classpath issue?","body":"\u003cp\u003eI am trying to run a java project from the command line in linux, my project uses two external jar files. The command that i am givin is\u003c/p\u003e\n\n\u003cp\u003ejava -classpath -jar bin:common-cli-1.2.jar:BuildFrameworkLibrary.jar com.kpit.goa.common.tools.kivibuild.KIVIBuild \u003c/p\u003e\n\n\u003cp\u003ewhere KIVIBuild is the class that contains the main function. But the error that am getting is:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ebaibhav@baibhav:~/git/KiviBuild/Infra/RepoManagement/BuildManagement/KIVIBuild$ java -classpath bin:common-cli-1.2.jar:BuildFrameworkLibrary.jar com.kpit.goa.common.tools.kivibuild.KIVIBuild\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eGives\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eException in thread \"main\" java.lang.NoClassDefFoundError: org/apache/commons/cli/ParseException\nCaused by: java.lang.ClassNotFoundException: org.apache.commons.cli.ParseException\n at java.net.URLClassLoader$1.run(URLClassLoader.java:217)\n at java.security.AccessController.doPrivileged(Native Method)\n at java.net.URLClassLoader.findClass(URLClassLoader.java:205)\n at java.lang.ClassLoader.loadClass(ClassLoader.java:321)\n at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)\n at java.lang.ClassLoader.loadClass(ClassLoader.java:266)\nCould not find the main class: com.kpit.goa.common.tools.kivibuild.KIVIBuild. Program will exit.\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"18316618","answer_count":"2","comment_count":"2","creation_date":"2013-08-19 14:36:43.633 UTC","last_activity_date":"2013-08-19 15:36:58.14 UTC","last_edit_date":"2013-08-19 14:38:18.277 UTC","last_editor_display_name":"","last_editor_user_id":"438154","owner_display_name":"","owner_user_id":"2377460","post_type_id":"1","score":"0","tags":"java","view_count":"3434"} -{"id":"37321326","title":"Unable to analyse dictionary validate expression for field Drawing?","body":"\u003cp\u003eI got \"Unable to analyse dictionary validate expression for field Drawing. \"this error when compling below program how to resolve this?\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e/*Sample Item master Maintenance Program*/ \n/* DISPLAY TITLE */ \n{us/mf/mfdtitle.i \"3+ \"} \nform\n pt_part colon 25\n with frame a side-labels width 80.\n/* SET EXTERNAL LABELS */\nsetFrameLabels(frame a:handle).\n\nform\n \"Enter the Value of\" pt__qad13 colon 30 skip(1)\n \"Enter the Value of\" pt_draw colon 30 skip(1)\n \"Enter the Value of\" pt_group colon 30\n with frame b side-labels width 80.\nsetFrameLabels(frame b:handle).\nview frame a. \nrepeat with frame a: \n prompt-for pt_part \n editing: \n /* FIND NEXT/PREVIOUS RECORD */ \n {us/mf/mfnp.i pt_mstr pt_part \"pt_mstr.pt_domain = global_domain and pt_part\" pt_part pt_part pt_part } \n if recno \u0026lt;\u0026gt; ? then \n do: \n display pt_part. \n end.\n end.\n find pt_mstr exclusive-lock where pt_domain = global_domain and pt_part = input pt_part .\n disp pt__qad13 pt_draw pt_group with frame b.\n update pt__qad13 pt_draw pt_group with frame b.\n\nend.\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"1","comment_count":"2","creation_date":"2016-05-19 11:04:39.037 UTC","last_activity_date":"2016-11-10 05:39:30.147 UTC","last_edit_date":"2016-05-20 18:58:45.43 UTC","last_editor_display_name":"","last_editor_user_id":"123238","owner_display_name":"","owner_user_id":"6314225","post_type_id":"1","score":"0","tags":"progress-4gl|openedge","view_count":"115"} +{"id":"37321326","title":"Unable to analyse dictionary validate expression for field Drawing?","body":"\u003cp\u003eI got \"Unable to analyse dictionary validate expression for field Drawing. \"this error when compling below program how to resolve this?\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e/*Sample Item cluster manager Maintenance Program*/ \n/* DISPLAY TITLE */ \n{us/mf/mfdtitle.i \"3+ \"} \nform\n pt_part colon 25\n with frame a side-labels width 80.\n/* SET EXTERNAL LABELS */\nsetFrameLabels(frame a:handle).\n\nform\n \"Enter the Value of\" pt__qad13 colon 30 skip(1)\n \"Enter the Value of\" pt_draw colon 30 skip(1)\n \"Enter the Value of\" pt_group colon 30\n with frame b side-labels width 80.\nsetFrameLabels(frame b:handle).\nview frame a. \nrepeat with frame a: \n prompt-for pt_part \n editing: \n /* FIND NEXT/PREVIOUS RECORD */ \n {us/mf/mfnp.i pt_mstr pt_part \"pt_mstr.pt_domain = global_domain and pt_part\" pt_part pt_part pt_part } \n if recno \u0026lt;\u0026gt; ? then \n do: \n display pt_part. \n end.\n end.\n find pt_mstr exclusive-lock where pt_domain = global_domain and pt_part = input pt_part .\n disp pt__qad13 pt_draw pt_group with frame b.\n update pt__qad13 pt_draw pt_group with frame b.\n\nend.\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"1","comment_count":"2","creation_date":"2016-05-19 11:04:39.037 UTC","last_activity_date":"2016-11-10 05:39:30.147 UTC","last_edit_date":"2016-05-20 18:58:45.43 UTC","last_editor_display_name":"","last_editor_user_id":"123238","owner_display_name":"","owner_user_id":"6314225","post_type_id":"1","score":"0","tags":"progress-4gl|openedge","view_count":"115"} {"id":"39882085","title":"How to make HTML buttons responsive","body":"\u003cp\u003eHere is the code for a basic website I'm making. I'm doing it for a school project.\u003c/p\u003e\n\n\u003cp\u003e\u003cdiv class=\"snippet\" data-lang=\"js\" data-hide=\"false\" data-console=\"true\" data-babel=\"false\"\u003e\r\n\u003cdiv class=\"snippet-code\"\u003e\r\n\u003cpre class=\"snippet-code-css lang-css prettyprint-override\"\u003e\u003ccode\u003e.html-button {\r\n font-family: 'Hammersmith One', sans-serif;\r\n font-size: 20px;\r\n color: white;\r\n position: absolute;\r\n top: 55%;\r\n left: 45%;\r\n text-align: center;\r\n -webkit-transform: translate3d(-50%, -50%, 0);\r\n -o-transform: translate3d(-50%, -50%, 0);\r\n -webkit-border-radius: 8;\r\n border-radius: 8px;\r\n font-size: 21px;\r\n background: #42A5F6;\r\n padding: 10px 20px 10px 20px;\r\n text-decoration: none;\r\n -webkit-transition-duration: 0.7s;\r\n /* Safari */\r\n transition-duration: 0.7s;\r\n border: none;\r\n cursor: pointer;\r\n}\r\n.html-button:hover {\r\n background: #0090FF;\r\n text-decoration: none;\r\n color: black;\r\n}\r\n.css-button {\r\n font-family: 'Hammersmith One', sans-serif;\r\n font-size: 20px;\r\n color: white;\r\n position: absolute;\r\n top: 55%;\r\n left: 55.3%;\r\n text-align: center;\r\n -webkit-transform: translate3d(-50%, -50%, 0);\r\n -o-transform: translate3d(-50%, -50%, 0);\r\n -webkit-border-radius: 8;\r\n border-radius: 8px;\r\n font-size: 21px;\r\n background: #42A5F6;\r\n padding: 10px 20px 10px 20px;\r\n text-decoration: none;\r\n -webkit-transition-duration: 0.7s;\r\n /* Safari */\r\n transition-duration: 0.7s;\r\n border: none;\r\n cursor: pointer;\r\n}\r\n.css-button:hover {\r\n background: #0090FF;\r\n text-decoration: none;\r\n color: black;\r\n}\u003c/code\u003e\u003c/pre\u003e\r\n\u003cpre class=\"snippet-code-html lang-html prettyprint-override\"\u003e\u003ccode\u003e\u0026lt;button class=\"html-button\" role=\"button\"\u0026gt;VIEW HTML\u0026lt;/button\u0026gt;\r\n\u0026lt;button class=\"css-button\" role=\"button\"\u0026gt;VIEW CSS\u0026lt;/button\u0026gt;\u003c/code\u003e\u003c/pre\u003e\r\n\u003c/div\u003e\r\n\u003c/div\u003e\r\n\u003c/p\u003e\n\n\u003cp\u003eThat is not my entire code, but that's the main part that I'm focusing on here. This will display 2 separate buttons (decorated with CSS), on my screen, they are the perfect length apart, however currently, when I make my browser smaller, the buttons push closer together as it gets smaller, how might I prevent this?\u003c/p\u003e","accepted_answer_id":"39882235","answer_count":"2","comment_count":"8","creation_date":"2016-10-05 19:23:01.5 UTC","last_activity_date":"2016-10-05 19:41:00.07 UTC","last_edit_date":"2016-10-05 19:26:44.84 UTC","last_editor_display_name":"","last_editor_user_id":"6496010","owner_display_name":"user6566659","post_type_id":"1","score":"0","tags":"html|css","view_count":"102"} {"id":"8994060","title":"google app engine get_serving_url() is not defined","body":"\u003cp\u003eIt seems like an easy problem yet I cant figure it out:\u003c/p\u003e\n\n\u003cp\u003eI call \u003ccode\u003eget_serving_url()\u003c/code\u003e function in my code and get en error:\u003c/p\u003e\n\n\u003cblockquote\u003e\n \u003cp\u003eNameError: global name 'get_serving_url' is not defined\u003c/p\u003e\n\u003c/blockquote\u003e\n\n\u003cp\u003emy import statement currently looks like:\nfrom google.appengine.api import images\u003c/p\u003e\n\n\u003cp\u003ebefore i tried various \"from PIL import Image\" and got import errors.\ni recently installed the PIL library\u003c/p\u003e\n\n\u003cp\u003eI have site-packages and PIL folder on my python path\u003c/p\u003e\n\n\u003cp\u003ehow do I make \u003ccode\u003eget_serving_url()\u003c/code\u003e work?\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2012-01-24 20:58:45.01 UTC","last_activity_date":"2012-01-24 21:09:25.59 UTC","last_edit_date":"2012-01-24 21:04:09.47 UTC","last_editor_display_name":"","last_editor_user_id":"1101070","owner_display_name":"","owner_user_id":"1167937","post_type_id":"1","score":"1","tags":"python|google-app-engine|import|python-imaging-library","view_count":"600"} {"id":"40575322","title":"Which defaulted methods are needed in purely abstract base classes?","body":"\u003cp\u003eAs Scott Meyers points out in \"Effective Modern C++\", no move constructor is generated if a class defines a destructor.\u003c/p\u003e\n\n\u003cp\u003eIt is not clear to me what that means for abstract base classes, which need to define a (defaulted) virtual destructor.\u003c/p\u003e\n\n\u003cp\u003eI do not want the lack of auto-generated methods in my base class to prevent the auto-generation of methods in any derived class.\u003c/p\u003e\n\n\u003cp\u003eThe focus is only on derived classes, since the abstract base class does not have any data members, so there is no difference between moving and copying the base class. Yet what does it mean for a derived class if its base can only be copied, but not moved?\u003c/p\u003e\n\n\u003cp\u003eWhich lines in the following class definition are unnecessary?\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003estruct AbstractBase {\n AbstractBase () = default;\n AbstractBase (AbstractBase const \u0026amp;) = default;\n AbstractBase (AbstractBase \u0026amp;\u0026amp;) = default;\n AbstractBase \u0026amp; operator = (AbstractBase const \u0026amp;) = default;\n AbstractBase \u0026amp; operator = (AbstractBase \u0026amp;\u0026amp;) = default;\n virtual ~AbstractBase () = default;\n\n virtual void f () = 0;\n};\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"0","comment_count":"2","creation_date":"2016-11-13 15:09:37.513 UTC","last_activity_date":"2016-11-13 15:09:37.513 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1419315","post_type_id":"1","score":"0","tags":"c++|abstract-class","view_count":"27"} @@ -2016,7 +2016,7 @@ {"id":"15858228","title":"Ajax - how to make every link/form on the page reload only part of that page?","body":"\u003cp\u003eI have a website, and I want to keep part of it static. Now, in order to do that, I need to replace single div, something like that:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;html\u0026gt;\n \u0026lt;head\u0026gt;\n \u0026lt;/head\u0026gt;\n \u0026lt;body\u0026gt;\n \u0026lt;div id=\"contentToReplace\"\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;div id=\"myStaticContent\"\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;/body\u0026gt;\n\u0026lt;/html\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eNow, how can I catch all clicks on anchors and clicks on forms submit button, and reload \u003ccode\u003econtentToReplace\u003c/code\u003e? I tried using \u003ccode\u003ejQuery.load()\u003c/code\u003e and it was perfect, but it was not loading scripts, and I need those. Also, I don't know how to submit forms with ajax requests.\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2013-04-07 02:28:39.723 UTC","last_activity_date":"2013-04-07 03:00:42.653 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1593783","post_type_id":"1","score":"0","tags":"javascript|jquery|html|ajax","view_count":"281"} {"id":"22069642","title":"FPDF not showing more than one image","body":"\u003cp\u003eBelow is a little snippet which works fine, it shows me a PDF file, but with only the last image I set. \u003c/p\u003e\n\n\u003cp\u003eWhat is wrong in my code?\nI didn't found documentation for ASP FPDF, only for PHP.\nAny help is apreciated. Thanks!\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;%@language=vbscript%\u0026gt;\n\u0026lt;!--#include file=\"fpdf.asp\"--\u0026gt;\n\u0026lt;%Response.ContentType=\"application/pdf\"%\u0026gt;\n\n\u0026lt;%\nimgCat = \"..\\fc_img\\cat.jpg\"\nimgDog = \"..\\fc_img\\dog.jpg\"\nSet pdf=CreateJsObject(\"FPDF\")\npdf.CreatePDF \"L\", \"mm\", \"A4\"\npdf.SetPath(\"fpdf/\")\npdf.Open()\n\npdf.AddPage()\n\npdf.SetTitle \"Life is a b1tch\"\npdf.Image imgDog , 10, 10, 20, 20\npdf.Image imgCat , 40, 40, 20, 20\n\npdf.Close()\npdf.Output()\n%\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"22299172","answer_count":"1","comment_count":"2","creation_date":"2014-02-27 13:14:15.613 UTC","last_activity_date":"2014-03-10 16:04:22.247 UTC","last_edit_date":"2014-03-10 15:28:14.367 UTC","last_editor_display_name":"","last_editor_user_id":"692942","owner_display_name":"","owner_user_id":"598591","post_type_id":"1","score":"1","tags":"javascript|pdf|vbscript|asp-classic|fpdf","view_count":"331"} {"id":"3140112","title":"How to design non-EJB load balanced applications?","body":"\u003cp\u003eI have a java class \u003ccode\u003eProcessor\u003c/code\u003e that is listening to a jms topic and it is struggling to keep up with the speed in which messages are arriving so we've decided to go concurrent: \u003c/p\u003e\n\n\u003cp\u003eA single class listening to the topic who's job is to hand the messages out to a pool of worker threads, effectively being a load balancer. It also has to prevent 2 workers processing messages for the same customer.\u003c/p\u003e\n\n\u003cp\u003eI expected there to be quite a lot of information on the internet about this but everything seems to suggest the use of EJBs where the app server manages the pool and does the balancing. I'm sure this must be a really common problem, but can't seem to find any libraries or design patterns to assist. Am I making more out of it than it is and should just delve in and write my own code?\u003c/p\u003e","accepted_answer_id":"3140655","answer_count":"2","comment_count":"2","creation_date":"2010-06-29 11:17:20.68 UTC","favorite_count":"0","last_activity_date":"2010-06-29 12:53:34.16 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"374265","post_type_id":"1","score":"1","tags":"java|jms|load-balancing|worker-thread","view_count":"207"} -{"id":"31577121","title":"Configure Git to show warning on pushing to different branch than current branch","body":"\u003cp\u003eIs there a way to configure Git/Github to prompt with a warning message upon this scenario:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e$\u0026gt; git branch\n$\u0026gt; *my_special_branch\n$\u0026gt; git commit -am \"I am about to make a grave error\"\n$\u0026gt; git push origin master\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ebasically I want to prevent myself and my team from pushing to a different remote branch than the current one I am on without a warning or confirmation prompt...\u003c/p\u003e\n\n\u003cp\u003eso basically I want to prevent pushing to the \u003cem\u003eremote\u003c/em\u003e master branch from any branch but a \u003cem\u003elocal\u003c/em\u003e master branch...\u003c/p\u003e","accepted_answer_id":"32302570","answer_count":"3","comment_count":"4","creation_date":"2015-07-23 02:19:55.62 UTC","last_activity_date":"2015-08-31 00:38:20.94 UTC","last_edit_date":"2015-07-23 05:35:33.57 UTC","last_editor_display_name":"","last_editor_user_id":"1223975","owner_display_name":"","owner_user_id":"1223975","post_type_id":"1","score":"3","tags":"git|github","view_count":"171"} +{"id":"31577121","title":"Configure Git to show warning on pushing to different branch than current branch","body":"\u003cp\u003eIs there a way to configure Git/Github to prompt with a warning message upon this scenario:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e$\u0026gt; git branch\n$\u0026gt; *my_special_branch\n$\u0026gt; git commit -am \"I am about to make a grave error\"\n$\u0026gt; git push origin main\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ebasically I want to prevent myself and my team from pushing to a different remote branch than the current one I am on without a warning or confirmation prompt...\u003c/p\u003e\n\n\u003cp\u003eso basically I want to prevent pushing to the \u003cem\u003eremote\u003c/em\u003e main branch from any branch but a \u003cem\u003elocal\u003c/em\u003e main branch...\u003c/p\u003e","accepted_answer_id":"32302570","answer_count":"3","comment_count":"4","creation_date":"2015-07-23 02:19:55.62 UTC","last_activity_date":"2015-08-31 00:38:20.94 UTC","last_edit_date":"2015-07-23 05:35:33.57 UTC","last_editor_display_name":"","last_editor_user_id":"1223975","owner_display_name":"","owner_user_id":"1223975","post_type_id":"1","score":"3","tags":"git|github","view_count":"171"} {"id":"44430760","title":"add CCS style which depends on php IF statement inside mysqli_fetch_array","body":"\u003cp\u003eI want to add CCS style which depends on php IF statement. I have found something: \u003ca href=\"https://stackoverflow.com/questions/7170498/changing-the-style-inside-if-statement\"\u003echanging the style inside \u0026quot;if\u0026quot; statement\u003c/a\u003e, but somehow it doesn`t work, maybe because of WHILE statement in my code.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;?php\n$possible_lang_list = mysqli_query($con, \n'SELECT * FROM page WHERE title = \"lang\" ORDER BY name1 ASC');\n\nwhile ($row = mysqli_fetch_array($possible_lang_list)) {\n echo '\n \u0026lt;div class=\"language\" id=\"' . $row['name2'] . '\"\u0026gt;\n \u0026lt;p\u0026gt;' . $row['name1'] . '\u0026lt;/p\u0026gt;\n \u0026lt;/div\u0026gt;\n ';\n}\n?\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI want to display only div class=\"language\" where $row['name2'] == $x, with possibility to display whole class \"language\" with JavaScript. Could anyone help?\u003c/p\u003e\n\n\u003cp\u003eI have tried:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e while ($row = mysqli_fetch_array($possible_lang_list)) {\n if ($row['name2'] == $x) {\n ?\u0026gt;\n \u0026lt;div style=\"display:block;\"\u0026gt;\n \u0026lt;?php } else {\n ?\u0026gt;\n \u0026lt;div style=\"display:none;\"\u0026gt;\n \u0026lt;?php\n echo '\n \u0026lt;div class=\"\" id=\"' . $row['name2'] . '\"\u0026gt;\n \u0026lt;p\u0026gt;' . $row['name1'] . '\u0026lt;/p\u0026gt;\n\n \u0026lt;/div\u0026gt;\n \u0026lt;/div\u0026gt;';\n }\n}\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"44431046","answer_count":"3","comment_count":"2","creation_date":"2017-06-08 08:41:49.393 UTC","last_activity_date":"2017-06-08 09:06:16.867 UTC","last_edit_date":"2017-06-08 08:51:20.897 UTC","last_editor_display_name":"","last_editor_user_id":"7719929","owner_display_name":"","owner_user_id":"7719929","post_type_id":"1","score":"0","tags":"php|css|mysqli","view_count":"24"} {"id":"15266821","title":"Creating a Table Model component using Netbeans","body":"\u003cp\u003eI'm trying to create a custom table model, but I got stuck.\u003c/p\u003e\n\n\u003cp\u003eI want to create a table model and bind it using the Netbeans GUI. However, as you can see on the screenshot, the Component dropdown is inactive. \u003c/p\u003e\n\n\u003cp\u003eHow can I create such a model component, and where do I put it?\u003c/p\u003e\n\n\u003cp\u003e\u003cimg src=\"https://i.stack.imgur.com/RaKLr.png\" alt=\"enter image description here\"\u003e\u003c/p\u003e","answer_count":"0","comment_count":"3","creation_date":"2013-03-07 08:57:21.953 UTC","last_activity_date":"2013-03-07 08:59:04.73 UTC","last_edit_date":"2013-03-07 08:59:04.73 UTC","last_editor_display_name":"","last_editor_user_id":"418556","owner_display_name":"","owner_user_id":"1358522","post_type_id":"1","score":"0","tags":"java|swing|netbeans|tablemodel","view_count":"1083"} {"id":"40294324","title":"Canvas.drawImage simply just does not draw the image","body":"\u003cp\u003ei'm trying to generate a tile-based-map, which works just fine so far, but after replacing all the \"test-rectangles\" with images to represent the ground, the path, some houses etc. (in this case its the same image for all of them), not a single image gets drawn down.\u003c/p\u003e\n\n\u003cp\u003eWhat am i doing wrong here? I also get zero errors.\u003c/p\u003e\n\n\u003cp\u003eHeres the code snipped:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e // generate a large map \n Map.prototype.generate = function(){\n var ctx = document.createElement(\"canvas\").getContext(\"2d\"); \n ctx.canvas.width = this.width;\n ctx.canvas.height = this.height; \n\n var rows = ~~(this.width/\u0026lt;?php echo $GAME['map']['tileSize'] + $GAME['map']['tileBorder']; ?\u0026gt;) + 1;\n var columns = ~~(this.height/\u0026lt;?php echo $GAME['map']['tileSize'] + $GAME['map']['tileBorder']; ?\u0026gt;) + 1;\n\n ctx.save(); \n\n // Here i wanted to check if the image gets drawn right besides the player\n var testImage = document.createElement('img'); // Also tried new Image();\n testImage.onload = (function () {\n console.log(testImage + \"-test\");\n ctx.drawImage(testImage, 1000, 1000, \u0026lt;?php echo $GAME['map']['tileSize']; ?\u0026gt;, \u0026lt;?php echo $GAME['map']['tileSize']; ?\u0026gt;);\n }());\n testImage.src = \"http://192.168.0.140/img/terrain.png\";\n\n var imgs = [];\n var imgIndex = 0;\n\n \u0026lt;?php echo \"for (var y = 0, i = \".$tilesToLoad['xStart'].\"; i \u0026lt; \".($tilesToLoad['xStart'] + $GAME['map']['chunkSize']).\"; y+=\".($GAME['map']['tileSize'] + $GAME['map']['tileBorder']).\", i++) {\"; ?\u0026gt;\n\n \u0026lt;?php echo \"for (var x = 0, j = \".$tilesToLoad['yStart'].\"; j \u0026lt; \".($tilesToLoad['yStart'] + $GAME['map']['chunkSize']).\"; x+=\".($GAME['map']['tileSize'] + $GAME['map']['tileBorder']).\", j++) {\"; ?\u0026gt;\n imgs[imgIndex] = document.createElement('img'); \n imgs[imgIndex].onload = (function () {\n console.log(imgs[imgIndex] + \"-\" + imgIndex + \"-\" + x + \"-\" + y);\n ctx.drawImage(imgs[imgIndex], x, y, \u0026lt;?php echo $GAME['map']['tileSize']; ?\u0026gt;, \u0026lt;?php echo $GAME['map']['tileSize']; ?\u0026gt;);\n }());\n imgs[imgIndex].src = \"http://192.168.0.140/img/terrain.png\";\n imgIndex += 1;\n }\n }\n\n ctx.restore(); \n\n // store the generate map as this image texture\n this.image = new Image();\n this.image.src = ctx.canvas.toDataURL(\"image/png\"); \n\n // clear context\n ctx = null;\n }\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003econsole.log output:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e [object HTMLImageElement]-test\n [object HTMLImageElement]-0-0-0\n [object HTMLImageElement]-1-41-0\n [object HTMLImageElement]-2-82-0\n [object HTMLImageElement]-3-123-0\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"1","comment_count":"0","creation_date":"2016-10-27 21:16:45.33 UTC","last_activity_date":"2016-10-28 19:06:13.76 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"2062191","post_type_id":"1","score":"0","tags":"javascript|html5|for-loop|canvas|drawimage","view_count":"278"} @@ -2028,7 +2028,7 @@ {"id":"37535659","title":"how can i change the font size of a text file in Eclipse","body":"\u003cp\u003eI'm specifically talking about the text font size of .txt files in Eclipse. I've already changed the default font size for .java files but any file with .txt is unchanged and really small. \u003c/p\u003e","accepted_answer_id":"37536735","answer_count":"2","comment_count":"2","creation_date":"2016-05-31 01:49:44.31 UTC","last_activity_date":"2016-05-31 04:16:23.663 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"4898342","post_type_id":"1","score":"0","tags":"eclipse","view_count":"28"} {"id":"32016143","title":"how can set where condition in list() method in grails","body":"\u003cp\u003eI am using list() method to get the data.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;g:select id=\"complaint\" class=\"form-control chosen-select\" multiple=\"true\" name=\"complaint\" from=\"${settings.Complaint.list()}\"optionKey=\"id\" optionValue=\"name\"/\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eNow I would like get the data as list which status is active. Is there any way to use condition in list()? \u003c/p\u003e","accepted_answer_id":"32303344","answer_count":"1","comment_count":"3","creation_date":"2015-08-14 18:02:07.717 UTC","last_activity_date":"2015-08-31 02:48:04.68 UTC","last_edit_date":"2015-08-14 18:20:23.443 UTC","last_editor_display_name":"","last_editor_user_id":"6509","owner_display_name":"","owner_user_id":"913595","post_type_id":"1","score":"-2","tags":"grails|gorm","view_count":"189"} {"id":"23271797","title":"Want to move tortoiseSVN 1.6.2(32-bit, windows 7) to 1.7.7(64-bit,windows 8.1) is it possible..?","body":"\u003cp\u003eWant to move tortoiseSVN 1.6.2(32-bit, windows 7) to 1.7.7(64-bit,windows 8.1) is it possible..?\u003c/p\u003e\n\n\u003cp\u003eis there any issue with Migrating Working Copy.?\u003c/p\u003e","answer_count":"2","comment_count":"0","creation_date":"2014-04-24 14:26:35.937 UTC","last_activity_date":"2014-04-24 14:35:43.007 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"3563408","post_type_id":"1","score":"-1","tags":"svn|tortoisesvn","view_count":"214"} -{"id":"45462997","title":"Scaling Postgres database to handle parallel requests","body":"\u003cp\u003eI am using Postgres Database as primary database with Rails application. Currently the configuration for the database is: CPU - \u003cstrong\u003e8 cores\u003c/strong\u003e, RAM - \u003cstrong\u003e32 GB\u003c/strong\u003e, hosted on AWS. However I need to scale this server as I am facing a lot of serious bottlenecks.\u003c/p\u003e\n\n\u003cp\u003eI need to be able to handle 10000 parallel requests to this server. Even if this is not achievable I at-least need to know what would be the maximum number that this database can handle. The requests includes complex \u003cstrong\u003eSELECT\u003c/strong\u003e and \u003cstrong\u003eUPDATE\u003c/strong\u003e queries.\u003c/p\u003e\n\n\u003cp\u003eI have changed settings such as \u003cstrong\u003emax_connections\u003c/strong\u003e to \u003cstrong\u003e10000\u003c/strong\u003e and in the \u003ccode\u003erails_config/database.yml\u003c/code\u003e the \u003cstrong\u003econnection_pool\u003c/strong\u003e is set to \u003cstrong\u003e10000\u003c/strong\u003e.\u003c/p\u003e\n\n\u003cp\u003eI am running a rails code which currently runs in 50 parallel threads. The code runs fine for a while until I receive this error:\n\u003ccode\u003ePG::ConnectionBad: PQsocket() can't get socket descriptor\u003c/code\u003e. After this when I log into the postgres server and try to execute something, I get this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003edb_production=# select id from product_tbl limit 5;\nWARNING: terminating connection because of crash of another server process\nDETAIL: The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.\nHINT: In a moment you should be able to reconnect to the database and repeat your command.\nserver closed the connection unexpectedly\n This probably means the server terminated abnormally\n before or while processing the request.\nThe connection to the server was lost. Attempting reset: Succeeded.\ndb_production=#\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAfter this restarting the rails code also works fine but only for a while until I again receive the same error.\nI looked at the CPU usage while the threads are running. Some observations:\u003c/p\u003e\n\n\u003cul\u003e\n\u003cli\u003eOne SELECT query uses all the CPU (shows 100% usage) for one core, the rest are sitting idle at 0%. This can be inferred because when only one process or query is running, only one CPU shows 95-100% usage. \u003cstrong\u003eDoes this mean I will only be able to run 8 queries or threads in parallel as there are only 8 cores?\u003c/strong\u003e\u003c/li\u003e\n\u003cli\u003eRAM is kept underutilized. Even when 7 out of 8 queries or threads are running in parallel, the RAM used is only around 3 GB. \u003cstrong\u003eCan I somehow increase this and accommodate more parallel queries?\u003c/strong\u003e\u003c/li\u003e\n\u003cli\u003eFor every running thread, this is the configuration: \u003cstrong\u003evirtual memory usage-\u003e751M\u003c/strong\u003e, \u003cstrong\u003eresident memory usage-\u003e154-158M\u003c/strong\u003e, \u003cstrong\u003eshared memory used-\u003e149-150M\u003c/strong\u003e, \u003cstrong\u003eCPU%-\u003e60-100%\u003c/strong\u003e, \u003cstrong\u003eMEM%-\u003e0.5-0.6%\u003c/strong\u003e. Is everything right here or I need to tweak some settings to make use of the resources more effectively?\u003c/li\u003e\n\u003c/ul\u003e\n\n\u003cp\u003eWhat are the configuration settings I need to change in order to scale the database? What must be the ideal number of threads such that I at-least don't receive the connection error? What are the checks and steps to scale the database to handle large parallel connections? How can I make full use of the available resources?\u003c/p\u003e","answer_count":"0","comment_count":"4","creation_date":"2017-08-02 13:58:08.143 UTC","last_activity_date":"2017-08-02 13:58:08.143 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"7321201","post_type_id":"1","score":"1","tags":"database|multithreading|postgresql|parallel-processing|scaling","view_count":"86"} +{"id":"45462997","title":"Scaling Postgres database to handle parallel requests","body":"\u003cp\u003eI am using Postgres Database as primary database with Rails application. Currently the configuration for the database is: CPU - \u003cstrong\u003e8 cores\u003c/strong\u003e, RAM - \u003cstrong\u003e32 GB\u003c/strong\u003e, hosted on AWS. However I need to scale this server as I am facing a lot of serious bottlenecks.\u003c/p\u003e\n\n\u003cp\u003eI need to be able to handle 10000 parallel requests to this server. Even if this is not achievable I at-least need to know what would be the maximum number that this database can handle. The requests includes complex \u003cstrong\u003eSELECT\u003c/strong\u003e and \u003cstrong\u003eUPDATE\u003c/strong\u003e queries.\u003c/p\u003e\n\n\u003cp\u003eI have changed settings such as \u003cstrong\u003emax_connections\u003c/strong\u003e to \u003cstrong\u003e10000\u003c/strong\u003e and in the \u003ccode\u003erails_config/database.yml\u003c/code\u003e the \u003cstrong\u003econnection_pool\u003c/strong\u003e is set to \u003cstrong\u003e10000\u003c/strong\u003e.\u003c/p\u003e\n\n\u003cp\u003eI am running a rails code which currently runs in 50 parallel threads. The code runs fine for a while until I receive this error:\n\u003ccode\u003ePG::ConnectionBad: PQsocket() can't get socket descriptor\u003c/code\u003e. After this when I log into the postgres server and try to execute something, I get this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003edb_production=# select id from product_tbl limit 5;\nWARNING: terminating connection because of crash of another server process\nDETAIL: The postclustermanager has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.\nHINT: In a moment you should be able to reconnect to the database and repeat your command.\nserver closed the connection unexpectedly\n This probably means the server terminated abnormally\n before or while processing the request.\nThe connection to the server was lost. Attempting reset: Succeeded.\ndb_production=#\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAfter this restarting the rails code also works fine but only for a while until I again receive the same error.\nI looked at the CPU usage while the threads are running. Some observations:\u003c/p\u003e\n\n\u003cul\u003e\n\u003cli\u003eOne SELECT query uses all the CPU (shows 100% usage) for one core, the rest are sitting idle at 0%. This can be inferred because when only one process or query is running, only one CPU shows 95-100% usage. \u003cstrong\u003eDoes this mean I will only be able to run 8 queries or threads in parallel as there are only 8 cores?\u003c/strong\u003e\u003c/li\u003e\n\u003cli\u003eRAM is kept underutilized. Even when 7 out of 8 queries or threads are running in parallel, the RAM used is only around 3 GB. \u003cstrong\u003eCan I somehow increase this and accommodate more parallel queries?\u003c/strong\u003e\u003c/li\u003e\n\u003cli\u003eFor every running thread, this is the configuration: \u003cstrong\u003evirtual memory usage-\u003e751M\u003c/strong\u003e, \u003cstrong\u003eresident memory usage-\u003e154-158M\u003c/strong\u003e, \u003cstrong\u003eshared memory used-\u003e149-150M\u003c/strong\u003e, \u003cstrong\u003eCPU%-\u003e60-100%\u003c/strong\u003e, \u003cstrong\u003eMEM%-\u003e0.5-0.6%\u003c/strong\u003e. Is everything right here or I need to tweak some settings to make use of the resources more effectively?\u003c/li\u003e\n\u003c/ul\u003e\n\n\u003cp\u003eWhat are the configuration settings I need to change in order to scale the database? What must be the ideal number of threads such that I at-least don't receive the connection error? What are the checks and steps to scale the database to handle large parallel connections? How can I make full use of the available resources?\u003c/p\u003e","answer_count":"0","comment_count":"4","creation_date":"2017-08-02 13:58:08.143 UTC","last_activity_date":"2017-08-02 13:58:08.143 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"7321201","post_type_id":"1","score":"1","tags":"database|multithreading|postgresql|parallel-processing|scaling","view_count":"86"} {"id":"13272723","title":"Create indexable non-repeating combinations with fixed length","body":"\u003cp\u003eBased on this question\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"https://stackoverflow.com/questions/12035147/ordered-fixed-length-combinations-of-a-string\"\u003eOrdered Fixed Length Combination of a String\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eI created a PHP algorithm that creates combinations of characters on a fixed length (basically a rewrite of the Java-answer)\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eprivate function getCombination($length, $input) {\n $result = array();\n\n if ($length == 0) {\n return $result;\n }\n\n $first = substr($input, 0, $length);\n $result[] = $first;\n\n if (strlen($input) == $length) {\n return $result;\n }\n\n $tails = $this-\u0026gt;getCombination($length - 1, substr($input, 1));\n\n foreach ($tails as $tail) {\n $tmp = substr($input, 0, 1) . $tail;\n\n if (!in_array($tmp, $result)) {\n $result[] = $tmp;\n }\n }\n\n return array_merge($result, $this-\u0026gt;getCombination($length, substr($input, 1)));\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eFor another question, \u003ca href=\"https://stackoverflow.com/questions/13175257\"\u003eCreate fixed length non-repeating permutation of larger set\u003c/a\u003e, I was given a (brilliant) algorithm that would make permutations indexable, effectively making them adressable by providing a \"key\" that would always produce the exact same permutation, when given the same set of characters and the same length.\u003c/p\u003e\n\n\u003cp\u003eWell, now I basically need the same but for combinations, in contrast to permutations as in my other question.\u003c/p\u003e\n\n\u003cp\u003eCan the algorithm above be modified in the same way? Meaning to create a function like\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epublic function getCombinationByIndex($length, $index);\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThat will return \u003cstrong\u003eone\u003c/strong\u003e combination out of the thousand possible that is created with the algorithm \u003cstrong\u003ewithout creating them beforehand\u003c/strong\u003e?\u003c/p\u003e","accepted_answer_id":"13274837","answer_count":"1","comment_count":"0","creation_date":"2012-11-07 15:24:26.223 UTC","last_activity_date":"2012-11-07 17:20:28.04 UTC","last_edit_date":"2017-05-23 10:24:41.733 UTC","last_editor_display_name":"","last_editor_user_id":"-1","owner_display_name":"","owner_user_id":"204693","post_type_id":"1","score":"2","tags":"php|algorithm|combinations","view_count":"518"} {"id":"36523208","title":"Rails \"redirect_to\" Nested routes with latest model","body":"\u003cp\u003eIn my rails app I have two models nested, \nGameround \u003e currentplayer\u003c/p\u003e\n\n\u003cp\u003eGameround is shown on play.html.erb, I also make the currentplayers there. When the currentplayer is made I want to redirect the user to currentplayer#show but I can't seem to figure out the way to route the link. I've tried everything I can think of.\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eSo I need a link that says:\u003c/strong\u003e\u003c/p\u003e\n\n\u003cp\u003eGet url to thiscurrentGameround/ThiscurrentplayerIjustmade\u003c/p\u003e\n\n\u003cp\u003eMy controller:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003edef createPlayerforUser\n\n @latest_game_round = Gameround.order(created_at: :desc).first\n @currentplayer = @latest_game_round.currentplayers.create({\n log_id: @current_user.id\n });\n\n if @currentplayer.save\n\n redirect_to url_for([@gameround, @currentplayer])\n end\n\n end\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003econfig.routes \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e resources :gamerounds do \n resources :currentplayers\n end \n resources :gamesessions\n # The priority is based upon order of creation: first created -\u0026gt; highest priority.\n # See how all your routes lay out with \"rake routes\".\n\n # Artikkel, Alien liste\n resources :expansions do\n resources :aliens\n end\n\n resources :users\n\n # You can have the root of your site routed with \"root\"\n #root 'gamesessions#play'\n root 'gamesessions#new'\n #root 'application#show'\n #root 'public#index'\n get \"signup\", :to =\u0026gt; \"users#new\"\n get \"login\", :to =\u0026gt; \"sessions#login\"\n post \"login_attempt\", :to =\u0026gt; \"sessions#login_attempt\"\n get \"logout\", :to =\u0026gt; \"sessions#logout\"\n get \"profile\", :to =\u0026gt; \"sessions#profile\"\n get \"setting\", :to =\u0026gt; \"sessions#setting\"\n get \"play\", :to =\u0026gt; \"gamesessions#play\"\n get \"wait\", :to =\u0026gt; \"gamesessions#wait\"\n get \"aliens\", :to =\u0026gt; \"aliens#index\"\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"36523328","answer_count":"1","comment_count":"2","creation_date":"2016-04-09 21:57:14.73 UTC","last_activity_date":"2016-04-09 22:29:35.853 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"6148446","post_type_id":"1","score":"0","tags":"ruby-on-rails","view_count":"29"} {"id":"13205372","title":"haml code how to make it has some indention","body":"\u003cp\u003eI have the following code that displaying element like below\u003cbr\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e Mytable\n1. line1\n2. line2\n3. line3\n4. line4\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ebut I want it have indention, like belows\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e Mytable\n 1. line1\n 2. line2\n 3. line3\n 4. line4\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eMy code is at here\u003cbr\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e %div{:class =\u0026gt; 'test1'}\n %table#tablename\n %thead\n %tr\n %th.lead Mytable\n\n %tbody \n %tr\n %center\n %td 1.line1\n %tr\n %td 2. line2\n %tr \n %td 3. line3\n %tr\n %td 4. line4\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"13205409","answer_count":"2","comment_count":"0","creation_date":"2012-11-03 02:20:43.267 UTC","last_activity_date":"2012-11-03 02:29:17.61 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1691538","post_type_id":"1","score":"2","tags":"css|ruby-on-rails|haml","view_count":"186"} @@ -2053,7 +2053,7 @@ {"id":"34728004","title":"Templates in React","body":"\u003cp\u003eI've been trying to learn \u003ccode\u003eReact\u003c/code\u003e through building my own website by using it, and have come to a point where I'm very tempted to use \u003ccode\u003ejinja2\u003c/code\u003e templates. I understand the component paradigm pretty well, but am having a hard time piecing together the larger picture.\u003c/p\u003e\n\n\u003cp\u003eFor example, let's say I'm building \u003ca href=\"http://www.imgur.com\" rel=\"nofollow\"\u003ehttp://www.imgur.com\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eFor the components, I might write a image \u003ccode\u003ecard component\u003c/code\u003e for each image, perhaps a \u003ccode\u003emouseover component\u003c/code\u003e for the short summary of each image, etc...\u003c/p\u003e\n\n\u003cp\u003eHowever, how am I suppose to put the larger pieces together? In \u003ccode\u003ejinja2\u003c/code\u003e, I can just extend a base template or include a header/footer. What is the proper way to do that sort of thing in \u003ccode\u003eReact\u003c/code\u003e? I'd like to get rid of conventional templates altogether. \u003c/p\u003e","accepted_answer_id":"34728436","answer_count":"1","comment_count":"3","creation_date":"2016-01-11 17:55:22.8 UTC","last_activity_date":"2016-01-11 18:25:06.72 UTC","last_edit_date":"2016-01-11 18:18:15.93 UTC","last_editor_display_name":"","last_editor_user_id":"3783770","owner_display_name":"","owner_user_id":"3783770","post_type_id":"1","score":"0","tags":"templates|web|reactjs","view_count":"103"} {"id":"44251493","title":"iPhone does not remember my Android USB host. Keep asking \"Allow this device to access photos and videos\" instead of showing \"Trust this computer\"","body":"\u003cp\u003eI'm developing an android USB host application which read photos from iphone, treat iphone as external MTP/PTP devices when iphone connect to the host via USB.\u003c/p\u003e\n\n\u003cp\u003eThis app works fine, except that it show the popup message on iphone every time I connect the iphone to the android USB host.\u003c/p\u003e\n\n\u003cp\u003eiPhone Keeps Prompting \"Allow this device to access photos and videos?\", In PC(Windows/Linux/Mac), when iphone connected to the usb host, the popup is \"Trust this Computer? Your settings and data will be accessible from this computer when connected\", and if I tap Trust, this popup will not show again.\u003c/p\u003e\n\n\u003cp\u003eSo is this because android or I missed something when doing the USB communication? How can I resolve this issue so that when iPhone connected to my android USB host, \"Trust this computer\" popup can be shown on iphone and iphone can remember my android USB host?\u003c/p\u003e","answer_count":"0","comment_count":"0","creation_date":"2017-05-29 23:42:52.913 UTC","last_activity_date":"2017-05-30 00:32:37.093 UTC","last_edit_date":"2017-05-30 00:32:37.093 UTC","last_editor_display_name":"","last_editor_user_id":"6930324","owner_display_name":"","owner_user_id":"6930324","post_type_id":"1","score":"1","tags":"android|ios|iphone|linux","view_count":"59"} {"id":"8507540","title":"How to make sure my websites look good cross browser","body":"\u003cp\u003eI enjoy making websites. I spend all my free time on them. But when I test them in other browsers and computers they look different.\u003c/p\u003e\n\n\u003cp\u003eI have been given advice such as use \u003ccode\u003emargin: 0 auto;\u003c/code\u003e to make a main wrap which always stays centered. But anyone else have any good tips and places to expand what I know? \u003c/p\u003e\n\n\u003cp\u003eThis is mainly about layout. Not really bothered about how different buttons look because of different browsers not displaying shadowing and gradients.\u003c/p\u003e","accepted_answer_id":"8507606","answer_count":"5","comment_count":"0","creation_date":"2011-12-14 15:59:39.71 UTC","last_activity_date":"2011-12-14 16:28:37.793 UTC","last_edit_date":"2011-12-14 16:03:12.38 UTC","last_editor_display_name":"","last_editor_user_id":"94197","owner_display_name":"","owner_user_id":"1018369","post_type_id":"1","score":"0","tags":"html","view_count":"1229"} -{"id":"5780678","title":"p2p simulation and distributed hash table","body":"\u003cp\u003eI am learning the p2p architecture through a simulation within a single machine. For that I was told that I can use named pipes. I am in the design phase of the simulation. Here is how I plan to move forward:\u003c/p\u003e\n\n\u003col\u003e\n\u003cli\u003e\u003cp\u003eCreate a peer program that is able to join the p2p 'network'. The network is a collection of such peers. The peer is identified via the process id in the machine. \u003c/p\u003e\u003c/li\u003e\n\u003cli\u003e\u003cp\u003eWhen a peer is created i.e., joins the network, it announces it's arrival through bootstrapping itself to a 'master-node' or tracker. When the peer announces its arrival, the master-node updates its list of peers (process ids), and returns the list of peers available in the network to the new peer. \u003c/p\u003e\u003c/li\u003e\n\u003cli\u003e\u003cp\u003eOnce in the network, the peer can now download a file from the network or upload a file to an incoming request for a file that s/he has. The files that the peer receives through the network automatically becomes available for upload.\u003c/p\u003e\u003c/li\u003e\n\u003cli\u003e\u003cp\u003eTo download a file, the peer calls a location algorithm that locates the peer with the file that the current peer is seeking to download.\u003c/p\u003e\u003c/li\u003e\n\u003c/ol\u003e\n\n\u003cp\u003eAs you can see, there is a gap in my understanding of the design. From my naive approach, I see #2 and #3 as different steps. However, I have a feeling that they must somehow be related. I guess my understanding lacks in knowing how a distributed hash table and algorithm like Chord or CAN works. I need help in rounding up these scattered ideas that will help me actually implement the simulation. \u003c/p\u003e\n\n\u003cp\u003eTo begin, my first question is: where and how do I initiate the location algorithm? Or where is the distributed hash table created in the steps listed above? \u003c/p\u003e","accepted_answer_id":"5781486","answer_count":"1","comment_count":"0","creation_date":"2011-04-25 16:48:16.447 UTC","last_activity_date":"2012-01-30 18:09:51.127 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"672271","post_type_id":"1","score":"1","tags":"hashtable|p2p|dht","view_count":"815"} +{"id":"5780678","title":"p2p simulation and distributed hash table","body":"\u003cp\u003eI am learning the p2p architecture through a simulation within a single machine. For that I was told that I can use named pipes. I am in the design phase of the simulation. Here is how I plan to move forward:\u003c/p\u003e\n\n\u003col\u003e\n\u003cli\u003e\u003cp\u003eCreate a peer program that is able to join the p2p 'network'. The network is a collection of such peers. The peer is identified via the process id in the machine. \u003c/p\u003e\u003c/li\u003e\n\u003cli\u003e\u003cp\u003eWhen a peer is created i.e., joins the network, it announces it's arrival through bootstrapping itself to a 'cluster-manager-node' or tracker. When the peer announces its arrival, the cluster-manager-node updates its list of peers (process ids), and returns the list of peers available in the network to the new peer. \u003c/p\u003e\u003c/li\u003e\n\u003cli\u003e\u003cp\u003eOnce in the network, the peer can now download a file from the network or upload a file to an incoming request for a file that s/he has. The files that the peer receives through the network automatically becomes available for upload.\u003c/p\u003e\u003c/li\u003e\n\u003cli\u003e\u003cp\u003eTo download a file, the peer calls a location algorithm that locates the peer with the file that the current peer is seeking to download.\u003c/p\u003e\u003c/li\u003e\n\u003c/ol\u003e\n\n\u003cp\u003eAs you can see, there is a gap in my understanding of the design. From my naive approach, I see #2 and #3 as different steps. However, I have a feeling that they must somehow be related. I guess my understanding lacks in knowing how a distributed hash table and algorithm like Chord or CAN works. I need help in rounding up these scattered ideas that will help me actually implement the simulation. \u003c/p\u003e\n\n\u003cp\u003eTo begin, my first question is: where and how do I initiate the location algorithm? Or where is the distributed hash table created in the steps listed above? \u003c/p\u003e","accepted_answer_id":"5781486","answer_count":"1","comment_count":"0","creation_date":"2011-04-25 16:48:16.447 UTC","last_activity_date":"2012-01-30 18:09:51.127 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"672271","post_type_id":"1","score":"1","tags":"hashtable|p2p|dht","view_count":"815"} {"id":"47171631","title":"How to group and rank with reference to another column","body":"\u003cp\u003eI need help in grouping or partitioning and ranking according to the subject. Every subject must have first to last student.\nI am using the code below with VB 2010.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eDim TotaledRecords = From p In db.Assessments\nWhere p.Class = cboclass.Text And p.Stream = cbostream.Text\nSelect p\nOrder By p.Total Descending\n\nFor j = 1 To TotaledRecords.Count\nTotaledRecords.ToList(j - 1).Position = j\nNext\ndb.SubmitChanges()\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI want it to restart the ranking with respect to the subject.\u003c/p\u003e\n\n\u003cp\u003eSee attached picture:\n\u003ca href=\"https://i.stack.imgur.com/xz093.png\" rel=\"nofollow noreferrer\"\u003e\u003cimg src=\"https://i.stack.imgur.com/xz093.png\" alt=\"\"\u003e\u003c/a\u003e\u003c/p\u003e","accepted_answer_id":"47183888","answer_count":"1","comment_count":"0","creation_date":"2017-11-08 04:31:51.377 UTC","last_activity_date":"2017-11-09 12:03:19.603 UTC","last_edit_date":"2017-11-08 11:44:02.067 UTC","last_editor_display_name":"","last_editor_user_id":"1905949","owner_display_name":"","owner_user_id":"8903261","post_type_id":"1","score":"1","tags":"vb.net|linq|grouping|vb.net-2010|rank","view_count":"54"} {"id":"5086387","title":"Howto create a c# assembly to load into sql server 2008","body":"\u003cp\u003eI was wondering if anyone would be able to provide me with some guidance or book recommendations on creating a C# assembly that will be loaded into sqlserver and run on the database as new data comes in. \u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eBackground:\u003c/strong\u003e\u003cbr\u003e\nI have a few years of Java experience and had created an algorithm to run against data retrieved from a sql query. My employer now wants me to create it as a c# assembly that sits on the database directly and performs the analysis as data comes in (or at periodic points) and sends out alerts if they are above a certain threshold. \u003c/p\u003e\n\n\u003cp\u003eI have never coded in c# but I am told that it is very similar to Java. The learning of c# is not my issue here, I think that I can pick that up from online resources. What I am having trouble finding information on is the assembly and how it ties into sqlserver / if there needs to be anything specific done in the code for it to work. \u003c/p\u003e\n\n\u003cp\u003eI have been browsing Microsoft's msdn library online to get an idea and I think that what I am looking for is a \u003ccode\u003eC# SQL CLR Database Project\u003c/code\u003e. \u003c/p\u003e\n\n\u003cp\u003eIs this correct for what I am trying to accomplish? If so does anybody have any tips / things to look out for when working on this?\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eps.\u003c/strong\u003e Is there a way to deal directly with the tables in some manner? Instead of constantly performing a query on the data like I do with Java? I am not sure if this is possible but I thought it may be since the assembly is connected directly to the database somehow.\u003c/p\u003e","accepted_answer_id":"5086505","answer_count":"2","comment_count":"4","creation_date":"2011-02-23 02:29:27.25 UTC","last_activity_date":"2011-02-23 05:48:30.26 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"589131","post_type_id":"1","score":"3","tags":"c#|sql-server-2008|assemblies","view_count":"1639"} {"id":"13535299","title":"Android - how to verify an in-app purchase?","body":"\u003cp\u003eI'm trying learn about in-app purchases by following this tutorial \u003ca href=\"http://blog.blundell-apps.com/simple-inapp-billing-payment/\" rel=\"nofollow\"\u003ehttp://blog.blundell-apps.com/simple-inapp-billing-payment/\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003ehere's my code so far:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epublic class main extends Activity{\n\n @Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n Log.e(\"BillingService\", \"Starting\");\n setContentView(R.layout.main);\n\n startService(new Intent(this, BillingService.class));\n BillingHelper.setCompletedHandler(mTransactionHandler);\n\n }\n\n ////////////////////////////////\n\n public Handler mTransactionHandler = new Handler(){\n public void handleMessage(android.os.Message msg) {\n\n Log.e(\"IN APP\", \"Transaction complete\");\n Log.e(\"IN APP\", \"Transaction status: \"+BillingHelper.latestPurchase.purchaseState);\n Log.e(\"IN APP\", \"Item purchased is: \"+BillingHelper.latestPurchase.productId);\n\n if(BillingHelper.latestPurchase.isPurchased())\n {\n showItem();\n }\n\n };\n\n };\n\n ////////////////////////////////\n\n public void BuyButtonClick(View v) {\n\n if(BillingHelper.isBillingSupported()){\n Log.e(\"IN APP\",\"Trying to buy...\");\n BillingHelper.requestPurchase(this, \"android.test.purchased\"); \n } else {\n Log.e(\"IN APP\",\"Can't purchase on this device\");\n }\n\n }\n\n ////////////////////////////////////////////////\n\n private void showItem() {\n\n TextView tv1 = (TextView)findViewById(R.id.tv1);\n tv1.setText(\"PAID!\");\n\n }\n\n ////////////////////////////////////////////////\n\n @Override\n protected void onDestroy() {\n BillingHelper.stopService();\n super.onDestroy();\n }\n\n ////////////////////////////////\n\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eEverything seems to work fine, but I also want some way to check if the item was purchased when the app starts. I assume it might use \u003cstrong\u003eBillingHelper.verifyPurchase(signedData, signature)\u003c/strong\u003e , but what data and sig should I put in there? Or maybe there's some other way about it?\u003c/p\u003e\n\n\u003cp\u003eThanks!\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2012-11-23 20:23:00.47 UTC","favorite_count":"1","last_activity_date":"2012-12-10 11:19:27.227 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"296516","post_type_id":"1","score":"1","tags":"android","view_count":"605"} @@ -2325,10 +2325,10 @@ {"id":"37863736","title":"Mandos in Docker","body":"\u003cp\u003eI try to setup Mandos inside a Docker container and failed with dbus errors. It's possible to run the server without dbus, but mandos-ctl and mandos-monitor need dbus to run.\u003c/p\u003e\n\n\u003cp\u003emy Dockerfile\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eFROM ubuntu:16.04\nRUN locale-gen de_DE.UTF-8\nENV TERM=xterm\nRUN apt-get update \\\n \u0026amp;\u0026amp; apt-get install -y mandos \\\n fping \\\n dbus \\\n \u0026amp;\u0026amp; rm -rf /var/lib/apt/lists/*\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eBuild it: \u003ccode\u003edocker build -t mandos-server .\u003c/code\u003e\u003c/p\u003e\n\n\u003cp\u003eIf I host mount \u003ccode\u003e/var/run/dbus\u003c/code\u003e and start the container with:\n\u003ccode\u003edocker run -v /dev/log:/dev/log -v /var/run/dbus:/var/run/dbus -it mandos-server bash\u003c/code\u003e and start \u003ccode\u003emandos --debug\u003c/code\u003e I get the following errors:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e2016-06-16 15:26:30,278 root [11]: DEBUG: Did setuid/setgid to 108:111\n2016-06-16 15:26:30,280 root [11]: ERROR: Disabling D-Bus:\nTraceback (most recent call last):\n File \"/usr/sbin/mandos\", line 3009, in main\n do_not_queue=True)\n File \"/usr/lib/python2.7/dist-packages/dbus/service.py\", line 131, in __new__\n retval = bus.request_name(name, name_flags)\n File \"/usr/lib/python2.7/dist-packages/dbus/bus.py\", line 303, in request_name\n 'su', (name, flags))\n File \"/usr/lib/python2.7/dist-packages/dbus/connection.py\", line 651, in call_blocking\n message, timeout)\nDBusException: org.freedesktop.DBus.Error.AccessDenied: Connection \":1.362\" is not allowed to own the service \"se.recompile.Mandos\" due to security policies in the configuration file\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eSecond trial:\nStarting the container without mounting dbus \u003ccode\u003edocker run -v /dev/log:/dev/log -it mandos-server bash\u003c/code\u003e\nand starting dbus by hand:\n\u003ccode\u003e/etc/init.d/dbus start\n * Starting system message bus dbus [ OK ]\u003c/code\u003e\u003c/p\u003e\n\n\u003cp\u003e\u003ccode\u003emandos --debug\u003c/code\u003e leeds to the following error:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e2016-06-16 15:36:38,338 root [40]: DEBUG: Did setuid/setgid to 108:111\n2016-06-16 15:36:38,353 root [40]: WARNING: Could not load persistent state: No such file or directory\n2016-06-16 15:36:38,359 root [40]: WARNING: No clients defined\n2016-06-16 15:36:38,361 root [40]: INFO: Now listening on address '::', port 39145, flowinfo 0, scope_id 0\n2016-06-16 15:36:38,363 dbus.proxies [40]: ERROR: Introspect error on org.freedesktop.Avahi:/: dbus.exceptions.DBusException: org.freedesktop.DBus.Error.Spawn.FileInvalid: Cannot do system-bus activation with no user\n\n2016-06-16 15:36:38,363 dbus.proxies [40]: DEBUG: Executing introspect queue due to error\n2016-06-16 15:36:38,363 root [40]: CRITICAL: D-Bus Exception\nTraceback (most recent call last):\n File \"/usr/sbin/mandos\", line 3415, in main\n service.activate()\n File \"/usr/sbin/mandos\", line 470, in activate\n self.server_state_changed(self.server.GetState())\n File \"/usr/lib/python2.7/dist-packages/dbus/proxies.py\", line 70, in __call__\n return self._proxy_method(*args, **keywords)\n File \"/usr/lib/python2.7/dist-packages/dbus/proxies.py\", line 145, in __call__\n **keywords)\n File \"/usr/lib/python2.7/dist-packages/dbus/connection.py\", line 651, in call_blocking\n message, timeout)\nDBusException: org.freedesktop.DBus.Error.Spawn.FileInvalid: Cannot do system-bus activation with no user\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAny idea whats going wrong and maybe a solution?\u003c/p\u003e","accepted_answer_id":"40794447","answer_count":"3","comment_count":"2","creation_date":"2016-06-16 15:42:31.817 UTC","last_activity_date":"2016-11-24 21:02:36.697 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"2638109","post_type_id":"1","score":"1","tags":"encryption|luks","view_count":"151"} {"id":"33806309","title":"Convert date into dd-mm-yy format and select last 12 dates from a picked value in SQL 2008","body":"\u003cp\u003eI have a table with a column 'Required date'. I need to convert the date format into dd-mm-yy format. I am able to do that using the following code - \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eSelect Convert(VARCHAR(8),[RecordDate], 3) AS [DD/MM/YY]\nFrom [resolveConfig].dbo.myTable \n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eNow, when a date is picked, I would like to select the last 12 days data from the table from the 'picked date'. \u003c/p\u003e\n\n\u003cp\u003eHow can I do that?\nIt is already converting the date to string format so i guess dateadd() would not work?\u003c/p\u003e\n\n\u003cp\u003eI am using sql 2008.\u003c/p\u003e\n\n\u003cp\u003ePlease help.\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2015-11-19 14:14:07.58 UTC","last_activity_date":"2015-11-24 08:39:55.817 UTC","last_edit_date":"2015-11-19 14:50:58.52 UTC","last_editor_display_name":"","last_editor_user_id":"2311633","owner_display_name":"","owner_user_id":"5581614","post_type_id":"1","score":"0","tags":"mysql|sql-server-2008|datetime","view_count":"210"} {"id":"22289983","title":"Dynamically increase and decrease char arrays?","body":"\u003cp\u003eI have to send data with UDP. The buffer field is of type char. I also have to encrypt/decrypt what I send. Here's my code for encrypting/decrypting.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003econst unsigned BUFFER_SIZE = 128;\nchar data[BUFFER_SIZE];\n\ncout \u0026lt;\u0026lt; \"Enter something.\" \u0026lt;\u0026lt; endl;\ncin.getline(data, BUFFER_SIZE);\ncout \u0026lt;\u0026lt; data;\nchar outchar[BUFFER_SIZE];\n\n\nfor(int i = 0; i \u0026lt; strlen(data); i++)\n{\n //outchar[i] = data[i];\n outchar[i] = encr[(int)data[i]];\n cout \u0026lt;\u0026lt; outchar[i];\n\n}\n\ncout \u0026lt;\u0026lt; \"Correct so far\" \u0026lt;\u0026lt; endl;\n\n\nchar transchar[BUFFER_SIZE];\nfor(int j = 0; j \u0026lt; strlen(outchar); j++)\n{\ntranschar[j] = decr[(int)outchar[j]];\ncout \u0026lt;\u0026lt; transchar[j]; // prints out decrypted text and unused space!\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe problem here is that using the fixed size of char means there is a lot of unused space in the buffer. In the code provided, it gets printed to screen.\u003c/p\u003e\n\n\u003cp\u003eIs there anyway to dynamically increase and decrease the buffer (char array) size so that I do not get the unused space?\u003c/p\u003e\n\n\u003cp\u003eEDIT: Something I don't think is clear: \u003cstrong\u003eEVERY LETTER has to be encrypted and decrypted!\u003c/strong\u003e The words are not encrypted, the letters that make them up are! The advice given up to now would translate words into an array. I need the characters.\u003c/p\u003e\n\n\u003cp\u003eEDIT2: deleted.\u003c/p\u003e\n\n\u003cp\u003eEDIT3: Russians, you got to love them. Big thanks to Vlad from Moscow!\u003c/p\u003e","accepted_answer_id":"22290058","answer_count":"1","comment_count":"10","creation_date":"2014-03-10 00:07:59.693 UTC","last_activity_date":"2015-12-07 17:52:58.82 UTC","last_edit_date":"2015-12-07 17:52:58.82 UTC","last_editor_display_name":"","last_editor_user_id":"2877241","owner_display_name":"","owner_user_id":"2955135","post_type_id":"1","score":"0","tags":"c++|arrays|string|char","view_count":"416"} -{"id":"47189779","title":"What causes \"unknown resolver null\" in Spark Kafka Connector?","body":"\u003cp\u003eI am new to spark, I have start zookeeper, kafka(0.10.1.1) on my local, also spark standalone(2.2.0) with one master and 2 workers. my local scal version is 2.12.3\u003c/p\u003e\n\n\u003cp\u003eI was able to run wordcount on spark, and using kafka console producer and consumer to pub/sub message from kafka topic.\u003c/p\u003e\n\n\u003cp\u003eThe problem I have is: whenever I add kafka package using the spark-submit --packages, I got\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e...\n:: problems summary ::\n:::: ERRORS\n unknown resolver null\n\n:: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS\n:: retrieving :: org.apache.spark#spark-submit-parent\n confs: [default]\n 0 artifacts copied, 13 already retrieved (0kB/9ms)\n...\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eEven I am not using the kafka connector at all.\nThe detail logs are following:\u003c/p\u003e\n\n\u003cp\u003ecommand\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e$SPARK_HOME/bin/spark-submit --packages org.apache.spark:spark-streaming-kafka-0-10_2.11:2.2.0 --master spark://TUSMA06RMLVT047:7077 build/libs/sparkdriver-1.0-SNAPSHOT.jar\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003elog\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eIvy Default Cache set to: /Users/v0001/.ivy2/cache\nThe jars for the packages stored in: /Users/v0001/.ivy2/jars\n:: loading settings :: url = jar:file:/usr/local/Cellar/apache-spark/2.2.0/libexec/jars/ivy-2.4.0.jar!/org/apache/ivy/core/settings/ivysettings.xml\norg.apache.spark#spark-streaming-kafka-0-10_2.11 added as a dependency\n:: resolving dependencies :: org.apache.spark#spark-submit-parent;1.0\n confs: [default]\n found org.apache.spark#spark-streaming-kafka-0-10_2.11;2.2.0 in local-m2-cache\n found org.apache.kafka#kafka_2.11;0.10.0.1 in local-m2-cache\n found com.101tec#zkclient;0.8 in local-m2-cache\n found org.slf4j#slf4j-api;1.7.16 in spark-list\n found org.slf4j#slf4j-log4j12;1.7.16 in spark-list\n found log4j#log4j;1.2.17 in spark-list\n found com.yammer.metrics#metrics-core;2.2.0 in local-m2-cache\n found org.scala-lang.modules#scala-parser-combinators_2.11;1.0.4 in spark-list\n found org.apache.kafka#kafka-clients;0.10.0.1 in local-m2-cache\n found net.jpountz.lz4#lz4;1.3.0 in spark-list\n found org.xerial.snappy#snappy-java;1.1.2.6 in spark-list\n found org.apache.spark#spark-tags_2.11;2.2.0 in local-m2-cache\n found org.spark-project.spark#unused;1.0.0 in spark-list\n:: resolution report :: resolve 1805ms :: artifacts dl 14ms\n :: modules in use:\n com.101tec#zkclient;0.8 from local-m2-cache in [default]\n com.yammer.metrics#metrics-core;2.2.0 from local-m2-cache in [default]\n log4j#log4j;1.2.17 from spark-list in [default]\n net.jpountz.lz4#lz4;1.3.0 from spark-list in [default]\n org.apache.kafka#kafka-clients;0.10.0.1 from local-m2-cache in [default]\n org.apache.kafka#kafka_2.11;0.10.0.1 from local-m2-cache in [default]\n org.apache.spark#spark-streaming-kafka-0-10_2.11;2.2.0 from local-m2-cache in [default]\n org.apache.spark#spark-tags_2.11;2.2.0 from local-m2-cache in [default]\n org.scala-lang.modules#scala-parser-combinators_2.11;1.0.4 from spark-list in [default]\n org.slf4j#slf4j-api;1.7.16 from spark-list in [default]\n org.slf4j#slf4j-log4j12;1.7.16 from spark-list in [default]\n org.spark-project.spark#unused;1.0.0 from spark-list in [default]\n org.xerial.snappy#snappy-java;1.1.2.6 from spark-list in [default]\n ---------------------------------------------------------------------\n | | modules || artifacts |\n | conf | number| search|dwnlded|evicted|| number|dwnlded|\n ---------------------------------------------------------------------\n | default | 13 | 2 | 2 | 0 || 13 | 0 |\n ---------------------------------------------------------------------\n\n:: problems summary ::\n:::: ERRORS\n unknown resolver null\n\n\n:: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS\n:: retrieving :: org.apache.spark#spark-submit-parent\n confs: [default]\n 0 artifacts copied, 13 already retrieved (0kB/9ms)\nUsing Spark's default log4j profile: org/apache/spark/log4j-defaults.properties\n17/11/08 15:53:55 INFO SparkContext: Running Spark version 2.2.0\n17/11/08 15:53:55 WARN NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable\n17/11/08 15:53:55 INFO SparkContext: Submitted application: WordCount\n17/11/08 15:53:55 INFO SecurityManager: Changing view acls to: v0001\n17/11/08 15:53:55 INFO SecurityManager: Changing modify acls to: v0001\n17/11/08 15:53:55 INFO SecurityManager: Changing view acls groups to: \n17/11/08 15:53:55 INFO SecurityManager: Changing modify acls groups to: \n17/11/08 15:53:55 INFO SecurityManager: SecurityManager: authentication disabled; ui acls disabled; users with view permissions: Set(v0001); groups with view permissions: Set(); users with modify permissions: Set(v0001); groups with modify permissions: Set()\n17/11/08 15:53:55 INFO Utils: Successfully started service 'sparkDriver' on port 63760.\n17/11/08 15:53:55 INFO SparkEnv: Registering MapOutputTracker\n17/11/08 15:53:55 INFO SparkEnv: Registering BlockManagerMaster\n17/11/08 15:53:55 INFO BlockManagerMasterEndpoint: Using org.apache.spark.storage.DefaultTopologyMapper for getting topology information\n17/11/08 15:53:55 INFO BlockManagerMasterEndpoint: BlockManagerMasterEndpoint up\n17/11/08 15:53:55 INFO DiskBlockManager: Created local directory at /private/var/folders/26/lfnkdm_d6mj48xfwdyl_sntm8tdtp9/T/blockmgr-b6a7af13-30eb-43ef-a235-e42105699289\n17/11/08 15:53:55 INFO MemoryStore: MemoryStore started with capacity 366.3 MB\n17/11/08 15:53:55 INFO SparkEnv: Registering OutputCommitCoordinator\n17/11/08 15:53:55 INFO Utils: Successfully started service 'SparkUI' on port 4040.\n17/11/08 15:53:55 INFO SparkUI: Bound SparkUI to 0.0.0.0, and started at http://10.0.1.2:4040\n17/11/08 15:53:55 INFO SparkContext: Added JAR file:/Users/v0001/.ivy2/jars/org.apache.spark_spark-streaming-kafka-0-10_2.11-2.2.0.jar at spark://10.0.1.2:63760/jars/org.apache.spark_spark-streaming-kafka-0-10_2.11-2.2.0.jar with timestamp 1510174435998\n17/11/08 15:53:55 INFO SparkContext: Added JAR file:/Users/v0001/.ivy2/jars/org.apache.kafka_kafka_2.11-0.10.0.1.jar at spark://10.0.1.2:63760/jars/org.apache.kafka_kafka_2.11-0.10.0.1.jar with timestamp 1510174435999\n17/11/08 15:53:55 INFO SparkContext: Added JAR file:/Users/v0001/.ivy2/jars/org.apache.spark_spark-tags_2.11-2.2.0.jar at spark://10.0.1.2:63760/jars/org.apache.spark_spark-tags_2.11-2.2.0.jar with timestamp 1510174435999\n17/11/08 15:53:55 INFO SparkContext: Added JAR file:/Users/v0001/.ivy2/jars/org.spark-project.spark_unused-1.0.0.jar at spark://10.0.1.2:63760/jars/org.spark-project.spark_unused-1.0.0.jar with timestamp 1510174435999\n17/11/08 15:53:55 INFO SparkContext: Added JAR file:/Users/v0001/.ivy2/jars/com.101tec_zkclient-0.8.jar at spark://10.0.1.2:63760/jars/com.101tec_zkclient-0.8.jar with timestamp 1510174435999\n17/11/08 15:53:55 INFO SparkContext: Added JAR file:/Users/v0001/.ivy2/jars/org.slf4j_slf4j-log4j12-1.7.16.jar at spark://10.0.1.2:63760/jars/org.slf4j_slf4j-log4j12-1.7.16.jar with timestamp 1510174435999\n17/11/08 15:53:55 INFO SparkContext: Added JAR file:/Users/v0001/.ivy2/jars/com.yammer.metrics_metrics-core-2.2.0.jar at spark://10.0.1.2:63760/jars/com.yammer.metrics_metrics-core-2.2.0.jar with timestamp 1510174435999\n17/11/08 15:53:56 INFO SparkContext: Added JAR file:/Users/v0001/.ivy2/jars/org.scala-lang.modules_scala-parser-combinators_2.11-1.0.4.jar at spark://10.0.1.2:63760/jars/org.scala-lang.modules_scala-parser-combinators_2.11-1.0.4.jar with timestamp 1510174436000\n17/11/08 15:53:56 INFO SparkContext: Added JAR file:/Users/v0001/.ivy2/jars/org.apache.kafka_kafka-clients-0.10.0.1.jar at spark://10.0.1.2:63760/jars/org.apache.kafka_kafka-clients-0.10.0.1.jar with timestamp 1510174436000\n17/11/08 15:53:56 INFO SparkContext: Added JAR file:/Users/v0001/.ivy2/jars/org.slf4j_slf4j-api-1.7.16.jar at spark://10.0.1.2:63760/jars/org.slf4j_slf4j-api-1.7.16.jar with timestamp 1510174436000\n17/11/08 15:53:56 INFO SparkContext: Added JAR file:/Users/v0001/.ivy2/jars/log4j_log4j-1.2.17.jar at spark://10.0.1.2:63760/jars/log4j_log4j-1.2.17.jar with timestamp 1510174436000\n17/11/08 15:53:56 INFO SparkContext: Added JAR file:/Users/v0001/.ivy2/jars/net.jpountz.lz4_lz4-1.3.0.jar at spark://10.0.1.2:63760/jars/net.jpountz.lz4_lz4-1.3.0.jar with timestamp 1510174436000\n17/11/08 15:53:56 INFO SparkContext: Added JAR file:/Users/v0001/.ivy2/jars/org.xerial.snappy_snappy-java-1.1.2.6.jar at spark://10.0.1.2:63760/jars/org.xerial.snappy_snappy-java-1.1.2.6.jar with timestamp 1510174436000\n17/11/08 15:53:56 INFO SparkContext: Added JAR file:/Users/v0001/iot/thingspace/go/src/stash.verizon.com/npdthing/metrics/sparkdriver/build/libs/sparkdriver-1.0-SNAPSHOT.jar at spark://10.0.1.2:63760/jars/sparkdriver-1.0-SNAPSHOT.jar with timestamp 1510174436000\n17/11/08 15:53:56 INFO Executor: Starting executor ID driver on host localhost\n17/11/08 15:53:56 INFO Utils: Successfully started service 'org.apache.spark.network.netty.NettyBlockTransferService' on port 63761.\n17/11/08 15:53:56 INFO NettyBlockTransferService: Server created on 10.0.1.2:63761\n17/11/08 15:53:56 INFO BlockManager: Using org.apache.spark.storage.RandomBlockReplicationPolicy for block replication policy\n17/11/08 15:53:56 INFO BlockManagerMaster: Registering BlockManager BlockManagerId(driver, 10.0.1.2, 63761, None)\n17/11/08 15:53:56 INFO BlockManagerMasterEndpoint: Registering block manager 10.0.1.2:63761 with 366.3 MB RAM, BlockManagerId(driver, 10.0.1.2, 63761, None)\n17/11/08 15:53:56 INFO BlockManagerMaster: Registered BlockManager BlockManagerId(driver, 10.0.1.2, 63761, None)\n17/11/08 15:53:56 INFO BlockManager: Initialized BlockManager: BlockManagerId(driver, 10.0.1.2, 63761, None)\n17/11/08 15:53:56 INFO MemoryStore: Block broadcast_0 stored as values in memory (estimated size 236.5 KB, free 366.1 MB)\n17/11/08 15:53:56 INFO MemoryStore: Block broadcast_0_piece0 stored as bytes in memory (estimated size 22.9 KB, free 366.0 MB)\n17/11/08 15:53:56 INFO BlockManagerInfo: Added broadcast_0_piece0 in memory on 10.0.1.2:63761 (size: 22.9 KB, free: 366.3 MB)\n17/11/08 15:53:56 INFO SparkContext: Created broadcast 0 from textFile at WordCount.java:15\n17/11/08 15:53:56 INFO FileInputFormat: Total input paths to process : 1\n17/11/08 15:53:56 INFO FileOutputCommitter: File Output Committer Algorithm version is 1\n17/11/08 15:53:56 INFO SparkContext: Starting job: saveAsTextFile at WordCount.java:21\n17/11/08 15:53:56 INFO DAGScheduler: Registering RDD 2 (flatMapToPair at WordCount.java:18)\n17/11/08 15:53:56 INFO DAGScheduler: Got job 0 (saveAsTextFile at WordCount.java:21) with 1 output partitions\n17/11/08 15:53:56 INFO DAGScheduler: Final stage: ResultStage 1 (saveAsTextFile at WordCount.java:21)\n17/11/08 15:53:56 INFO DAGScheduler: Parents of final stage: List(ShuffleMapStage 0)\n17/11/08 15:53:56 INFO DAGScheduler: Missing parents: List(ShuffleMapStage 0)\n17/11/08 15:53:56 INFO DAGScheduler: Submitting ShuffleMapStage 0 (MapPartitionsRDD[2] at flatMapToPair at WordCount.java:18), which has no missing parents\n17/11/08 15:53:56 INFO MemoryStore: Block broadcast_1 stored as values in memory (estimated size 5.3 KB, free 366.0 MB)\n17/11/08 15:53:56 INFO MemoryStore: Block broadcast_1_piece0 stored as bytes in memory (estimated size 3.1 KB, free 366.0 MB)\n17/11/08 15:53:56 INFO BlockManagerInfo: Added broadcast_1_piece0 in memory on 10.0.1.2:63761 (size: 3.1 KB, free: 366.3 MB)\n17/11/08 15:53:56 INFO SparkContext: Created broadcast 1 from broadcast at DAGScheduler.scala:1006\n17/11/08 15:53:56 INFO DAGScheduler: Submitting 1 missing tasks from ShuffleMapStage 0 (MapPartitionsRDD[2] at flatMapToPair at WordCount.java:18) (first 15 tasks are for partitions Vector(0))\n17/11/08 15:53:56 INFO TaskSchedulerImpl: Adding task set 0.0 with 1 tasks\n17/11/08 15:53:56 INFO TaskSetManager: Starting task 0.0 in stage 0.0 (TID 0, localhost, executor driver, partition 0, PROCESS_LOCAL, 4937 bytes)\n17/11/08 15:53:56 INFO Executor: Running task 0.0 in stage 0.0 (TID 0)\n17/11/08 15:53:56 INFO Executor: Fetching spark://10.0.1.2:63760/jars/org.slf4j_slf4j-api-1.7.16.jar with timestamp 1510174436000\n17/11/08 15:53:57 INFO TransportClientFactory: Successfully created connection to /10.0.1.2:63760 after 30 ms (0 ms spent in bootstraps)\n17/11/08 15:53:57 INFO Utils: Fetching spark://10.0.1.2:63760/jars/org.slf4j_slf4j-api-1.7.16.jar to /private/var/folders/26/lfnkdm_d6mj48xfwdyl_sntm8tdtp9/T/spark-07e33210-a6be-447c-92a0-4dd504e80965/userFiles-9a4b5741-a318-420e-b112-1a4441ba030a/fetchFileTemp4839646631087629609.tmp\n17/11/08 15:53:57 INFO Executor: Adding file:/private/var/folders/26/lfnkdm_d6mj48xfwdyl_sntm8tdtp9/T/spark-07e33210-a6be-447c-92a0-4dd504e80965/userFiles-9a4b5741-a318-420e-b112-1a4441ba030a/org.slf4j_slf4j-api-1.7.16.jar to class loader\n17/11/08 15:53:57 INFO Executor: Fetching spark://10.0.1.2:63760/jars/org.apache.kafka_kafka_2.11-0.10.0.1.jar with timestamp 1510174435999\n17/11/08 15:53:57 INFO Utils: Fetching spark://10.0.1.2:63760/jars/org.apache.kafka_kafka_2.11-0.10.0.1.jar to /private/var/folders/26/lfnkdm_d6mj48xfwdyl_sntm8tdtp9/T/spark-07e33210-a6be-447c-92a0-4dd504e80965/userFiles-9a4b5741-a318-420e-b112-1a4441ba030a/fetchFileTemp8667361266232337100.tmp\n17/11/08 15:53:57 INFO Executor: Adding file:/private/var/folders/26/lfnkdm_d6mj48xfwdyl_sntm8tdtp9/T/spark-07e33210-a6be-447c-92a0-4dd504e80965/userFiles-9a4b5741-a318-420e-b112-1a4441ba030a/org.apache.kafka_kafka_2.11-0.10.0.1.jar to class loader\n17/11/08 15:53:57 INFO Executor: Fetching spark://10.0.1.2:63760/jars/org.slf4j_slf4j-log4j12-1.7.16.jar with timestamp 1510174435999\n17/11/08 15:53:57 INFO Utils: Fetching spark://10.0.1.2:63760/jars/org.slf4j_slf4j-log4j12-1.7.16.jar to /private/var/folders/26/lfnkdm_d6mj48xfwdyl_sntm8tdtp9/T/spark-07e33210-a6be-447c-92a0-4dd504e80965/userFiles-9a4b5741-a318-420e-b112-1a4441ba030a/fetchFileTemp5418243157152191799.tmp\n17/11/08 15:53:57 INFO Executor: Adding file:/private/var/folders/26/lfnkdm_d6mj48xfwdyl_sntm8tdtp9/T/spark-07e33210-a6be-447c-92a0-4dd504e80965/userFiles-9a4b5741-a318-420e-b112-1a4441ba030a/org.slf4j_slf4j-log4j12-1.7.16.jar to class loader\n17/11/08 15:53:57 INFO Executor: Fetching spark://10.0.1.2:63760/jars/org.scala-lang.modules_scala-parser-combinators_2.11-1.0.4.jar with timestamp 1510174436000\n17/11/08 15:53:57 INFO Utils: Fetching spark://10.0.1.2:63760/jars/org.scala-lang.modules_scala-parser-combinators_2.11-1.0.4.jar to /private/var/folders/26/lfnkdm_d6mj48xfwdyl_sntm8tdtp9/T/spark-07e33210-a6be-447c-92a0-4dd504e80965/userFiles-9a4b5741-a318-420e-b112-1a4441ba030a/fetchFileTemp2366789843424249528.tmp\n17/11/08 15:53:57 INFO Executor: Adding file:/private/var/folders/26/lfnkdm_d6mj48xfwdyl_sntm8tdtp9/T/spark-07e33210-a6be-447c-92a0-4dd504e80965/userFiles-9a4b5741-a318-420e-b112-1a4441ba030a/org.scala-lang.modules_scala-parser-combinators_2.11-1.0.4.jar to class loader\n17/11/08 15:53:57 INFO Executor: Fetching spark://10.0.1.2:63760/jars/org.apache.spark_spark-tags_2.11-2.2.0.jar with timestamp 1510174435999\n17/11/08 15:53:57 INFO Utils: Fetching spark://10.0.1.2:63760/jars/org.apache.spark_spark-tags_2.11-2.2.0.jar to /private/var/folders/26/lfnkdm_d6mj48xfwdyl_sntm8tdtp9/T/spark-07e33210-a6be-447c-92a0-4dd504e80965/userFiles-9a4b5741-a318-420e-b112-1a4441ba030a/fetchFileTemp2527586655699915856.tmp\n17/11/08 15:53:57 INFO Executor: Adding file:/private/var/folders/26/lfnkdm_d6mj48xfwdyl_sntm8tdtp9/T/spark-07e33210-a6be-447c-92a0-4dd504e80965/userFiles-9a4b5741-a318-420e-b112-1a4441ba030a/org.apache.spark_spark-tags_2.11-2.2.0.jar to class loader\n17/11/08 15:53:57 INFO Executor: Fetching spark://10.0.1.2:63760/jars/org.spark-project.spark_unused-1.0.0.jar with timestamp 1510174435999\n17/11/08 15:53:57 INFO Utils: Fetching spark://10.0.1.2:63760/jars/org.spark-project.spark_unused-1.0.0.jar to /private/var/folders/26/lfnkdm_d6mj48xfwdyl_sntm8tdtp9/T/spark-07e33210-a6be-447c-92a0-4dd504e80965/userFiles-9a4b5741-a318-420e-b112-1a4441ba030a/fetchFileTemp4436635514367901872.tmp\n17/11/08 15:53:57 INFO Executor: Adding file:/private/var/folders/26/lfnkdm_d6mj48xfwdyl_sntm8tdtp9/T/spark-07e33210-a6be-447c-92a0-4dd504e80965/userFiles-9a4b5741-a318-420e-b112-1a4441ba030a/org.spark-project.spark_unused-1.0.0.jar to class loader\n17/11/08 15:53:57 INFO Executor: Fetching spark://10.0.1.2:63760/jars/com.101tec_zkclient-0.8.jar with timestamp 1510174435999\n17/11/08 15:53:57 INFO Utils: Fetching spark://10.0.1.2:63760/jars/com.101tec_zkclient-0.8.jar to /private/var/folders/26/lfnkdm_d6mj48xfwdyl_sntm8tdtp9/T/spark-07e33210-a6be-447c-92a0-4dd504e80965/userFiles-9a4b5741-a318-420e-b112-1a4441ba030a/fetchFileTemp4322710809557945921.tmp\n17/11/08 15:53:57 INFO Executor: Adding file:/private/var/folders/26/lfnkdm_d6mj48xfwdyl_sntm8tdtp9/T/spark-07e33210-a6be-447c-92a0-4dd504e80965/userFiles-9a4b5741-a318-420e-b112-1a4441ba030a/com.101tec_zkclient-0.8.jar to class loader\n17/11/08 15:53:57 INFO Executor: Fetching spark://10.0.1.2:63760/jars/org.apache.spark_spark-streaming-kafka-0-10_2.11-2.2.0.jar with timestamp 1510174435998\n17/11/08 15:53:57 INFO Utils: Fetching spark://10.0.1.2:63760/jars/org.apache.spark_spark-streaming-kafka-0-10_2.11-2.2.0.jar to /private/var/folders/26/lfnkdm_d6mj48xfwdyl_sntm8tdtp9/T/spark-07e33210-a6be-447c-92a0-4dd504e80965/userFiles-9a4b5741-a318-420e-b112-1a4441ba030a/fetchFileTemp6210645736090344233.tmp\n17/11/08 15:53:57 INFO Executor: Adding file:/private/var/folders/26/lfnkdm_d6mj48xfwdyl_sntm8tdtp9/T/spark-07e33210-a6be-447c-92a0-4dd504e80965/userFiles-9a4b5741-a318-420e-b112-1a4441ba030a/org.apache.spark_spark-streaming-kafka-0-10_2.11-2.2.0.jar to class loader\n17/11/08 15:53:57 INFO Executor: Fetching spark://10.0.1.2:63760/jars/log4j_log4j-1.2.17.jar with timestamp 1510174436000\n17/11/08 15:53:57 INFO Utils: Fetching spark://10.0.1.2:63760/jars/log4j_log4j-1.2.17.jar to /private/var/folders/26/lfnkdm_d6mj48xfwdyl_sntm8tdtp9/T/spark-07e33210-a6be-447c-92a0-4dd504e80965/userFiles-9a4b5741-a318-420e-b112-1a4441ba030a/fetchFileTemp2587760876873828850.tmp\n17/11/08 15:53:57 INFO Executor: Adding file:/private/var/folders/26/lfnkdm_d6mj48xfwdyl_sntm8tdtp9/T/spark-07e33210-a6be-447c-92a0-4dd504e80965/userFiles-9a4b5741-a318-420e-b112-1a4441ba030a/log4j_log4j-1.2.17.jar to class loader\n17/11/08 15:53:57 INFO Executor: Fetching spark://10.0.1.2:63760/jars/com.yammer.metrics_metrics-core-2.2.0.jar with timestamp 1510174435999\n17/11/08 15:53:57 INFO Utils: Fetching spark://10.0.1.2:63760/jars/com.yammer.metrics_metrics-core-2.2.0.jar to /private/var/folders/26/lfnkdm_d6mj48xfwdyl_sntm8tdtp9/T/spark-07e33210-a6be-447c-92a0-4dd504e80965/userFiles-9a4b5741-a318-420e-b112-1a4441ba030a/fetchFileTemp8763096223513955185.tmp\n17/11/08 15:53:57 INFO Executor: Adding file:/private/var/folders/26/lfnkdm_d6mj48xfwdyl_sntm8tdtp9/T/spark-07e33210-a6be-447c-92a0-4dd504e80965/userFiles-9a4b5741-a318-420e-b112-1a4441ba030a/com.yammer.metrics_metrics-core-2.2.0.jar to class loader\n17/11/08 15:53:57 INFO Executor: Fetching spark://10.0.1.2:63760/jars/org.apache.kafka_kafka-clients-0.10.0.1.jar with timestamp 1510174436000\n17/11/08 15:53:57 INFO Utils: Fetching spark://10.0.1.2:63760/jars/org.apache.kafka_kafka-clients-0.10.0.1.jar to /private/var/folders/26/lfnkdm_d6mj48xfwdyl_sntm8tdtp9/T/spark-07e33210-a6be-447c-92a0-4dd504e80965/userFiles-9a4b5741-a318-420e-b112-1a4441ba030a/fetchFileTemp2368772990989848791.tmp\n17/11/08 15:53:57 INFO Executor: Adding file:/private/var/folders/26/lfnkdm_d6mj48xfwdyl_sntm8tdtp9/T/spark-07e33210-a6be-447c-92a0-4dd504e80965/userFiles-9a4b5741-a318-420e-b112-1a4441ba030a/org.apache.kafka_kafka-clients-0.10.0.1.jar to class loader\n17/11/08 15:53:57 INFO Utils: Fetching spark://10.0.1.2:63760/jars/org.xerial.snappy_snappy-java-1.1.2.6.jar to /private/var/folders/26/lfnkdm_d6mj48xfwdyl_sntm8tdtp9/T/spark-07e33210-a6be-447c-92a0-4dd504e80965/userFiles-9a4b5741-a318-420e-b112-1a4441ba030a/fetchFileTemp5933403694236070460.tmp\n17/11/08 15:53:57 INFO Executor: Adding file:/private/var/folders/26/lfnkdm_d6mj48xfwdyl_sntm8tdtp9/T/spark-07e33210-a6be-447c-92a0-4dd504e80965/userFiles-9a4b5741-a318-420e-b112-1a4441ba030a/org.xerial.snappy_snappy-java-1.1.2.6.jar to class loader\n17/11/08 15:53:57 INFO Executor: Fetching spark://10.0.1.2:63760/jars/sparkdriver-1.0-SNAPSHOT.jar with timestamp 1510174436000\n17/11/08 15:53:57 INFO Utils: Fetching spark://10.0.1.2:63760/jars/sparkdriver-1.0-SNAPSHOT.jar to /private/var/folders/26/lfnkdm_d6mj48xfwdyl_sntm8tdtp9/T/spark-07e33210-a6be-447c-92a0-4dd504e80965/userFiles-9a4b5741-a318-420e-b112-1a4441ba030a/fetchFileTemp9172284954823303788.tmp\n17/11/08 15:53:57 INFO Executor: Adding file:/private/var/folders/26/lfnkdm_d6mj48xfwdyl_sntm8tdtp9/T/spark-07e33210-a6be-447c-92a0-4dd504e80965/userFiles-9a4b5741-a318-420e-b112-1a4441ba030a/sparkdriver-1.0-SNAPSHOT.jar to class loader\n17/11/08 15:53:57 INFO Executor: Fetching spark://10.0.1.2:63760/jars/net.jpountz.lz4_lz4-1.3.0.jar with timestamp 1510174436000\n17/11/08 15:53:57 INFO Utils: Fetching spark://10.0.1.2:63760/jars/net.jpountz.lz4_lz4-1.3.0.jar to /private/var/folders/26/lfnkdm_d6mj48xfwdyl_sntm8tdtp9/T/spark-07e33210-a6be-447c-92a0-4dd504e80965/userFiles-9a4b5741-a318-420e-b112-1a4441ba030a/fetchFileTemp2018048990610379910.tmp\n17/11/08 15:53:57 INFO Executor: Adding file:/private/var/folders/26/lfnkdm_d6mj48xfwdyl_sntm8tdtp9/T/spark-07e33210-a6be-447c-92a0-4dd504e80965/userFiles-9a4b5741-a318-420e-b112-1a4441ba030a/net.jpountz.lz4_lz4-1.3.0.jar to class loader\n17/11/08 15:53:57 INFO HadoopRDD: Input split: file:/usr/local/Cellar/apache-spark/2.2.0/libexec/logs/spark-v0001-org.apache.spark.deploy.master.Master-1-TUSMA06RMLVT047.out:0+3424\n17/11/08 15:53:57 INFO Executor: Finished task 0.0 in stage 0.0 (TID 0). 1192 bytes result sent to driver\n17/11/08 15:53:57 INFO TaskSetManager: Finished task 0.0 in stage 0.0 (TID 0) in 571 ms on localhost (executor driver) (1/1)\n17/11/08 15:53:57 INFO TaskSchedulerImpl: Removed TaskSet 0.0, whose tasks have all completed, from pool \n17/11/08 15:53:57 INFO DAGScheduler: ShuffleMapStage 0 (flatMapToPair at WordCount.java:18) finished in 0.590 s\n17/11/08 15:53:57 INFO DAGScheduler: looking for newly runnable stages\n17/11/08 15:53:57 INFO DAGScheduler: running: Set()\n17/11/08 15:53:57 INFO DAGScheduler: waiting: Set(ResultStage 1)\n17/11/08 15:53:57 INFO DAGScheduler: failed: Set()\n17/11/08 15:53:57 INFO DAGScheduler: Submitting ResultStage 1 (MapPartitionsRDD[4] at saveAsTextFile at WordCount.java:21), which has no missing parents\n17/11/08 15:53:57 INFO MemoryStore: Block broadcast_2 stored as values in memory (estimated size 72.6 KB, free 366.0 MB)\n17/11/08 15:53:57 INFO MemoryStore: Block broadcast_2_piece0 stored as bytes in memory (estimated size 26.1 KB, free 365.9 MB)\n17/11/08 15:53:57 INFO BlockManagerInfo: Added broadcast_2_piece0 in memory on 10.0.1.2:63761 (size: 26.1 KB, free: 366.2 MB)\n17/11/08 15:53:57 INFO SparkContext: Created broadcast 2 from broadcast at DAGScheduler.scala:1006\n17/11/08 15:53:57 INFO DAGScheduler: Submitting 1 missing tasks from ResultStage 1 (MapPartitionsRDD[4] at saveAsTextFile at WordCount.java:21) (first 15 tasks are for partitions Vector(0))\n17/11/08 15:53:57 INFO TaskSchedulerImpl: Adding task set 1.0 with 1 tasks\n17/11/08 15:53:57 INFO TaskSetManager: Starting task 0.0 in stage 1.0 (TID 1, localhost, executor driver, partition 0, ANY, 4621 bytes)\n17/11/08 15:53:57 INFO Executor: Running task 0.0 in stage 1.0 (TID 1)\n17/11/08 15:53:57 INFO ShuffleBlockFetcherIterator: Getting 1 non-empty blocks out of 1 blocks\n17/11/08 15:53:57 INFO ShuffleBlockFetcherIterator: Started 0 remote fetches in 4 ms\n17/11/08 15:53:57 INFO FileOutputCommitter: File Output Committer Algorithm version is 1\n17/11/08 15:53:57 INFO FileOutputCommitter: Saved output of task 'attempt_20171108155356_0001_m_000000_1' to file:/Users/v0001/iot/thingspace/go/src/stash.verizon.com/npdthing/metrics/sparkdriver/wordcount.out/_temporary/0/task_20171108155356_0001_m_000000\n17/11/08 15:53:57 INFO SparkHadoopMapRedUtil: attempt_20171108155356_0001_m_000000_1: Committed\n17/11/08 15:53:57 INFO Executor: Finished task 0.0 in stage 1.0 (TID 1). 1224 bytes result sent to driver\n17/11/08 15:53:57 INFO TaskSetManager: Finished task 0.0 in stage 1.0 (TID 1) in 123 ms on localhost (executor driver) (1/1)\n17/11/08 15:53:57 INFO TaskSchedulerImpl: Removed TaskSet 1.0, whose tasks have all completed, from pool \n17/11/08 15:53:57 INFO DAGScheduler: ResultStage 1 (saveAsTextFile at WordCount.java:21) finished in 0.123 s\n17/11/08 15:53:57 INFO DAGScheduler: Job 0 finished: saveAsTextFile at WordCount.java:21, took 0.852166 s\n17/11/08 15:53:57 INFO SparkContext: Invoking stop() from shutdown hook\n17/11/08 15:53:57 INFO SparkUI: Stopped Spark web UI at http://10.0.1.2:4040\n17/11/08 15:53:57 INFO MapOutputTrackerMasterEndpoint: MapOutputTrackerMasterEndpoint stopped!\n17/11/08 15:53:57 INFO MemoryStore: MemoryStore cleared\n17/11/08 15:53:57 INFO BlockManager: BlockManager stopped\n17/11/08 15:53:57 INFO BlockManagerMaster: BlockManagerMaster stopped\n17/11/08 15:53:57 INFO OutputCommitCoordinator$OutputCommitCoordinatorEndpoint: OutputCommitCoordinator stopped!\n17/11/08 15:53:57 INFO SparkContext: Successfully stopped SparkContext\n17/11/08 15:53:57 INFO ShutdownHookManager: Deleting directory /private/var/folders/26/lfnkdm_d6mj48xfwdyl_sntm8tdtp9/T/spark-07e33210-a6be-447c-92a0-4dd504e80965\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"0","comment_count":"2","creation_date":"2017-11-08 21:12:13.357 UTC","last_activity_date":"2017-11-10 10:47:16.48 UTC","last_edit_date":"2017-11-10 10:47:16.48 UTC","last_editor_display_name":"","last_editor_user_id":"5057350","owner_display_name":"","owner_user_id":"4445793","post_type_id":"1","score":"2","tags":"java|apache-spark|apache-kafka|spark-streaming|spark-submit","view_count":"40"} +{"id":"47189779","title":"What causes \"unknown resolver null\" in Spark Kafka Connector?","body":"\u003cp\u003eI am new to spark, I have start zookeeper, kafka(0.10.1.1) on my local, also spark standalone(2.2.0) with one cluster manager and 2 workers. my local scal version is 2.12.3\u003c/p\u003e\n\n\u003cp\u003eI was able to run wordcount on spark, and using kafka console producer and consumer to pub/sub message from kafka topic.\u003c/p\u003e\n\n\u003cp\u003eThe problem I have is: whenever I add kafka package using the spark-submit --packages, I got\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e...\n:: problems summary ::\n:::: ERRORS\n unknown resolver null\n\n:: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS\n:: retrieving :: org.apache.spark#spark-submit-parent\n confs: [default]\n 0 artifacts copied, 13 already retrieved (0kB/9ms)\n...\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eEven I am not using the kafka connector at all.\nThe detail logs are following:\u003c/p\u003e\n\n\u003cp\u003ecommand\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e$SPARK_HOME/bin/spark-submit --packages org.apache.spark:spark-streaming-kafka-0-10_2.11:2.2.0 --cluster_manager spark://TUSMA06RMLVT047:7077 build/libs/sparkdriver-1.0-SNAPSHOT.jar\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003elog\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eIvy Default Cache set to: /Users/v0001/.ivy2/cache\nThe jars for the packages stored in: /Users/v0001/.ivy2/jars\n:: loading settings :: url = jar:file:/usr/local/Cellar/apache-spark/2.2.0/libexec/jars/ivy-2.4.0.jar!/org/apache/ivy/core/settings/ivysettings.xml\norg.apache.spark#spark-streaming-kafka-0-10_2.11 added as a dependency\n:: resolving dependencies :: org.apache.spark#spark-submit-parent;1.0\n confs: [default]\n found org.apache.spark#spark-streaming-kafka-0-10_2.11;2.2.0 in local-m2-cache\n found org.apache.kafka#kafka_2.11;0.10.0.1 in local-m2-cache\n found com.101tec#zkclient;0.8 in local-m2-cache\n found org.slf4j#slf4j-api;1.7.16 in spark-list\n found org.slf4j#slf4j-log4j12;1.7.16 in spark-list\n found log4j#log4j;1.2.17 in spark-list\n found com.yammer.metrics#metrics-core;2.2.0 in local-m2-cache\n found org.scala-lang.modules#scala-parser-combinators_2.11;1.0.4 in spark-list\n found org.apache.kafka#kafka-clients;0.10.0.1 in local-m2-cache\n found net.jpountz.lz4#lz4;1.3.0 in spark-list\n found org.xerial.snappy#snappy-java;1.1.2.6 in spark-list\n found org.apache.spark#spark-tags_2.11;2.2.0 in local-m2-cache\n found org.spark-project.spark#unused;1.0.0 in spark-list\n:: resolution report :: resolve 1805ms :: artifacts dl 14ms\n :: modules in use:\n com.101tec#zkclient;0.8 from local-m2-cache in [default]\n com.yammer.metrics#metrics-core;2.2.0 from local-m2-cache in [default]\n log4j#log4j;1.2.17 from spark-list in [default]\n net.jpountz.lz4#lz4;1.3.0 from spark-list in [default]\n org.apache.kafka#kafka-clients;0.10.0.1 from local-m2-cache in [default]\n org.apache.kafka#kafka_2.11;0.10.0.1 from local-m2-cache in [default]\n org.apache.spark#spark-streaming-kafka-0-10_2.11;2.2.0 from local-m2-cache in [default]\n org.apache.spark#spark-tags_2.11;2.2.0 from local-m2-cache in [default]\n org.scala-lang.modules#scala-parser-combinators_2.11;1.0.4 from spark-list in [default]\n org.slf4j#slf4j-api;1.7.16 from spark-list in [default]\n org.slf4j#slf4j-log4j12;1.7.16 from spark-list in [default]\n org.spark-project.spark#unused;1.0.0 from spark-list in [default]\n org.xerial.snappy#snappy-java;1.1.2.6 from spark-list in [default]\n ---------------------------------------------------------------------\n | | modules || artifacts |\n | conf | number| search|dwnlded|evicted|| number|dwnlded|\n ---------------------------------------------------------------------\n | default | 13 | 2 | 2 | 0 || 13 | 0 |\n ---------------------------------------------------------------------\n\n:: problems summary ::\n:::: ERRORS\n unknown resolver null\n\n\n:: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS\n:: retrieving :: org.apache.spark#spark-submit-parent\n confs: [default]\n 0 artifacts copied, 13 already retrieved (0kB/9ms)\nUsing Spark's default log4j profile: org/apache/spark/log4j-defaults.properties\n17/11/08 15:53:55 INFO SparkContext: Running Spark version 2.2.0\n17/11/08 15:53:55 WARN NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable\n17/11/08 15:53:55 INFO SparkContext: Submitted application: WordCount\n17/11/08 15:53:55 INFO SecurityManager: Changing view acls to: v0001\n17/11/08 15:53:55 INFO SecurityManager: Changing modify acls to: v0001\n17/11/08 15:53:55 INFO SecurityManager: Changing view acls groups to: \n17/11/08 15:53:55 INFO SecurityManager: Changing modify acls groups to: \n17/11/08 15:53:55 INFO SecurityManager: SecurityManager: authentication disabled; ui acls disabled; users with view permissions: Set(v0001); groups with view permissions: Set(); users with modify permissions: Set(v0001); groups with modify permissions: Set()\n17/11/08 15:53:55 INFO Utils: Successfully started service 'sparkDriver' on port 63760.\n17/11/08 15:53:55 INFO SparkEnv: Registering MapOutputTracker\n17/11/08 15:53:55 INFO SparkEnv: Registering BlockManagerClusterManager\n17/11/08 15:53:55 INFO BlockManagerClusterManagerEndpoint: Using org.apache.spark.storage.DefaultTopologyMapper for getting topology information\n17/11/08 15:53:55 INFO BlockManagerClusterManagerEndpoint: BlockManagerClusterManagerEndpoint up\n17/11/08 15:53:55 INFO DiskBlockManager: Created local directory at /private/var/folders/26/lfnkdm_d6mj48xfwdyl_sntm8tdtp9/T/blockmgr-b6a7af13-30eb-43ef-a235-e42105699289\n17/11/08 15:53:55 INFO MemoryStore: MemoryStore started with capacity 366.3 MB\n17/11/08 15:53:55 INFO SparkEnv: Registering OutputCommitCoordinator\n17/11/08 15:53:55 INFO Utils: Successfully started service 'SparkUI' on port 4040.\n17/11/08 15:53:55 INFO SparkUI: Bound SparkUI to 0.0.0.0, and started at http://10.0.1.2:4040\n17/11/08 15:53:55 INFO SparkContext: Added JAR file:/Users/v0001/.ivy2/jars/org.apache.spark_spark-streaming-kafka-0-10_2.11-2.2.0.jar at spark://10.0.1.2:63760/jars/org.apache.spark_spark-streaming-kafka-0-10_2.11-2.2.0.jar with timestamp 1510174435998\n17/11/08 15:53:55 INFO SparkContext: Added JAR file:/Users/v0001/.ivy2/jars/org.apache.kafka_kafka_2.11-0.10.0.1.jar at spark://10.0.1.2:63760/jars/org.apache.kafka_kafka_2.11-0.10.0.1.jar with timestamp 1510174435999\n17/11/08 15:53:55 INFO SparkContext: Added JAR file:/Users/v0001/.ivy2/jars/org.apache.spark_spark-tags_2.11-2.2.0.jar at spark://10.0.1.2:63760/jars/org.apache.spark_spark-tags_2.11-2.2.0.jar with timestamp 1510174435999\n17/11/08 15:53:55 INFO SparkContext: Added JAR file:/Users/v0001/.ivy2/jars/org.spark-project.spark_unused-1.0.0.jar at spark://10.0.1.2:63760/jars/org.spark-project.spark_unused-1.0.0.jar with timestamp 1510174435999\n17/11/08 15:53:55 INFO SparkContext: Added JAR file:/Users/v0001/.ivy2/jars/com.101tec_zkclient-0.8.jar at spark://10.0.1.2:63760/jars/com.101tec_zkclient-0.8.jar with timestamp 1510174435999\n17/11/08 15:53:55 INFO SparkContext: Added JAR file:/Users/v0001/.ivy2/jars/org.slf4j_slf4j-log4j12-1.7.16.jar at spark://10.0.1.2:63760/jars/org.slf4j_slf4j-log4j12-1.7.16.jar with timestamp 1510174435999\n17/11/08 15:53:55 INFO SparkContext: Added JAR file:/Users/v0001/.ivy2/jars/com.yammer.metrics_metrics-core-2.2.0.jar at spark://10.0.1.2:63760/jars/com.yammer.metrics_metrics-core-2.2.0.jar with timestamp 1510174435999\n17/11/08 15:53:56 INFO SparkContext: Added JAR file:/Users/v0001/.ivy2/jars/org.scala-lang.modules_scala-parser-combinators_2.11-1.0.4.jar at spark://10.0.1.2:63760/jars/org.scala-lang.modules_scala-parser-combinators_2.11-1.0.4.jar with timestamp 1510174436000\n17/11/08 15:53:56 INFO SparkContext: Added JAR file:/Users/v0001/.ivy2/jars/org.apache.kafka_kafka-clients-0.10.0.1.jar at spark://10.0.1.2:63760/jars/org.apache.kafka_kafka-clients-0.10.0.1.jar with timestamp 1510174436000\n17/11/08 15:53:56 INFO SparkContext: Added JAR file:/Users/v0001/.ivy2/jars/org.slf4j_slf4j-api-1.7.16.jar at spark://10.0.1.2:63760/jars/org.slf4j_slf4j-api-1.7.16.jar with timestamp 1510174436000\n17/11/08 15:53:56 INFO SparkContext: Added JAR file:/Users/v0001/.ivy2/jars/log4j_log4j-1.2.17.jar at spark://10.0.1.2:63760/jars/log4j_log4j-1.2.17.jar with timestamp 1510174436000\n17/11/08 15:53:56 INFO SparkContext: Added JAR file:/Users/v0001/.ivy2/jars/net.jpountz.lz4_lz4-1.3.0.jar at spark://10.0.1.2:63760/jars/net.jpountz.lz4_lz4-1.3.0.jar with timestamp 1510174436000\n17/11/08 15:53:56 INFO SparkContext: Added JAR file:/Users/v0001/.ivy2/jars/org.xerial.snappy_snappy-java-1.1.2.6.jar at spark://10.0.1.2:63760/jars/org.xerial.snappy_snappy-java-1.1.2.6.jar with timestamp 1510174436000\n17/11/08 15:53:56 INFO SparkContext: Added JAR file:/Users/v0001/iot/thingspace/go/src/stash.verizon.com/npdthing/metrics/sparkdriver/build/libs/sparkdriver-1.0-SNAPSHOT.jar at spark://10.0.1.2:63760/jars/sparkdriver-1.0-SNAPSHOT.jar with timestamp 1510174436000\n17/11/08 15:53:56 INFO Executor: Starting executor ID driver on host localhost\n17/11/08 15:53:56 INFO Utils: Successfully started service 'org.apache.spark.network.netty.NettyBlockTransferService' on port 63761.\n17/11/08 15:53:56 INFO NettyBlockTransferService: Server created on 10.0.1.2:63761\n17/11/08 15:53:56 INFO BlockManager: Using org.apache.spark.storage.RandomBlockReplicationPolicy for block replication policy\n17/11/08 15:53:56 INFO BlockManagerClusterManager: Registering BlockManager BlockManagerId(driver, 10.0.1.2, 63761, None)\n17/11/08 15:53:56 INFO BlockManagerClusterManagerEndpoint: Registering block manager 10.0.1.2:63761 with 366.3 MB RAM, BlockManagerId(driver, 10.0.1.2, 63761, None)\n17/11/08 15:53:56 INFO BlockManagerClusterManager: Registered BlockManager BlockManagerId(driver, 10.0.1.2, 63761, None)\n17/11/08 15:53:56 INFO BlockManager: Initialized BlockManager: BlockManagerId(driver, 10.0.1.2, 63761, None)\n17/11/08 15:53:56 INFO MemoryStore: Block broadcast_0 stored as values in memory (estimated size 236.5 KB, free 366.1 MB)\n17/11/08 15:53:56 INFO MemoryStore: Block broadcast_0_piece0 stored as bytes in memory (estimated size 22.9 KB, free 366.0 MB)\n17/11/08 15:53:56 INFO BlockManagerInfo: Added broadcast_0_piece0 in memory on 10.0.1.2:63761 (size: 22.9 KB, free: 366.3 MB)\n17/11/08 15:53:56 INFO SparkContext: Created broadcast 0 from textFile at WordCount.java:15\n17/11/08 15:53:56 INFO FileInputFormat: Total input paths to process : 1\n17/11/08 15:53:56 INFO FileOutputCommitter: File Output Committer Algorithm version is 1\n17/11/08 15:53:56 INFO SparkContext: Starting job: saveAsTextFile at WordCount.java:21\n17/11/08 15:53:56 INFO DAGScheduler: Registering RDD 2 (flatMapToPair at WordCount.java:18)\n17/11/08 15:53:56 INFO DAGScheduler: Got job 0 (saveAsTextFile at WordCount.java:21) with 1 output partitions\n17/11/08 15:53:56 INFO DAGScheduler: Final stage: ResultStage 1 (saveAsTextFile at WordCount.java:21)\n17/11/08 15:53:56 INFO DAGScheduler: Parents of final stage: List(ShuffleMapStage 0)\n17/11/08 15:53:56 INFO DAGScheduler: Missing parents: List(ShuffleMapStage 0)\n17/11/08 15:53:56 INFO DAGScheduler: Submitting ShuffleMapStage 0 (MapPartitionsRDD[2] at flatMapToPair at WordCount.java:18), which has no missing parents\n17/11/08 15:53:56 INFO MemoryStore: Block broadcast_1 stored as values in memory (estimated size 5.3 KB, free 366.0 MB)\n17/11/08 15:53:56 INFO MemoryStore: Block broadcast_1_piece0 stored as bytes in memory (estimated size 3.1 KB, free 366.0 MB)\n17/11/08 15:53:56 INFO BlockManagerInfo: Added broadcast_1_piece0 in memory on 10.0.1.2:63761 (size: 3.1 KB, free: 366.3 MB)\n17/11/08 15:53:56 INFO SparkContext: Created broadcast 1 from broadcast at DAGScheduler.scala:1006\n17/11/08 15:53:56 INFO DAGScheduler: Submitting 1 missing tasks from ShuffleMapStage 0 (MapPartitionsRDD[2] at flatMapToPair at WordCount.java:18) (first 15 tasks are for partitions Vector(0))\n17/11/08 15:53:56 INFO TaskSchedulerImpl: Adding task set 0.0 with 1 tasks\n17/11/08 15:53:56 INFO TaskSetManager: Starting task 0.0 in stage 0.0 (TID 0, localhost, executor driver, partition 0, PROCESS_LOCAL, 4937 bytes)\n17/11/08 15:53:56 INFO Executor: Running task 0.0 in stage 0.0 (TID 0)\n17/11/08 15:53:56 INFO Executor: Fetching spark://10.0.1.2:63760/jars/org.slf4j_slf4j-api-1.7.16.jar with timestamp 1510174436000\n17/11/08 15:53:57 INFO TransportClientFactory: Successfully created connection to /10.0.1.2:63760 after 30 ms (0 ms spent in bootstraps)\n17/11/08 15:53:57 INFO Utils: Fetching spark://10.0.1.2:63760/jars/org.slf4j_slf4j-api-1.7.16.jar to /private/var/folders/26/lfnkdm_d6mj48xfwdyl_sntm8tdtp9/T/spark-07e33210-a6be-447c-92a0-4dd504e80965/userFiles-9a4b5741-a318-420e-b112-1a4441ba030a/fetchFileTemp4839646631087629609.tmp\n17/11/08 15:53:57 INFO Executor: Adding file:/private/var/folders/26/lfnkdm_d6mj48xfwdyl_sntm8tdtp9/T/spark-07e33210-a6be-447c-92a0-4dd504e80965/userFiles-9a4b5741-a318-420e-b112-1a4441ba030a/org.slf4j_slf4j-api-1.7.16.jar to class loader\n17/11/08 15:53:57 INFO Executor: Fetching spark://10.0.1.2:63760/jars/org.apache.kafka_kafka_2.11-0.10.0.1.jar with timestamp 1510174435999\n17/11/08 15:53:57 INFO Utils: Fetching spark://10.0.1.2:63760/jars/org.apache.kafka_kafka_2.11-0.10.0.1.jar to /private/var/folders/26/lfnkdm_d6mj48xfwdyl_sntm8tdtp9/T/spark-07e33210-a6be-447c-92a0-4dd504e80965/userFiles-9a4b5741-a318-420e-b112-1a4441ba030a/fetchFileTemp8667361266232337100.tmp\n17/11/08 15:53:57 INFO Executor: Adding file:/private/var/folders/26/lfnkdm_d6mj48xfwdyl_sntm8tdtp9/T/spark-07e33210-a6be-447c-92a0-4dd504e80965/userFiles-9a4b5741-a318-420e-b112-1a4441ba030a/org.apache.kafka_kafka_2.11-0.10.0.1.jar to class loader\n17/11/08 15:53:57 INFO Executor: Fetching spark://10.0.1.2:63760/jars/org.slf4j_slf4j-log4j12-1.7.16.jar with timestamp 1510174435999\n17/11/08 15:53:57 INFO Utils: Fetching spark://10.0.1.2:63760/jars/org.slf4j_slf4j-log4j12-1.7.16.jar to /private/var/folders/26/lfnkdm_d6mj48xfwdyl_sntm8tdtp9/T/spark-07e33210-a6be-447c-92a0-4dd504e80965/userFiles-9a4b5741-a318-420e-b112-1a4441ba030a/fetchFileTemp5418243157152191799.tmp\n17/11/08 15:53:57 INFO Executor: Adding file:/private/var/folders/26/lfnkdm_d6mj48xfwdyl_sntm8tdtp9/T/spark-07e33210-a6be-447c-92a0-4dd504e80965/userFiles-9a4b5741-a318-420e-b112-1a4441ba030a/org.slf4j_slf4j-log4j12-1.7.16.jar to class loader\n17/11/08 15:53:57 INFO Executor: Fetching spark://10.0.1.2:63760/jars/org.scala-lang.modules_scala-parser-combinators_2.11-1.0.4.jar with timestamp 1510174436000\n17/11/08 15:53:57 INFO Utils: Fetching spark://10.0.1.2:63760/jars/org.scala-lang.modules_scala-parser-combinators_2.11-1.0.4.jar to /private/var/folders/26/lfnkdm_d6mj48xfwdyl_sntm8tdtp9/T/spark-07e33210-a6be-447c-92a0-4dd504e80965/userFiles-9a4b5741-a318-420e-b112-1a4441ba030a/fetchFileTemp2366789843424249528.tmp\n17/11/08 15:53:57 INFO Executor: Adding file:/private/var/folders/26/lfnkdm_d6mj48xfwdyl_sntm8tdtp9/T/spark-07e33210-a6be-447c-92a0-4dd504e80965/userFiles-9a4b5741-a318-420e-b112-1a4441ba030a/org.scala-lang.modules_scala-parser-combinators_2.11-1.0.4.jar to class loader\n17/11/08 15:53:57 INFO Executor: Fetching spark://10.0.1.2:63760/jars/org.apache.spark_spark-tags_2.11-2.2.0.jar with timestamp 1510174435999\n17/11/08 15:53:57 INFO Utils: Fetching spark://10.0.1.2:63760/jars/org.apache.spark_spark-tags_2.11-2.2.0.jar to /private/var/folders/26/lfnkdm_d6mj48xfwdyl_sntm8tdtp9/T/spark-07e33210-a6be-447c-92a0-4dd504e80965/userFiles-9a4b5741-a318-420e-b112-1a4441ba030a/fetchFileTemp2527586655699915856.tmp\n17/11/08 15:53:57 INFO Executor: Adding file:/private/var/folders/26/lfnkdm_d6mj48xfwdyl_sntm8tdtp9/T/spark-07e33210-a6be-447c-92a0-4dd504e80965/userFiles-9a4b5741-a318-420e-b112-1a4441ba030a/org.apache.spark_spark-tags_2.11-2.2.0.jar to class loader\n17/11/08 15:53:57 INFO Executor: Fetching spark://10.0.1.2:63760/jars/org.spark-project.spark_unused-1.0.0.jar with timestamp 1510174435999\n17/11/08 15:53:57 INFO Utils: Fetching spark://10.0.1.2:63760/jars/org.spark-project.spark_unused-1.0.0.jar to /private/var/folders/26/lfnkdm_d6mj48xfwdyl_sntm8tdtp9/T/spark-07e33210-a6be-447c-92a0-4dd504e80965/userFiles-9a4b5741-a318-420e-b112-1a4441ba030a/fetchFileTemp4436635514367901872.tmp\n17/11/08 15:53:57 INFO Executor: Adding file:/private/var/folders/26/lfnkdm_d6mj48xfwdyl_sntm8tdtp9/T/spark-07e33210-a6be-447c-92a0-4dd504e80965/userFiles-9a4b5741-a318-420e-b112-1a4441ba030a/org.spark-project.spark_unused-1.0.0.jar to class loader\n17/11/08 15:53:57 INFO Executor: Fetching spark://10.0.1.2:63760/jars/com.101tec_zkclient-0.8.jar with timestamp 1510174435999\n17/11/08 15:53:57 INFO Utils: Fetching spark://10.0.1.2:63760/jars/com.101tec_zkclient-0.8.jar to /private/var/folders/26/lfnkdm_d6mj48xfwdyl_sntm8tdtp9/T/spark-07e33210-a6be-447c-92a0-4dd504e80965/userFiles-9a4b5741-a318-420e-b112-1a4441ba030a/fetchFileTemp4322710809557945921.tmp\n17/11/08 15:53:57 INFO Executor: Adding file:/private/var/folders/26/lfnkdm_d6mj48xfwdyl_sntm8tdtp9/T/spark-07e33210-a6be-447c-92a0-4dd504e80965/userFiles-9a4b5741-a318-420e-b112-1a4441ba030a/com.101tec_zkclient-0.8.jar to class loader\n17/11/08 15:53:57 INFO Executor: Fetching spark://10.0.1.2:63760/jars/org.apache.spark_spark-streaming-kafka-0-10_2.11-2.2.0.jar with timestamp 1510174435998\n17/11/08 15:53:57 INFO Utils: Fetching spark://10.0.1.2:63760/jars/org.apache.spark_spark-streaming-kafka-0-10_2.11-2.2.0.jar to /private/var/folders/26/lfnkdm_d6mj48xfwdyl_sntm8tdtp9/T/spark-07e33210-a6be-447c-92a0-4dd504e80965/userFiles-9a4b5741-a318-420e-b112-1a4441ba030a/fetchFileTemp6210645736090344233.tmp\n17/11/08 15:53:57 INFO Executor: Adding file:/private/var/folders/26/lfnkdm_d6mj48xfwdyl_sntm8tdtp9/T/spark-07e33210-a6be-447c-92a0-4dd504e80965/userFiles-9a4b5741-a318-420e-b112-1a4441ba030a/org.apache.spark_spark-streaming-kafka-0-10_2.11-2.2.0.jar to class loader\n17/11/08 15:53:57 INFO Executor: Fetching spark://10.0.1.2:63760/jars/log4j_log4j-1.2.17.jar with timestamp 1510174436000\n17/11/08 15:53:57 INFO Utils: Fetching spark://10.0.1.2:63760/jars/log4j_log4j-1.2.17.jar to /private/var/folders/26/lfnkdm_d6mj48xfwdyl_sntm8tdtp9/T/spark-07e33210-a6be-447c-92a0-4dd504e80965/userFiles-9a4b5741-a318-420e-b112-1a4441ba030a/fetchFileTemp2587760876873828850.tmp\n17/11/08 15:53:57 INFO Executor: Adding file:/private/var/folders/26/lfnkdm_d6mj48xfwdyl_sntm8tdtp9/T/spark-07e33210-a6be-447c-92a0-4dd504e80965/userFiles-9a4b5741-a318-420e-b112-1a4441ba030a/log4j_log4j-1.2.17.jar to class loader\n17/11/08 15:53:57 INFO Executor: Fetching spark://10.0.1.2:63760/jars/com.yammer.metrics_metrics-core-2.2.0.jar with timestamp 1510174435999\n17/11/08 15:53:57 INFO Utils: Fetching spark://10.0.1.2:63760/jars/com.yammer.metrics_metrics-core-2.2.0.jar to /private/var/folders/26/lfnkdm_d6mj48xfwdyl_sntm8tdtp9/T/spark-07e33210-a6be-447c-92a0-4dd504e80965/userFiles-9a4b5741-a318-420e-b112-1a4441ba030a/fetchFileTemp8763096223513955185.tmp\n17/11/08 15:53:57 INFO Executor: Adding file:/private/var/folders/26/lfnkdm_d6mj48xfwdyl_sntm8tdtp9/T/spark-07e33210-a6be-447c-92a0-4dd504e80965/userFiles-9a4b5741-a318-420e-b112-1a4441ba030a/com.yammer.metrics_metrics-core-2.2.0.jar to class loader\n17/11/08 15:53:57 INFO Executor: Fetching spark://10.0.1.2:63760/jars/org.apache.kafka_kafka-clients-0.10.0.1.jar with timestamp 1510174436000\n17/11/08 15:53:57 INFO Utils: Fetching spark://10.0.1.2:63760/jars/org.apache.kafka_kafka-clients-0.10.0.1.jar to /private/var/folders/26/lfnkdm_d6mj48xfwdyl_sntm8tdtp9/T/spark-07e33210-a6be-447c-92a0-4dd504e80965/userFiles-9a4b5741-a318-420e-b112-1a4441ba030a/fetchFileTemp2368772990989848791.tmp\n17/11/08 15:53:57 INFO Executor: Adding file:/private/var/folders/26/lfnkdm_d6mj48xfwdyl_sntm8tdtp9/T/spark-07e33210-a6be-447c-92a0-4dd504e80965/userFiles-9a4b5741-a318-420e-b112-1a4441ba030a/org.apache.kafka_kafka-clients-0.10.0.1.jar to class loader\n17/11/08 15:53:57 INFO Utils: Fetching spark://10.0.1.2:63760/jars/org.xerial.snappy_snappy-java-1.1.2.6.jar to /private/var/folders/26/lfnkdm_d6mj48xfwdyl_sntm8tdtp9/T/spark-07e33210-a6be-447c-92a0-4dd504e80965/userFiles-9a4b5741-a318-420e-b112-1a4441ba030a/fetchFileTemp5933403694236070460.tmp\n17/11/08 15:53:57 INFO Executor: Adding file:/private/var/folders/26/lfnkdm_d6mj48xfwdyl_sntm8tdtp9/T/spark-07e33210-a6be-447c-92a0-4dd504e80965/userFiles-9a4b5741-a318-420e-b112-1a4441ba030a/org.xerial.snappy_snappy-java-1.1.2.6.jar to class loader\n17/11/08 15:53:57 INFO Executor: Fetching spark://10.0.1.2:63760/jars/sparkdriver-1.0-SNAPSHOT.jar with timestamp 1510174436000\n17/11/08 15:53:57 INFO Utils: Fetching spark://10.0.1.2:63760/jars/sparkdriver-1.0-SNAPSHOT.jar to /private/var/folders/26/lfnkdm_d6mj48xfwdyl_sntm8tdtp9/T/spark-07e33210-a6be-447c-92a0-4dd504e80965/userFiles-9a4b5741-a318-420e-b112-1a4441ba030a/fetchFileTemp9172284954823303788.tmp\n17/11/08 15:53:57 INFO Executor: Adding file:/private/var/folders/26/lfnkdm_d6mj48xfwdyl_sntm8tdtp9/T/spark-07e33210-a6be-447c-92a0-4dd504e80965/userFiles-9a4b5741-a318-420e-b112-1a4441ba030a/sparkdriver-1.0-SNAPSHOT.jar to class loader\n17/11/08 15:53:57 INFO Executor: Fetching spark://10.0.1.2:63760/jars/net.jpountz.lz4_lz4-1.3.0.jar with timestamp 1510174436000\n17/11/08 15:53:57 INFO Utils: Fetching spark://10.0.1.2:63760/jars/net.jpountz.lz4_lz4-1.3.0.jar to /private/var/folders/26/lfnkdm_d6mj48xfwdyl_sntm8tdtp9/T/spark-07e33210-a6be-447c-92a0-4dd504e80965/userFiles-9a4b5741-a318-420e-b112-1a4441ba030a/fetchFileTemp2018048990610379910.tmp\n17/11/08 15:53:57 INFO Executor: Adding file:/private/var/folders/26/lfnkdm_d6mj48xfwdyl_sntm8tdtp9/T/spark-07e33210-a6be-447c-92a0-4dd504e80965/userFiles-9a4b5741-a318-420e-b112-1a4441ba030a/net.jpountz.lz4_lz4-1.3.0.jar to class loader\n17/11/08 15:53:57 INFO HadoopRDD: Input split: file:/usr/local/Cellar/apache-spark/2.2.0/libexec/logs/spark-v0001-org.apache.spark.deploy.cluster_manager.cluster-manager-1-TUSMA06RMLVT047.out:0+3424\n17/11/08 15:53:57 INFO Executor: Finished task 0.0 in stage 0.0 (TID 0). 1192 bytes result sent to driver\n17/11/08 15:53:57 INFO TaskSetManager: Finished task 0.0 in stage 0.0 (TID 0) in 571 ms on localhost (executor driver) (1/1)\n17/11/08 15:53:57 INFO TaskSchedulerImpl: Removed TaskSet 0.0, whose tasks have all completed, from pool \n17/11/08 15:53:57 INFO DAGScheduler: ShuffleMapStage 0 (flatMapToPair at WordCount.java:18) finished in 0.590 s\n17/11/08 15:53:57 INFO DAGScheduler: looking for newly runnable stages\n17/11/08 15:53:57 INFO DAGScheduler: running: Set()\n17/11/08 15:53:57 INFO DAGScheduler: waiting: Set(ResultStage 1)\n17/11/08 15:53:57 INFO DAGScheduler: failed: Set()\n17/11/08 15:53:57 INFO DAGScheduler: Submitting ResultStage 1 (MapPartitionsRDD[4] at saveAsTextFile at WordCount.java:21), which has no missing parents\n17/11/08 15:53:57 INFO MemoryStore: Block broadcast_2 stored as values in memory (estimated size 72.6 KB, free 366.0 MB)\n17/11/08 15:53:57 INFO MemoryStore: Block broadcast_2_piece0 stored as bytes in memory (estimated size 26.1 KB, free 365.9 MB)\n17/11/08 15:53:57 INFO BlockManagerInfo: Added broadcast_2_piece0 in memory on 10.0.1.2:63761 (size: 26.1 KB, free: 366.2 MB)\n17/11/08 15:53:57 INFO SparkContext: Created broadcast 2 from broadcast at DAGScheduler.scala:1006\n17/11/08 15:53:57 INFO DAGScheduler: Submitting 1 missing tasks from ResultStage 1 (MapPartitionsRDD[4] at saveAsTextFile at WordCount.java:21) (first 15 tasks are for partitions Vector(0))\n17/11/08 15:53:57 INFO TaskSchedulerImpl: Adding task set 1.0 with 1 tasks\n17/11/08 15:53:57 INFO TaskSetManager: Starting task 0.0 in stage 1.0 (TID 1, localhost, executor driver, partition 0, ANY, 4621 bytes)\n17/11/08 15:53:57 INFO Executor: Running task 0.0 in stage 1.0 (TID 1)\n17/11/08 15:53:57 INFO ShuffleBlockFetcherIterator: Getting 1 non-empty blocks out of 1 blocks\n17/11/08 15:53:57 INFO ShuffleBlockFetcherIterator: Started 0 remote fetches in 4 ms\n17/11/08 15:53:57 INFO FileOutputCommitter: File Output Committer Algorithm version is 1\n17/11/08 15:53:57 INFO FileOutputCommitter: Saved output of task 'attempt_20171108155356_0001_m_000000_1' to file:/Users/v0001/iot/thingspace/go/src/stash.verizon.com/npdthing/metrics/sparkdriver/wordcount.out/_temporary/0/task_20171108155356_0001_m_000000\n17/11/08 15:53:57 INFO SparkHadoopMapRedUtil: attempt_20171108155356_0001_m_000000_1: Committed\n17/11/08 15:53:57 INFO Executor: Finished task 0.0 in stage 1.0 (TID 1). 1224 bytes result sent to driver\n17/11/08 15:53:57 INFO TaskSetManager: Finished task 0.0 in stage 1.0 (TID 1) in 123 ms on localhost (executor driver) (1/1)\n17/11/08 15:53:57 INFO TaskSchedulerImpl: Removed TaskSet 1.0, whose tasks have all completed, from pool \n17/11/08 15:53:57 INFO DAGScheduler: ResultStage 1 (saveAsTextFile at WordCount.java:21) finished in 0.123 s\n17/11/08 15:53:57 INFO DAGScheduler: Job 0 finished: saveAsTextFile at WordCount.java:21, took 0.852166 s\n17/11/08 15:53:57 INFO SparkContext: Invoking stop() from shutdown hook\n17/11/08 15:53:57 INFO SparkUI: Stopped Spark web UI at http://10.0.1.2:4040\n17/11/08 15:53:57 INFO MapOutputTrackerClusterManagerEndpoint: MapOutputTrackerClusterManagerEndpoint stopped!\n17/11/08 15:53:57 INFO MemoryStore: MemoryStore cleared\n17/11/08 15:53:57 INFO BlockManager: BlockManager stopped\n17/11/08 15:53:57 INFO BlockManagerClusterManager: BlockManagerClusterManager stopped\n17/11/08 15:53:57 INFO OutputCommitCoordinator$OutputCommitCoordinatorEndpoint: OutputCommitCoordinator stopped!\n17/11/08 15:53:57 INFO SparkContext: Successfully stopped SparkContext\n17/11/08 15:53:57 INFO ShutdownHookManager: Deleting directory /private/var/folders/26/lfnkdm_d6mj48xfwdyl_sntm8tdtp9/T/spark-07e33210-a6be-447c-92a0-4dd504e80965\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"0","comment_count":"2","creation_date":"2017-11-08 21:12:13.357 UTC","last_activity_date":"2017-11-10 10:47:16.48 UTC","last_edit_date":"2017-11-10 10:47:16.48 UTC","last_editor_display_name":"","last_editor_user_id":"5057350","owner_display_name":"","owner_user_id":"4445793","post_type_id":"1","score":"2","tags":"java|apache-spark|apache-kafka|spark-streaming|spark-submit","view_count":"40"} {"id":"45633184","title":"InsertMany throw E11000 duplicate key error but insert successfully","body":"\u003cp\u003eI am using mongoose to insert bulk data to database.\nThe \u003ccode\u003einsertMany\u003c/code\u003e throw E11000 duplicate key error although the data is saved succeed in database.\u003c/p\u003e\n\n\u003cp\u003eHere is my codes: \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e var data = [\n {_id: '598d7ae7c3148a6d853866e8'}, \n {_id: '598d7afdc3148a6d853866f4'}\n ]\nMovies.insertMany(data, function(error, docs) {});\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThis happen infrequently.\u003c/p\u003e\n\n\u003cp\u003eAppreciated any help.\u003c/p\u003e\n\n\u003cp\u003eThanks \u003c/p\u003e","answer_count":"2","comment_count":"0","creation_date":"2017-08-11 10:38:37.427 UTC","last_activity_date":"2017-08-12 04:54:00.103 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"3827723","post_type_id":"1","score":"0","tags":"node.js|mongodb|mongoose","view_count":"72"} {"id":"15257591","title":"Binding empty values to numerical fields in Play Framework 2 (Java)","body":"\u003cp\u003eI have forms where I want to be able to leave some numerical fields empty, but I get \"Invalid value\" errors from \u003ccode\u003eForm.bindFromRequest()\u003c/code\u003e. This seems like a common requirement, but I can't find any documentation on this after hours of searching. I am still hoping I've missed something obvious, though! \u003c/p\u003e\n\n\u003cp\u003eI did some digging and found that Play uses Spring's \u003ccode\u003eDataBinder\u003c/code\u003e class to do the actual binding. That class is really sophisticated and would allow me to set custom binders for my fields, and if I was using Spring I could just add an \u003ccode\u003e@InitBinder\u003c/code\u003e method to my controller to set up the binder exactly the way I want using a \u003ccode\u003eCustomNumberEditor\u003c/code\u003e. However, it seems that Play Framework's \u003ccode\u003eForm\u003c/code\u003e object does not allow access to the DataBinder, apart from setting allowed fields. So, the binder tries to convert an empty string into a long, which gives a \u003ccode\u003eNumberFormatException\u003c/code\u003e:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eFailed to convert property value of type 'java.lang.String' to required type 'long' \nfor property 'unitPriceExVAT'; \nnested exception is java.lang.NumberFormatException: For input string: \"\"\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eSo, is there some other way of getting the binder to allow empty numerical fields?\u003c/p\u003e","accepted_answer_id":"15259097","answer_count":"1","comment_count":"0","creation_date":"2013-03-06 20:43:18.01 UTC","last_activity_date":"2013-03-06 22:09:31.53 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"239775","post_type_id":"1","score":"1","tags":"java|forms|playframework-2.0|databinder","view_count":"566"} -{"id":"36292010","title":"save a Google Chart server-side","body":"\u003cp\u003eI made a JS script that pulls data from a Postgres database and visualizes them as a bunch of beautiful Google Charts. That works fine, but it is very slow and sometimes the web page just times out. \u003c/p\u003e\n\n\u003cp\u003eTo remedy, I was thinking of creating the charts as PNG/GIF/SVG/Whatever, and use a cron job to refresh the charts at specific intervals. That would sacrifice interactivity (which is not very important in this instance) for speed. However, a google search does not provide a clear path for creating Google charts with PHP. Any suggestions? \u003c/p\u003e\n\n\u003cp\u003eHere is my JS script: \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e google.setOnLoadCallback(drawManyCharts); \n\n function drawManyCharts()\n //parameters are: timeUnit, target div, abscissa bins, MultiplicationFactor, Graphtype, SensorString\n {drawAllCharts(\"minutes\", \"GoogleChart_div\", 500, 0.01, \"Linechart\", \"Temperature\"); \n drawAllCharts(\"hours\", \"GoogleChart2_div\", 400, 0.01, \"Linechart\", \"Temperature\");\n drawAllCharts(\"days\", \"GoogleChart3_div\", 48, 0.01, \"Linechart\", \"Temperature\");\n drawAllCharts(\"weeks\", \"GoogleChart4_div\", 48, 0.01, \"Linechart\", \"Temperature\");\n drawAllCharts(\"hours\", \"GoogleChartPressure_div\", 48, 0.01, \"Linechart\", \"Pressure\");\n }\n\n function drawAllCharts(TimeUnit, containerChart, NoAbscissaBins, MultiplicationFactor, Graphtype, SensorString)\n {\n\n // var SensorString=\"Temperature\"; \n var TableType=\"integer\";\n // var NoAbscissaBins=12;\n var DataTableName=\"dataMasterTable\";\n // var TimeUnit=\"days\";\n var TimeStart=\"test\";\n // var Graphtype=\"Linechart\";\n var graphtitle = \"Heizungskeller\";\n var OrdinateLabel = \"Temperature (Celsius 100x)\" \n var maxViewWindow= 8000;\n var minViewWindow= 0;\n\n var GoogleArray = $.ajax({ \n url: \"/php/PrepareGoogleDataTable.php\" +\"?\"+\n \"SensorString=\"+SensorString + \"\u0026amp;\"+\n \"TableType=\" + TableType +\"\u0026amp;\"+\n \"NoAbscissaBins=\" + NoAbscissaBins + \"\u0026amp;\"+\n \"MultiplicationFactor=\" + MultiplicationFactor + \"\u0026amp;\"+\n \"DataTableName=\" + DataTableName +\"\u0026amp;\"+\n \"TimeUnit=\" + TimeUnit +\"\u0026amp;\"+\n \"TimeStart=\" + TimeStart, \n //dataType:\"json\", \n async: false \n }).responseText;\n console.log(GoogleArray);\n GoogleArray = JSON.parse(GoogleArray); \n eval(GoogleArray.GoogleAddColumns);\n eval(GoogleArray.GoogleAddRows);\n\n\n\n //create dynamic dataview for charts\n //columns as specified by TableType\n switch (TableType)\n {\n case \"boolean\":\n eval(GoogleArray.GoogleVisualizeColumnCount) ;\n break;\n\n case \"integer\" :\n eval(GoogleArray.GoogleVisualizeColumnsMinStdevStdevMax) ;\n eval(GoogleArray.GoogleVisualizeColumnsAvg) ;\n break;\n\n case \"float\" :\n eval(GoogleArray.GoogleVisualizeColumnsMinStdevStdevMax) ;\n eval(GoogleArray.GoogleVisualizeColumnsAvg) ;\n break;\n\n case \"string\" :\n break;\n\n\n }\n\n switch (Graphtype)\n {\n case \"Candlestick\":\n var optionsCandlestick = {\n width: '100%', \n height: 480,\n bar:{groupWidth: '90%'},\n vAxis: {minValue: 0,\n baseline: 0,\n textStyle: {color: 'blue',\n fontSize: 10},\n viewWindowMode: 'explicit',\n viewWindow: {max: maxViewWindow,\n min: minViewWindow\n }\n },\n hAxis: {textStyle: \n {color: 'blue',\n fontSize: 10},\n },\n pointSize: 5,\n title: graphtitle\n };\n\n var wrapper = new google.visualization.ChartWrapper(\n {chartType: 'CandlestickChart',\n dataTable: dataViewMinStdevStdevMax,\n options: optionsCandlestick,\n containerId: containerChart});\n wrapper.draw();\n\n break;\n\n case \"StackedColumn\":\n\n var optionsColumnchart = {\n chartArea: {width: '80%', height: '70%'},\n //legend: {position: 'in'},\n //titlePosition: 'in', \n axisTitlesPosition: 'in',\n hAxis: {textPosition: 'in'}, \n vAxis: {textPosition: 'in'},\n width: '100%', \n height: 520, \n isStacked: true, \n pointSize: 3,\n fontSize: 10,\n backgroundColor: 'transparent', \n bar:{groupWidth: '90%'},\n hAxis:{slantedTextAngle: 90},\n legend:{position: 'in', textStyle: {color: 'blue', fontSize: 12}},\n title: graphtitle\n }; \n var wrapper = new google.visualization.ChartWrapper(\n {chartType: 'ColumnChart',\n dataTable: dataViewCount,\n options: optionsColumnchart,\n containerId: containerChart});\n wrapper.draw();\n break;\n\n case \"Linechart\":\n //these are the customizable options from google\n var optionsLinechart = {\n chartArea: {width: '80%', height: '70%'},\n //legend: {position: 'in'},\n width: 1000, \n height: 480, \n pointSize: 0,\n title: graphtitle,\n vAxis: {title: OrdinateLabel}\n };\n\n var wrapper = new google.visualization.ChartWrapper(\n {chartType: 'LineChart',\n dataTable: dataViewAvg,\n options: optionsLinechart,\n containerId: containerChart});\n wrapper.draw();\n break;\n\n }\n\n } \n \u0026lt;/script\u0026gt; \n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eand here is the PHP script that takes Postgres data and converts them into a Google Chart-digestible format: \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e \u0026lt;?php\n if(isset($_GET['SensorString']) \u0026amp;\u0026amp; \n (!empty($_GET['SensorString'])) \u0026amp;\u0026amp; \n (!empty($_GET['TableType'])) \u0026amp;\u0026amp; \n (!empty($_GET['TimeUnit'])) \u0026amp;\u0026amp; \n (!empty($_GET['NoAbscissaBins'])) \u0026amp;\u0026amp; \n (!empty($_GET['DataTableName'])) \u0026amp;\u0026amp; \n (!empty($_GET['MultiplicationFactor'])) \u0026amp;\u0026amp; \n (!empty($_GET['TimeStart'])))\n\n {$SensorString = str_replace ( \"*\", \"%\", $_GET['SensorString']); // string to fill \"WHERE\" condition\n $TableType = $_GET['TableType']; // boolean/integer/float/string\n $TimeUnit = $_GET['TimeUnit']; //hours/days/weeks/months/years\n $NoAbscissaBins = $_GET['NoAbscissaBins']; //number of time units to be displayed on the abscissa\n $DataTableName = $_GET['DataTableName']; //number of time units to be displayed on the abscissa\n $TimeStart = $_GET['TimeStart']; //should not necessarily be used\n\n }\n else \n {// assume Bewegungsmelder, boolean, hours, 12 bins\n $SensorString = \"OutsideTemp\";\n $TableType = \"float\";\n $TimeUnit = \"days\";\n $TimeStart = -12; \n $NoAbscissaBins = 30;\n $DataTableName = \"dataMasterTable\";\n }\n\n $RedirectEchoToFile = false;\n\n\n\n $DataCollectionArray = DataCollectionCrossTab($SensorString, $TableType, $TimeUnit, $NoAbscissaBins, $TimeStart, $DataTableName);\n //echo \"GoogleDataRow: \". $DataCollectionArray['GoogleDataRow'] ;\n $GoogleArray = PrepareGoogleChart($DataCollectionArray);\n\n\n /* $GoogleArray has the following keys:\n / [0] =\u0026gt; GoogleAddColumns \n / [1] =\u0026gt; GoogleAddRows \n / [2] =\u0026gt; GoogleVisualizeColumnCount \n / [3] =\u0026gt; GoogleVisualizeColumnsAvg \n / [4] =\u0026gt; GoogleVisualizeColumnsMinStdevStdevMax \n / [5] =\u0026gt; MainCrosstabSelectQuery \n */\n\n\n echo json_encode($GoogleArray);\n\n\n\n //---------------------------------------------------\n\n Function PrepareGoogleChart($DataCollectionArray)\n {\n // var GoogleAddColumns adds columns to DataTable\n\n $TimeUnit = \"hours\"; // (can be \"hours\", \"days\", \"months\", \"years\" )\n $GoogleAddColumns = \"\"; \n\n // var GoogleVisualizeColumnsAll renders DataView1 view of DataTable\n // var VisualizeFirstColumn sets the first column, and renders \"hours\" (can be changed to days etc.)\n $VisualizeFirstColumn = \".setColumns([\n {calc: function(data, row) \n {return data.getFormattedValue(row, \" \n . ColumnLabel($TimeUnit). \"); }, \n type:'string'}\";\n\n //set up dataView1, which is essentially useless\n $GoogleVisualizeColumnsAll = \n \"var dataView1 = new google.visualization.DataView(\".$DataCollectionArray['DataTableName'].\");\".chr(13)\n .\"dataView1\".$VisualizeFirstColumn;\n\n //set up dataViewCount, which is good to count events from IpsLoggingBoolean and feed a column chart\n $GoogleVisualizeColumnCount = \n \"var dataViewCount = new google.visualization.DataView(\".$DataCollectionArray['DataTableName'].\");\"\n .chr(13).\"dataViewCount\".$VisualizeFirstColumn;\n\n //set up dataViewAvg, which visualizes only the averages and is good for line charts\n $GoogleVisualizeAvg = \n \"var dataViewAvg = \n new google.visualization.DataView(\".$DataCollectionArray['DataTableName'].\");\".chr(13).\n \"dataViewAvg\"\n .\".setColumns([ {calc: function(data, row) \n {return data.getFormattedValue(row, \" \n . ColumnLabel($TimeUnit). \"); }, \n type:'string'}\";\n\n //set up dataViewMinStdevStdevMax, which can feed a candlestick chart \n $GoogleVisualizeColumnsMinStdevStdevMax = \n \"var dataViewMinStdevStdevMax = \n new google.visualization.DataView(\".$DataCollectionArray['DataTableName'].\");\".chr(13)\n .\"dataViewMinStdevStdevMax\"\n .\".setColumns([ {calc: function(data, row) \n {return data.getFormattedValue(row, \" \n . ColumnLabel($TimeUnit). \"); }, \n type:'string'}\";\n\n $GoogleVisualizeScattergram = \n \"var dataViewScattergram = new google.visualization.DataView(\".$DataCollectionArray['DataTableName'].\");\"\n .chr(13).\"dataViewScattergram.setColumns([\";\n\n\n //create strings for Google DataTable/DataView1 columns definition\n $GoogleAddColumns = \n \"var \". $DataCollectionArray['DataTableName']. \"= new google.visualization.DataTable();\".chr(13). \n $DataCollectionArray['DataTableName'].\".addColumn('string', 'hoursIndex');\".chr(13).\n $DataCollectionArray['DataTableName'].\".addColumn('string', 'hours');\".chr(13).\n $DataCollectionArray['DataTableName'].\".addColumn('string', 'PlaceHolder1');\".chr(13).\n $DataCollectionArray['DataTableName'].\".addColumn('string', 'PlaceHolder2');\".chr(13).\n $DataCollectionArray['DataTableName'].\".addColumn('string', 'PlaceHolder3'); \";\n\n for ($varIndex=0; $varIndex \u0026lt; ($DataCollectionArray['NumberOfColumns']-5); $varIndex++)\n {\n\n Switch ($DataCollectionArray['TableType'])\n {\n case \"boolean\":\n $GoogleAddColumns .= \n $DataCollectionArray['DataTableName'].\".addColumn('number', \".$DataCollectionArray['CategoryArray'][$varIndex]. \", 'count$varIndex'); \";\n break;\n\n case \"integer\":\n $GoogleAddColumns .= \n $DataCollectionArray['DataTableName'].\".addColumn('number', \".$DataCollectionArray['CategoryArray'][$varIndex]. \" +'avg'); \".chr(13).\n $DataCollectionArray['DataTableName'].\".addColumn('number', \".$DataCollectionArray['CategoryArray'][$varIndex]. \" +'stddev+'); \".chr(13).\n $DataCollectionArray['DataTableName'].\".addColumn('number', \".$DataCollectionArray['CategoryArray'][$varIndex]. \" +'stddev-'); \". chr(13).\n $DataCollectionArray['DataTableName'].\".addColumn('number', \".$DataCollectionArray['CategoryArray'][$varIndex]. \" +'max'); \" .chr(13).\n $DataCollectionArray['DataTableName'].\".addColumn('number', \".$DataCollectionArray['CategoryArray'][$varIndex]. \" +'min'); \" .chr(13);\n break;\n\n case \"float\":\n $GoogleAddColumns .= \n $DataCollectionArray['DataTableName'].\".addColumn('number', \".$DataCollectionArray['CategoryArray'][$varIndex]. \" +'avg'); \".chr(13).\n $DataCollectionArray['DataTableName'].\".addColumn('number', \".$DataCollectionArray['CategoryArray'][$varIndex]. \" +'stddev+'); \".chr(13).\n $DataCollectionArray['DataTableName'].\".addColumn('number', \".$DataCollectionArray['CategoryArray'][$varIndex]. \" +'stddev-'); \". chr(13).\n $DataCollectionArray['DataTableName'].\".addColumn('number', \".$DataCollectionArray['CategoryArray'][$varIndex]. \" +'max'); \" .chr(13).\n $DataCollectionArray['DataTableName'].\".addColumn('number', \".$DataCollectionArray['CategoryArray'][$varIndex]. \" +'min'); \" .chr(13);\n break;\n\n case \"string\":\n //no visualization in case of strings, but a \"tableChart\" could be generated if need be.\n break;\n }\n\n $GoogleVisualizeColumnsAll .= \n \", \". strval(($varIndex+1)*4+1).\", \". \n strval(($varIndex+1)*4+2).\", \". \n strval(($varIndex+1)*4+3).\", \". \n strval(($varIndex+1)*4+4); \n\n $GoogleVisualizeColumnCount .= \n \", \". strval(($varIndex+1)+4); \n\n $GoogleVisualizeAvg .= \n \", \". strval(($varIndex+1)*5+0); \n\n $GoogleVisualizeColumnsMinStdevStdevMax .= \n \", \". strval(($varIndex+1)*5+1).\n \", \". strval(($varIndex+1)*5+2).\n \", \". strval(($varIndex+1)*5+3).\n \", \". strval(($varIndex+1)*5+4); \n\n $GoogleVisualizeScattergram .= strval(($varIndex+1)*4+2).\", \";\n }\n\n //echo \"Tabletype: \". $DataCollectionArray['TableType'].chr(13).\"\u0026lt;br\u0026gt;\".\"\u0026lt;br\u0026gt;\";\n //echo \"GoogleAddColumns: \". $GoogleAddColumns.chr(13).\"\u0026lt;br\u0026gt;\".\"\u0026lt;br\u0026gt;\";\n\n $GoogleVisualizeColumnsAll .= \"]);\".chr(13);\n $GoogleVisualizeColumnCount .= \"]);\".chr(13);\n $GoogleVisualizeAvg .= \"]);\".chr(13);\n $GoogleVisualizeColumnsMinStdevStdevMax.= \"]);\".chr(13);\n $GoogleVisualizeScattergram = substr($GoogleVisualizeScattergram, 0, -2) . \"]);\".chr(13);\n\n VerboseEcho($GoogleAddColumns. \"\u0026lt;br\u0026gt;\u0026lt;br\u0026gt;\u0026lt;br\u0026gt;\".$GoogleVisualizeColumnsAll);\n\n\n //create dataset rows to be processed into google datatable\n $DataForGoogleChart = $DataCollectionArray['GoogleDataRow'];\n\n\n\n //echo \"\u0026lt;br\u0026gt;\u0026lt;font color='green'\u0026gt;DataForGoogleChart: $DataForGoogleChart\u0026lt;/font\u0026gt;\u0026lt;br\u0026gt;\";\n\n\n $GoogleFormattedDataArray = array(\n 'GoogleAddColumns' =\u0026gt; $GoogleAddColumns,\n 'GoogleAddRows' =\u0026gt; $DataCollectionArray['DataTableName'].'.addRows('.$DataCollectionArray['GoogleDataRow'].'); '.chr(13),\n 'GoogleVisualizeColumnCount' =\u0026gt; $GoogleVisualizeColumnCount,\n 'GoogleVisualizeColumnsAvg' =\u0026gt; $GoogleVisualizeAvg,\n 'GoogleVisualizeColumnsMinStdevStdevMax' =\u0026gt; $GoogleVisualizeColumnsMinStdevStdevMax,\n 'MainCrosstabSelectQuery' =\u0026gt; $DataCollectionArray['MainCrosstabSelectQuery'] \n );\n\n return $GoogleFormattedDataArray;\n }\n\n\n\n\n //-----------------------------------------------------\n\n Function DataCollectionCrossTab($SensorString, $TableType, $TimeUnit, $NoAbscissaBins, $TimeStart, $DataTableName) //sensorstring: e.g. DigitalInput 2\n {\n $dbconn = pg_connect(\"host=10.10.10.8 port=5432 dbname=IpsLogging user=*** password=***\") \n or die ('connection aborted: ' . pg_last_error().chr(13));\n\n switch ($TableType)\n {\n case \"boolean\":\n $IpsTable = \"loggingdb_ips_boolean\";\n $AggregateFunctions = \"COUNT(*) As value \";\n $SensorColumn = 2;\n $WhereClause=\" AND (log.ipsvalue = true) \"; //only movement triggers\n break;\n case \"integer\":\n $IpsTable = \"loggingdb_ips_integer\";\n $AggregateFunctions = \"(AVG(ipsvalue)::NUMERIC(8,2)) \n ||'', '' || \n (MIN(ipsvalue)::NUMERIC(8,2)) \n ||'', '' || \n ((AVG(ipsvalue)::NUMERIC(8,2)) - (coalesce(STDDEV(ipsvalue), 0)::NUMERIC(8,2))) \n ||'', '' || \n ((AVG(ipsvalue)::NUMERIC(8,2)) + (coalesce(STDDEV(ipsvalue), 0)::NUMERIC(8,2))) \n ||'', '' || \n (MAX(ipsvalue)::NUMERIC(8,2)) \n As value \";\n $WhereClause=\"\";\n $SensorColumn = 4;\n break;\n case \"float\":\n $IpsTable = \"loggingdb_ips_float\";\n $AggregateFunctions = \"(AVG(ipsvalue)::NUMERIC(8,2)) \n ||'', '' || \n (MIN(ipsvalue)::NUMERIC(8,2)) \n ||'', '' || \n ((AVG(ipsvalue)::NUMERIC(8,2)) - (coalesce(STDDEV(ipsvalue), 0)::NUMERIC(8,2))) \n ||'', '' || \n ((AVG(ipsvalue)::NUMERIC(8,2)) + (coalesce(STDDEV(ipsvalue), 0)::NUMERIC(8,2))) \n ||'', '' || \n (MAX(ipsvalue)::NUMERIC(8,2)) \n As value \";\n $SensorColumn = 4;\n $WhereClause=\"\";\n break;\n case \"string\":\n $IpsTable = \"loggingdb_ips_string\";\n $WhereClause=\"\";\n break;\n }\n\n Switch ($TimeUnit)\n {case \"minutes\":\n $SelectRowNames = \n \"to_char(ipstimestamp, ''YYYYMMDDHH24MI'') As row_name, \n to_char(ipstimestamp, ''FMHH24h:MI'') As labelled_row_name, \n ''PlaceHolder1'' As PlaceHolder1,\n ''PlaceHolder2'' As PlaceHolder2,\n ''PlaceHolder3'' As PlaceHolder3,\";\n $GroupOrder = \" \n GROUP BY row_name, labelled_row_name, PlaceHolder1, PlaceHolder2, PlaceHolder3, objectid, category \n ORDER BY row_name, labelled_row_name, PlaceHolder1, PlaceHolder2, PlaceHolder3, objectid, category', \";\n break;\n\n case \"hours\":\n $SelectRowNames = \n \"to_char(ipstimestamp, ''YYYYMMDDHH24'') As row_name, \n to_char(ipstimestamp, ''FMDD mon FMHH24h'') As labelled_row_name, \n ''PlaceHolder1'' As PlaceHolder1,\n ''PlaceHolder2'' As PlaceHolder2,\n ''PlaceHolder3'' As PlaceHolder3,\";\n $GroupOrder = \" \n GROUP BY row_name, labelled_row_name, PlaceHolder1, PlaceHolder2, PlaceHolder3, objectid, category \n ORDER BY row_name, labelled_row_name, PlaceHolder1, PlaceHolder2, PlaceHolder3, objectid, category', \";\n break;\n\n case \"days\":\n $SelectRowNames = \n \"to_char(ipstimestamp, ''YYYYMMDD'') As row_name, \n to_char(ipstimestamp, ''FMDD mon YYYY'') As labelled_row_name, \n ''PlaceHolder1'' As PlaceHolder1,\n ''PlaceHolder2'' As PlaceHolder2,\n ''PlaceHolder3'' As PlaceHolder3,\";\n $GroupOrder = \" \n GROUP BY row_name, labelled_row_name, PlaceHolder1, PlaceHolder2, PlaceHolder3, objectid, category \n ORDER BY row_name, labelled_row_name, PlaceHolder1, PlaceHolder2, PlaceHolder3, objectid, category', \"; \n break;\n\n case \"weeks\":\n $SelectRowNames = \n \"to_char(ipstimestamp, ''YYYYWW'') As row_name, \n ''wk'' || to_char(ipstimestamp, ''FMWW YYYY'') As labelled_row_name, \n ''PlaceHolder1'' As PlaceHolder1,\n ''PlaceHolder2'' As PlaceHolder2,\n ''PlaceHolder3'' As PlaceHolder3,\";\n $GroupOrder = \" \n GROUP BY row_name, labelled_row_name, PlaceHolder1, PlaceHolder2, PlaceHolder3, objectid, category \n ORDER BY row_name, labelled_row_name, PlaceHolder1, PlaceHolder2, PlaceHolder3, objectid, category', \"; \n break;\n\n case \"months\":\n $SelectRowNames = \n \"to_char(ipstimestamp, ''YYYYMM'') As row_name, \n to_char(ipstimestamp, ''mon YYYY'') As labelled_row_name, \n ''PlaceHolder1'' As PlaceHolder1,\n ''PlaceHolder2'' As PlaceHolder2,\n ''PlaceHolder3'' As PlaceHolder3,\";\n $GroupOrder = \" \n GROUP BY row_name, labelled_row_name, PlaceHolder1, PlaceHolder2, PlaceHolder3, objectid, category \n ORDER BY row_name, labelled_row_name, PlaceHolder1, PlaceHolder2, PlaceHolder3, objectid, category', \"; \n break;\n\n case \"years\":\n $SelectRowNames = \n \"to_char(ipstimestamp, ''YYYY'') As row_name, \n to_char(ipstimestamp, ''YYYY'') As labelled_row_name, \n ''PlaceHolder1'' As PlaceHolder1,\n ''PlaceHolder2'' As PlaceHolder2,\n ''PlaceHolder3'' As PlaceHolder3,\";\n $GroupOrder = \" \n GROUP BY row_name, labelled_row_name, PlaceHolder1, PlaceHolder2, PlaceHolder3, objectid, category \n ORDER BY row_name, labelled_row_name, PlaceHolder1, PlaceHolder2, PlaceHolder3, objectid, category', \"; \n break;\n } \n\n\n\n // echo \"type \".$IpsTable.\" \u0026lt;br\u0026gt;\";\n $SensorResult = GetSensorNames($SensorString, $TableType, \"\", \"\",0, 1);\n // echo \"SensorResult: \".$SensorResult.chr(13);\n $CategoryString = implode(\", \", pg_fetch_all_columns($SensorResult,$SensorColumn));\n $CategoryArray = pg_fetch_all_columns(GetSensorNames($SensorString, $TableType, \"\", \"\",0, 0),5); //array containing the name of each sensor\n\n // echo \"\u0026lt;strong\u0026gt;CategoryString: \u0026lt;/strong\u0026gt;\". $CategoryString.chr(13).\"\u0026lt;br\u0026gt;\u0026lt;br\u0026gt;\u0026lt;br\u0026gt;\u0026lt;br\u0026gt;\";\n //Print_r ($CategoryArray);\n\n\n //primary query (non-crosstabbed yet)\n $PrimaryQuery =\"'SELECT \". $SelectRowNames. \n \"varid As category, \" \n .$AggregateFunctions\n .\" FROM $IpsTable As log \n JOIN ipsobjects_with_parent ips \n ON log.varid = ips.objectid\n WHERE (ips.objectname LIKE ''\".$SensorString.\"'') \"\n . $WhereClause . \" \n AND (ipstimestamp \u0026gt; (now()- ''\". $NoAbscissaBins . \" \" . $TimeUnit. \"''::interval)) \". $GroupOrder ;\n\n // echo \"\u0026lt;strong\u0026gt;PrimaryQuery: $PrimaryQuery\u0026lt;/strong\u0026gt;\";\n\n //main crosstab query which pulls all the content data:\n $MainCrosstabSelectQuery = \n \"SELECT * FROM crosstab\n (\" .$PrimaryQuery .\n \"'SELECT DISTINCT varid \n FROM $IpsTable As log \n JOIN ipsobjects_with_parent ips \n ON log.varid = ips.objectid\n WHERE (ips.objectname LIKE ''\".$SensorString.\"'')\n ORDER BY 1;' \n )\n\n As CountsPerHour(row_name text, \n label_row_name text, \n PlaceHolder1 text, \n PlaceHolder2 text, \n PlaceHolder3 text, \" \n .$CategoryString.\")\";\n\n //echo \"\u0026lt;br\u0026gt;\u0026lt;font color='red'\u0026gt;$MainCrosstabSelectQuery\u0026lt;/font\u0026gt;\u0026lt;br\u0026gt;\";\n\n $QueryResult=pg_query ($dbconn, $MainCrosstabSelectQuery);\n $CrosstabArray = pg_fetch_all($QueryResult);\n //echo \"CrosstabArray: \" . $CrosstabArray ;\n //$table = good_query_table($CrosstabArray, $QueryResult, 0);\n //BetterTable($QueryResult); //this functions outputs a nicely formatted crosstab!\n\n if (!$QueryResult) \n echo \"PG Error: \". pg_last_error().chr(13);\n\n // create bracketed Array of Arrays GoogleDataRow\n $GoogleDataRow =\"[\"; //opening bracket inserted\n while ($field = pg_fetch_row($QueryResult)) \n {\n\n $GoogleDataRow .=\"[\"; \n $index =0;\n\n switch ($TableType)\n {\n case \"boolean\":\n foreach ($field as $col_value) {\n $index++;\n if ($index\u0026lt;6)\n //the first five columns are strings (date headers)\n {$GoogleDataRow .= \"'\".$col_value.\"', \";} \n else{\n //anythign above 5 is data\n //substitute NULL with zeroes, else GoogleChart doesnt work\n if($col_value == NULL) $col_value = \"null\"; \n $GoogleDataRow .= $col_value.\", \";\n }\n }\n break;\n\n case \"integer\":\n foreach ($field as $col_value) {\n ++$index;\n if ($index\u0026lt;6)\n {//the first give columns are strings (date headers)\n $GoogleDataRow .= \"'\".$col_value.\"', \";} \n else{\n //anythign above 5 is data\n //substitute NULL with 5x zeroes, else GoogleChart doesnt work\n if($col_value == NULL) $col_value = \"null,null,null,null,null\"; \n $GoogleDataRow .= $col_value.\", \";\n }\n }\n break;\n\n case \"float\":\n foreach ($field as $col_value) {\n ++$index;\n if ($index\u0026lt;6)\n {//the first give columns are strings (date headers)\n $GoogleDataRow .= \"'\".$col_value.\"', \";} \n else{\n //anythign above 5 is data\n //substitute NULL with 5x zeroes, else GoogleChart doesnt work\n if($col_value == NULL) $col_value = \"null,null,null,null,null\"; \n $GoogleDataRow .= $col_value.\", \";\n }\n }\n break;\n\n case \"string\":\n foreach ($field as $col_value) {\n ++$index;\n if ($index\u0026lt;5)\n //the first give columns are strings (date headers)\n {$GoogleDataRow .= \"'\".$col_value.\"', \";} \n else{\n //anythign above 5 is data\n //substitute NULL with zeroes, else GoogleChart doesnt work\n if($col_value == NULL) $col_value = 0; \n $GoogleDataRow .= $col_value.\" \";\n }\n }\n break;\n }\n\n $GoogleDataRow = substr($GoogleDataRow,0,-5).\"], \";\n\n //echo \"\u0026lt;br\u0026gt;\u0026lt;font color='blue'\u0026gt;$GoogleDataRow \u0026lt;/font\u0026gt;\u0026lt;br\u0026gt;\"; \n }\n\n\n $GoogleDataRow = substr($GoogleDataRow,0,-2).\"]\";\n\n $DataCollectionArray = array(\n \"GoogleDataRow\"=\u0026gt;$GoogleDataRow,\n \"NumberOfColumns\"=\u0026gt;pg_num_fields($QueryResult), // total number of columns, including all row headers\n \"CategoryArray\"=\u0026gt;$CategoryArray,\n \"TableType\"=\u0026gt;$TableType,\n \"DataTableName\" =\u0026gt; $DataTableName, \n \"MainCrosstabSelectQuery\" =\u0026gt; $MainCrosstabSelectQuery \n );\n return $DataCollectionArray;\n }\n\n\n\n //---------------------------------------\n\n function BetterTable($result)\n {\n $i = 0;\n echo \"\u0026lt;html\u0026gt;\n \u0026lt;body\u0026gt;\n \u0026lt;table\u0026gt;\n \u0026lt;table class='BetterTable' border='1'\u0026gt;\";\n\n echo \"\u0026lt;tr\u0026gt;\";\n echo '\u0026lt;td\u0026gt;Line #\n \u0026lt;/td\u0026gt;';\n while ($i \u0026lt; pg_num_fields($result))\n {\n $fieldName = pg_field_name($result, $i);\n echo '\u0026lt;td\u0026gt;' . $fieldName . '\u0026lt;/td\u0026gt;';\n $i = $i + 1;\n }\n echo '\u0026lt;/tr\u0026gt;';\n $i = 0;\n\n while ($field = pg_fetch_row($result)) \n {\n if ($i%2 == 0) \n Echo \"\u0026lt;tr bgcolor=\\\"#d0d0d0\\\" \u0026gt;\";\n else \n Echo \"\u0026lt;tr bgcolor=\\\"#eeeeee\\\"\u0026gt;\";\n $fields = count($field);\n $y = 0;\n echo '\u0026lt;td\u0026gt;'.$i. '\u0026lt;/td\u0026gt;';\n while ($y \u0026lt; $fields)\n {\n $c_row = current($field);\n echo '\u0026lt;td\u0026gt;'.$c_row . '\u0026lt;/td\u0026gt;';\n next($field);\n $y = $y + 1;\n }\n echo '\u0026lt;/tr\u0026gt;';\n $i = $i + 1;\n }\n\n\n echo '\u0026lt;/table\u0026gt;\u0026lt;br\u0026gt;\u0026lt;br\u0026gt;\u0026lt;/body\u0026gt;\u0026lt;/html\u0026gt;';\n\n }\n\n //----------------------------------------------------\n\n Function GetSensorNames($SensorType, $TableType, $prefix, $postfix, $QueryType, $column)\n {//TableType specifies the type of variable, and redirectes to the correct table.\n //prefix and postfix are adapters returned for each row\n //\n //retrieve full names of DataCollection variables, including parent names\n //QueryColumns specifies which query columns (see below)\n\n $dbconn = pg_connect(\"host=10.10.10.8 port=5432 dbname=IpsLogging user=*** password=***\") \n or die ('connection aborted: ' . pg_last_error().chr(13));\n\n\n switch ($TableType)\n {\n case \"boolean\":\n $IpsTable = \"loggingdb_ips_boolean\";\n break;\n case \"integer\":\n $IpsTable = \"loggingdb_ips_integer\";\n break;\n case \"float\":\n $IpsTable = \"loggingdb_ips_float\";\n break;\n case \"string\":\n $IpsTable = \"loggingdb_ips_string\";\n break;\n }\n // echo \"type \".$IpsTable.\" \u0026lt;br\u0026gt;\";\n\n\n if ($prefix!=\"\") $prefix = $prefix.\" || \";\n if ($postfix!=\"\")$postfix = \" || \". $postfix;\n\n $GetSensorNamesString = \n \"SELECT \n DISTINCT '\\\"' || varid ||'\\\"' || ' integer ' as integername,\n varid as NakedVariable, \n '\\\"' || ips.parentname || ' - ' || ips.objectname || ' (' || ips.objectid || ')\\\"' || ' integer ' AS fullname,\n '\\\"' || ips.parentname || ' - ' || ips.objectname || ' (' || ips.objectid || ')\\\"' || ' numeric(8,2) ' AS fullnamenumeric,\n '\\\"' || ips.parentname || ' - ' || ips.objectname || ' (' || ips.objectid || ')\\\"' || ' text ' AS fullnamestring,\n '\\\"' || ips.parentname || ' - ' || ips.objectname || ' (' || ips.objectid || ')\\\"' AS fullnamestring,\n ips.parentname || ' - ' || ips.objectname || ' (' || ips.objectid || ')' || ' text ' AS fullnamestringwithoutquotes,\n $prefix varid $postfix as DecoratedVariable\n\n FROM $IpsTable As log \n JOIN ipsobjects_with_parent ips \n ON log.varid = ips.objectid\n WHERE (ips.objectname LIKE '$SensorType')\n ORDER BY 1;\n \";\n //echo \"\u0026lt;strong\u0026gt;$GetSensorNamesString\u0026lt;/strong\u0026gt;\"; \n\n $QueryResult=pg_query ($dbconn, $GetSensorNamesString);\n if (!$QueryResult) \n echo \"PG Error: \". pg_last_error().chr(13);\n else\n {return $QueryResult;}\n }\n //-----------------------------\n Function ColumnLabel($TimeUnit)\n {\n switch ($TimeUnit)\n {\n case \"minutes\": $ColumnLabel= \"0\"; break;\n case \"hours\": $ColumnLabel= \"1\"; break;\n case \"days\": $ColumnLabel= \"2\"; break;\n case \"months\": $ColumnLabel= \"3\"; break;\n case \"years\": $ColumnLabel= \"4\"; break;}\n return($ColumnLabel);\n }\n //--------------------------------------------\n function VerboseEcho($Anything)\n {global $Verbose;\n if ($Verbose == true) Echo $Anything;}\n ?\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"1","comment_count":"0","creation_date":"2016-03-29 18:13:17.953 UTC","last_activity_date":"2016-03-29 18:40:05.923 UTC","last_edit_date":"2016-03-29 18:40:05.923 UTC","last_editor_display_name":"","last_editor_user_id":"1320581","owner_display_name":"","owner_user_id":"1320581","post_type_id":"1","score":"2","tags":"javascript|php|postgresql|charts|google-visualization","view_count":"87"} +{"id":"36292010","title":"save a Google Chart server-side","body":"\u003cp\u003eI made a JS script that pulls data from a Postgres database and visualizes them as a bunch of beautiful Google Charts. That works fine, but it is very slow and sometimes the web page just times out. \u003c/p\u003e\n\n\u003cp\u003eTo remedy, I was thinking of creating the charts as PNG/GIF/SVG/Whatever, and use a cron job to refresh the charts at specific intervals. That would sacrifice interactivity (which is not very important in this instance) for speed. However, a google search does not provide a clear path for creating Google charts with PHP. Any suggestions? \u003c/p\u003e\n\n\u003cp\u003eHere is my JS script: \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e google.setOnLoadCallback(drawManyCharts); \n\n function drawManyCharts()\n //parameters are: timeUnit, target div, abscissa bins, MultiplicationFactor, Graphtype, SensorString\n {drawAllCharts(\"minutes\", \"GoogleChart_div\", 500, 0.01, \"Linechart\", \"Temperature\"); \n drawAllCharts(\"hours\", \"GoogleChart2_div\", 400, 0.01, \"Linechart\", \"Temperature\");\n drawAllCharts(\"days\", \"GoogleChart3_div\", 48, 0.01, \"Linechart\", \"Temperature\");\n drawAllCharts(\"weeks\", \"GoogleChart4_div\", 48, 0.01, \"Linechart\", \"Temperature\");\n drawAllCharts(\"hours\", \"GoogleChartPressure_div\", 48, 0.01, \"Linechart\", \"Pressure\");\n }\n\n function drawAllCharts(TimeUnit, containerChart, NoAbscissaBins, MultiplicationFactor, Graphtype, SensorString)\n {\n\n // var SensorString=\"Temperature\"; \n var TableType=\"integer\";\n // var NoAbscissaBins=12;\n var DataTableName=\"dataClusterManagerTable\";\n // var TimeUnit=\"days\";\n var TimeStart=\"test\";\n // var Graphtype=\"Linechart\";\n var graphtitle = \"Heizungskeller\";\n var OrdinateLabel = \"Temperature (Celsius 100x)\" \n var maxViewWindow= 8000;\n var minViewWindow= 0;\n\n var GoogleArray = $.ajax({ \n url: \"/php/PrepareGoogleDataTable.php\" +\"?\"+\n \"SensorString=\"+SensorString + \"\u0026amp;\"+\n \"TableType=\" + TableType +\"\u0026amp;\"+\n \"NoAbscissaBins=\" + NoAbscissaBins + \"\u0026amp;\"+\n \"MultiplicationFactor=\" + MultiplicationFactor + \"\u0026amp;\"+\n \"DataTableName=\" + DataTableName +\"\u0026amp;\"+\n \"TimeUnit=\" + TimeUnit +\"\u0026amp;\"+\n \"TimeStart=\" + TimeStart, \n //dataType:\"json\", \n async: false \n }).responseText;\n console.log(GoogleArray);\n GoogleArray = JSON.parse(GoogleArray); \n eval(GoogleArray.GoogleAddColumns);\n eval(GoogleArray.GoogleAddRows);\n\n\n\n //create dynamic dataview for charts\n //columns as specified by TableType\n switch (TableType)\n {\n case \"boolean\":\n eval(GoogleArray.GoogleVisualizeColumnCount) ;\n break;\n\n case \"integer\" :\n eval(GoogleArray.GoogleVisualizeColumnsMinStdevStdevMax) ;\n eval(GoogleArray.GoogleVisualizeColumnsAvg) ;\n break;\n\n case \"float\" :\n eval(GoogleArray.GoogleVisualizeColumnsMinStdevStdevMax) ;\n eval(GoogleArray.GoogleVisualizeColumnsAvg) ;\n break;\n\n case \"string\" :\n break;\n\n\n }\n\n switch (Graphtype)\n {\n case \"Candlestick\":\n var optionsCandlestick = {\n width: '100%', \n height: 480,\n bar:{groupWidth: '90%'},\n vAxis: {minValue: 0,\n baseline: 0,\n textStyle: {color: 'blue',\n fontSize: 10},\n viewWindowMode: 'explicit',\n viewWindow: {max: maxViewWindow,\n min: minViewWindow\n }\n },\n hAxis: {textStyle: \n {color: 'blue',\n fontSize: 10},\n },\n pointSize: 5,\n title: graphtitle\n };\n\n var wrapper = new google.visualization.ChartWrapper(\n {chartType: 'CandlestickChart',\n dataTable: dataViewMinStdevStdevMax,\n options: optionsCandlestick,\n containerId: containerChart});\n wrapper.draw();\n\n break;\n\n case \"StackedColumn\":\n\n var optionsColumnchart = {\n chartArea: {width: '80%', height: '70%'},\n //legend: {position: 'in'},\n //titlePosition: 'in', \n axisTitlesPosition: 'in',\n hAxis: {textPosition: 'in'}, \n vAxis: {textPosition: 'in'},\n width: '100%', \n height: 520, \n isStacked: true, \n pointSize: 3,\n fontSize: 10,\n backgroundColor: 'transparent', \n bar:{groupWidth: '90%'},\n hAxis:{slantedTextAngle: 90},\n legend:{position: 'in', textStyle: {color: 'blue', fontSize: 12}},\n title: graphtitle\n }; \n var wrapper = new google.visualization.ChartWrapper(\n {chartType: 'ColumnChart',\n dataTable: dataViewCount,\n options: optionsColumnchart,\n containerId: containerChart});\n wrapper.draw();\n break;\n\n case \"Linechart\":\n //these are the customizable options from google\n var optionsLinechart = {\n chartArea: {width: '80%', height: '70%'},\n //legend: {position: 'in'},\n width: 1000, \n height: 480, \n pointSize: 0,\n title: graphtitle,\n vAxis: {title: OrdinateLabel}\n };\n\n var wrapper = new google.visualization.ChartWrapper(\n {chartType: 'LineChart',\n dataTable: dataViewAvg,\n options: optionsLinechart,\n containerId: containerChart});\n wrapper.draw();\n break;\n\n }\n\n } \n \u0026lt;/script\u0026gt; \n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eand here is the PHP script that takes Postgres data and converts them into a Google Chart-digestible format: \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e \u0026lt;?php\n if(isset($_GET['SensorString']) \u0026amp;\u0026amp; \n (!empty($_GET['SensorString'])) \u0026amp;\u0026amp; \n (!empty($_GET['TableType'])) \u0026amp;\u0026amp; \n (!empty($_GET['TimeUnit'])) \u0026amp;\u0026amp; \n (!empty($_GET['NoAbscissaBins'])) \u0026amp;\u0026amp; \n (!empty($_GET['DataTableName'])) \u0026amp;\u0026amp; \n (!empty($_GET['MultiplicationFactor'])) \u0026amp;\u0026amp; \n (!empty($_GET['TimeStart'])))\n\n {$SensorString = str_replace ( \"*\", \"%\", $_GET['SensorString']); // string to fill \"WHERE\" condition\n $TableType = $_GET['TableType']; // boolean/integer/float/string\n $TimeUnit = $_GET['TimeUnit']; //hours/days/weeks/months/years\n $NoAbscissaBins = $_GET['NoAbscissaBins']; //number of time units to be displayed on the abscissa\n $DataTableName = $_GET['DataTableName']; //number of time units to be displayed on the abscissa\n $TimeStart = $_GET['TimeStart']; //should not necessarily be used\n\n }\n else \n {// assume Bewegungsmelder, boolean, hours, 12 bins\n $SensorString = \"OutsideTemp\";\n $TableType = \"float\";\n $TimeUnit = \"days\";\n $TimeStart = -12; \n $NoAbscissaBins = 30;\n $DataTableName = \"dataClusterManagerTable\";\n }\n\n $RedirectEchoToFile = false;\n\n\n\n $DataCollectionArray = DataCollectionCrossTab($SensorString, $TableType, $TimeUnit, $NoAbscissaBins, $TimeStart, $DataTableName);\n //echo \"GoogleDataRow: \". $DataCollectionArray['GoogleDataRow'] ;\n $GoogleArray = PrepareGoogleChart($DataCollectionArray);\n\n\n /* $GoogleArray has the following keys:\n / [0] =\u0026gt; GoogleAddColumns \n / [1] =\u0026gt; GoogleAddRows \n / [2] =\u0026gt; GoogleVisualizeColumnCount \n / [3] =\u0026gt; GoogleVisualizeColumnsAvg \n / [4] =\u0026gt; GoogleVisualizeColumnsMinStdevStdevMax \n / [5] =\u0026gt; MainCrosstabSelectQuery \n */\n\n\n echo json_encode($GoogleArray);\n\n\n\n //---------------------------------------------------\n\n Function PrepareGoogleChart($DataCollectionArray)\n {\n // var GoogleAddColumns adds columns to DataTable\n\n $TimeUnit = \"hours\"; // (can be \"hours\", \"days\", \"months\", \"years\" )\n $GoogleAddColumns = \"\"; \n\n // var GoogleVisualizeColumnsAll renders DataView1 view of DataTable\n // var VisualizeFirstColumn sets the first column, and renders \"hours\" (can be changed to days etc.)\n $VisualizeFirstColumn = \".setColumns([\n {calc: function(data, row) \n {return data.getFormattedValue(row, \" \n . ColumnLabel($TimeUnit). \"); }, \n type:'string'}\";\n\n //set up dataView1, which is essentially useless\n $GoogleVisualizeColumnsAll = \n \"var dataView1 = new google.visualization.DataView(\".$DataCollectionArray['DataTableName'].\");\".chr(13)\n .\"dataView1\".$VisualizeFirstColumn;\n\n //set up dataViewCount, which is good to count events from IpsLoggingBoolean and feed a column chart\n $GoogleVisualizeColumnCount = \n \"var dataViewCount = new google.visualization.DataView(\".$DataCollectionArray['DataTableName'].\");\"\n .chr(13).\"dataViewCount\".$VisualizeFirstColumn;\n\n //set up dataViewAvg, which visualizes only the averages and is good for line charts\n $GoogleVisualizeAvg = \n \"var dataViewAvg = \n new google.visualization.DataView(\".$DataCollectionArray['DataTableName'].\");\".chr(13).\n \"dataViewAvg\"\n .\".setColumns([ {calc: function(data, row) \n {return data.getFormattedValue(row, \" \n . ColumnLabel($TimeUnit). \"); }, \n type:'string'}\";\n\n //set up dataViewMinStdevStdevMax, which can feed a candlestick chart \n $GoogleVisualizeColumnsMinStdevStdevMax = \n \"var dataViewMinStdevStdevMax = \n new google.visualization.DataView(\".$DataCollectionArray['DataTableName'].\");\".chr(13)\n .\"dataViewMinStdevStdevMax\"\n .\".setColumns([ {calc: function(data, row) \n {return data.getFormattedValue(row, \" \n . ColumnLabel($TimeUnit). \"); }, \n type:'string'}\";\n\n $GoogleVisualizeScattergram = \n \"var dataViewScattergram = new google.visualization.DataView(\".$DataCollectionArray['DataTableName'].\");\"\n .chr(13).\"dataViewScattergram.setColumns([\";\n\n\n //create strings for Google DataTable/DataView1 columns definition\n $GoogleAddColumns = \n \"var \". $DataCollectionArray['DataTableName']. \"= new google.visualization.DataTable();\".chr(13). \n $DataCollectionArray['DataTableName'].\".addColumn('string', 'hoursIndex');\".chr(13).\n $DataCollectionArray['DataTableName'].\".addColumn('string', 'hours');\".chr(13).\n $DataCollectionArray['DataTableName'].\".addColumn('string', 'PlaceHolder1');\".chr(13).\n $DataCollectionArray['DataTableName'].\".addColumn('string', 'PlaceHolder2');\".chr(13).\n $DataCollectionArray['DataTableName'].\".addColumn('string', 'PlaceHolder3'); \";\n\n for ($varIndex=0; $varIndex \u0026lt; ($DataCollectionArray['NumberOfColumns']-5); $varIndex++)\n {\n\n Switch ($DataCollectionArray['TableType'])\n {\n case \"boolean\":\n $GoogleAddColumns .= \n $DataCollectionArray['DataTableName'].\".addColumn('number', \".$DataCollectionArray['CategoryArray'][$varIndex]. \", 'count$varIndex'); \";\n break;\n\n case \"integer\":\n $GoogleAddColumns .= \n $DataCollectionArray['DataTableName'].\".addColumn('number', \".$DataCollectionArray['CategoryArray'][$varIndex]. \" +'avg'); \".chr(13).\n $DataCollectionArray['DataTableName'].\".addColumn('number', \".$DataCollectionArray['CategoryArray'][$varIndex]. \" +'stddev+'); \".chr(13).\n $DataCollectionArray['DataTableName'].\".addColumn('number', \".$DataCollectionArray['CategoryArray'][$varIndex]. \" +'stddev-'); \". chr(13).\n $DataCollectionArray['DataTableName'].\".addColumn('number', \".$DataCollectionArray['CategoryArray'][$varIndex]. \" +'max'); \" .chr(13).\n $DataCollectionArray['DataTableName'].\".addColumn('number', \".$DataCollectionArray['CategoryArray'][$varIndex]. \" +'min'); \" .chr(13);\n break;\n\n case \"float\":\n $GoogleAddColumns .= \n $DataCollectionArray['DataTableName'].\".addColumn('number', \".$DataCollectionArray['CategoryArray'][$varIndex]. \" +'avg'); \".chr(13).\n $DataCollectionArray['DataTableName'].\".addColumn('number', \".$DataCollectionArray['CategoryArray'][$varIndex]. \" +'stddev+'); \".chr(13).\n $DataCollectionArray['DataTableName'].\".addColumn('number', \".$DataCollectionArray['CategoryArray'][$varIndex]. \" +'stddev-'); \". chr(13).\n $DataCollectionArray['DataTableName'].\".addColumn('number', \".$DataCollectionArray['CategoryArray'][$varIndex]. \" +'max'); \" .chr(13).\n $DataCollectionArray['DataTableName'].\".addColumn('number', \".$DataCollectionArray['CategoryArray'][$varIndex]. \" +'min'); \" .chr(13);\n break;\n\n case \"string\":\n //no visualization in case of strings, but a \"tableChart\" could be generated if need be.\n break;\n }\n\n $GoogleVisualizeColumnsAll .= \n \", \". strval(($varIndex+1)*4+1).\", \". \n strval(($varIndex+1)*4+2).\", \". \n strval(($varIndex+1)*4+3).\", \". \n strval(($varIndex+1)*4+4); \n\n $GoogleVisualizeColumnCount .= \n \", \". strval(($varIndex+1)+4); \n\n $GoogleVisualizeAvg .= \n \", \". strval(($varIndex+1)*5+0); \n\n $GoogleVisualizeColumnsMinStdevStdevMax .= \n \", \". strval(($varIndex+1)*5+1).\n \", \". strval(($varIndex+1)*5+2).\n \", \". strval(($varIndex+1)*5+3).\n \", \". strval(($varIndex+1)*5+4); \n\n $GoogleVisualizeScattergram .= strval(($varIndex+1)*4+2).\", \";\n }\n\n //echo \"Tabletype: \". $DataCollectionArray['TableType'].chr(13).\"\u0026lt;br\u0026gt;\".\"\u0026lt;br\u0026gt;\";\n //echo \"GoogleAddColumns: \". $GoogleAddColumns.chr(13).\"\u0026lt;br\u0026gt;\".\"\u0026lt;br\u0026gt;\";\n\n $GoogleVisualizeColumnsAll .= \"]);\".chr(13);\n $GoogleVisualizeColumnCount .= \"]);\".chr(13);\n $GoogleVisualizeAvg .= \"]);\".chr(13);\n $GoogleVisualizeColumnsMinStdevStdevMax.= \"]);\".chr(13);\n $GoogleVisualizeScattergram = substr($GoogleVisualizeScattergram, 0, -2) . \"]);\".chr(13);\n\n VerboseEcho($GoogleAddColumns. \"\u0026lt;br\u0026gt;\u0026lt;br\u0026gt;\u0026lt;br\u0026gt;\".$GoogleVisualizeColumnsAll);\n\n\n //create dataset rows to be processed into google datatable\n $DataForGoogleChart = $DataCollectionArray['GoogleDataRow'];\n\n\n\n //echo \"\u0026lt;br\u0026gt;\u0026lt;font color='green'\u0026gt;DataForGoogleChart: $DataForGoogleChart\u0026lt;/font\u0026gt;\u0026lt;br\u0026gt;\";\n\n\n $GoogleFormattedDataArray = array(\n 'GoogleAddColumns' =\u0026gt; $GoogleAddColumns,\n 'GoogleAddRows' =\u0026gt; $DataCollectionArray['DataTableName'].'.addRows('.$DataCollectionArray['GoogleDataRow'].'); '.chr(13),\n 'GoogleVisualizeColumnCount' =\u0026gt; $GoogleVisualizeColumnCount,\n 'GoogleVisualizeColumnsAvg' =\u0026gt; $GoogleVisualizeAvg,\n 'GoogleVisualizeColumnsMinStdevStdevMax' =\u0026gt; $GoogleVisualizeColumnsMinStdevStdevMax,\n 'MainCrosstabSelectQuery' =\u0026gt; $DataCollectionArray['MainCrosstabSelectQuery'] \n );\n\n return $GoogleFormattedDataArray;\n }\n\n\n\n\n //-----------------------------------------------------\n\n Function DataCollectionCrossTab($SensorString, $TableType, $TimeUnit, $NoAbscissaBins, $TimeStart, $DataTableName) //sensorstring: e.g. DigitalInput 2\n {\n $dbconn = pg_connect(\"host=10.10.10.8 port=5432 dbname=IpsLogging user=*** password=***\") \n or die ('connection aborted: ' . pg_last_error().chr(13));\n\n switch ($TableType)\n {\n case \"boolean\":\n $IpsTable = \"loggingdb_ips_boolean\";\n $AggregateFunctions = \"COUNT(*) As value \";\n $SensorColumn = 2;\n $WhereClause=\" AND (log.ipsvalue = true) \"; //only movement triggers\n break;\n case \"integer\":\n $IpsTable = \"loggingdb_ips_integer\";\n $AggregateFunctions = \"(AVG(ipsvalue)::NUMERIC(8,2)) \n ||'', '' || \n (MIN(ipsvalue)::NUMERIC(8,2)) \n ||'', '' || \n ((AVG(ipsvalue)::NUMERIC(8,2)) - (coalesce(STDDEV(ipsvalue), 0)::NUMERIC(8,2))) \n ||'', '' || \n ((AVG(ipsvalue)::NUMERIC(8,2)) + (coalesce(STDDEV(ipsvalue), 0)::NUMERIC(8,2))) \n ||'', '' || \n (MAX(ipsvalue)::NUMERIC(8,2)) \n As value \";\n $WhereClause=\"\";\n $SensorColumn = 4;\n break;\n case \"float\":\n $IpsTable = \"loggingdb_ips_float\";\n $AggregateFunctions = \"(AVG(ipsvalue)::NUMERIC(8,2)) \n ||'', '' || \n (MIN(ipsvalue)::NUMERIC(8,2)) \n ||'', '' || \n ((AVG(ipsvalue)::NUMERIC(8,2)) - (coalesce(STDDEV(ipsvalue), 0)::NUMERIC(8,2))) \n ||'', '' || \n ((AVG(ipsvalue)::NUMERIC(8,2)) + (coalesce(STDDEV(ipsvalue), 0)::NUMERIC(8,2))) \n ||'', '' || \n (MAX(ipsvalue)::NUMERIC(8,2)) \n As value \";\n $SensorColumn = 4;\n $WhereClause=\"\";\n break;\n case \"string\":\n $IpsTable = \"loggingdb_ips_string\";\n $WhereClause=\"\";\n break;\n }\n\n Switch ($TimeUnit)\n {case \"minutes\":\n $SelectRowNames = \n \"to_char(ipstimestamp, ''YYYYMMDDHH24MI'') As row_name, \n to_char(ipstimestamp, ''FMHH24h:MI'') As labelled_row_name, \n ''PlaceHolder1'' As PlaceHolder1,\n ''PlaceHolder2'' As PlaceHolder2,\n ''PlaceHolder3'' As PlaceHolder3,\";\n $GroupOrder = \" \n GROUP BY row_name, labelled_row_name, PlaceHolder1, PlaceHolder2, PlaceHolder3, objectid, category \n ORDER BY row_name, labelled_row_name, PlaceHolder1, PlaceHolder2, PlaceHolder3, objectid, category', \";\n break;\n\n case \"hours\":\n $SelectRowNames = \n \"to_char(ipstimestamp, ''YYYYMMDDHH24'') As row_name, \n to_char(ipstimestamp, ''FMDD mon FMHH24h'') As labelled_row_name, \n ''PlaceHolder1'' As PlaceHolder1,\n ''PlaceHolder2'' As PlaceHolder2,\n ''PlaceHolder3'' As PlaceHolder3,\";\n $GroupOrder = \" \n GROUP BY row_name, labelled_row_name, PlaceHolder1, PlaceHolder2, PlaceHolder3, objectid, category \n ORDER BY row_name, labelled_row_name, PlaceHolder1, PlaceHolder2, PlaceHolder3, objectid, category', \";\n break;\n\n case \"days\":\n $SelectRowNames = \n \"to_char(ipstimestamp, ''YYYYMMDD'') As row_name, \n to_char(ipstimestamp, ''FMDD mon YYYY'') As labelled_row_name, \n ''PlaceHolder1'' As PlaceHolder1,\n ''PlaceHolder2'' As PlaceHolder2,\n ''PlaceHolder3'' As PlaceHolder3,\";\n $GroupOrder = \" \n GROUP BY row_name, labelled_row_name, PlaceHolder1, PlaceHolder2, PlaceHolder3, objectid, category \n ORDER BY row_name, labelled_row_name, PlaceHolder1, PlaceHolder2, PlaceHolder3, objectid, category', \"; \n break;\n\n case \"weeks\":\n $SelectRowNames = \n \"to_char(ipstimestamp, ''YYYYWW'') As row_name, \n ''wk'' || to_char(ipstimestamp, ''FMWW YYYY'') As labelled_row_name, \n ''PlaceHolder1'' As PlaceHolder1,\n ''PlaceHolder2'' As PlaceHolder2,\n ''PlaceHolder3'' As PlaceHolder3,\";\n $GroupOrder = \" \n GROUP BY row_name, labelled_row_name, PlaceHolder1, PlaceHolder2, PlaceHolder3, objectid, category \n ORDER BY row_name, labelled_row_name, PlaceHolder1, PlaceHolder2, PlaceHolder3, objectid, category', \"; \n break;\n\n case \"months\":\n $SelectRowNames = \n \"to_char(ipstimestamp, ''YYYYMM'') As row_name, \n to_char(ipstimestamp, ''mon YYYY'') As labelled_row_name, \n ''PlaceHolder1'' As PlaceHolder1,\n ''PlaceHolder2'' As PlaceHolder2,\n ''PlaceHolder3'' As PlaceHolder3,\";\n $GroupOrder = \" \n GROUP BY row_name, labelled_row_name, PlaceHolder1, PlaceHolder2, PlaceHolder3, objectid, category \n ORDER BY row_name, labelled_row_name, PlaceHolder1, PlaceHolder2, PlaceHolder3, objectid, category', \"; \n break;\n\n case \"years\":\n $SelectRowNames = \n \"to_char(ipstimestamp, ''YYYY'') As row_name, \n to_char(ipstimestamp, ''YYYY'') As labelled_row_name, \n ''PlaceHolder1'' As PlaceHolder1,\n ''PlaceHolder2'' As PlaceHolder2,\n ''PlaceHolder3'' As PlaceHolder3,\";\n $GroupOrder = \" \n GROUP BY row_name, labelled_row_name, PlaceHolder1, PlaceHolder2, PlaceHolder3, objectid, category \n ORDER BY row_name, labelled_row_name, PlaceHolder1, PlaceHolder2, PlaceHolder3, objectid, category', \"; \n break;\n } \n\n\n\n // echo \"type \".$IpsTable.\" \u0026lt;br\u0026gt;\";\n $SensorResult = GetSensorNames($SensorString, $TableType, \"\", \"\",0, 1);\n // echo \"SensorResult: \".$SensorResult.chr(13);\n $CategoryString = implode(\", \", pg_fetch_all_columns($SensorResult,$SensorColumn));\n $CategoryArray = pg_fetch_all_columns(GetSensorNames($SensorString, $TableType, \"\", \"\",0, 0),5); //array containing the name of each sensor\n\n // echo \"\u0026lt;strong\u0026gt;CategoryString: \u0026lt;/strong\u0026gt;\". $CategoryString.chr(13).\"\u0026lt;br\u0026gt;\u0026lt;br\u0026gt;\u0026lt;br\u0026gt;\u0026lt;br\u0026gt;\";\n //Print_r ($CategoryArray);\n\n\n //primary query (non-crosstabbed yet)\n $PrimaryQuery =\"'SELECT \". $SelectRowNames. \n \"varid As category, \" \n .$AggregateFunctions\n .\" FROM $IpsTable As log \n JOIN ipsobjects_with_parent ips \n ON log.varid = ips.objectid\n WHERE (ips.objectname LIKE ''\".$SensorString.\"'') \"\n . $WhereClause . \" \n AND (ipstimestamp \u0026gt; (now()- ''\". $NoAbscissaBins . \" \" . $TimeUnit. \"''::interval)) \". $GroupOrder ;\n\n // echo \"\u0026lt;strong\u0026gt;PrimaryQuery: $PrimaryQuery\u0026lt;/strong\u0026gt;\";\n\n //main crosstab query which pulls all the content data:\n $MainCrosstabSelectQuery = \n \"SELECT * FROM crosstab\n (\" .$PrimaryQuery .\n \"'SELECT DISTINCT varid \n FROM $IpsTable As log \n JOIN ipsobjects_with_parent ips \n ON log.varid = ips.objectid\n WHERE (ips.objectname LIKE ''\".$SensorString.\"'')\n ORDER BY 1;' \n )\n\n As CountsPerHour(row_name text, \n label_row_name text, \n PlaceHolder1 text, \n PlaceHolder2 text, \n PlaceHolder3 text, \" \n .$CategoryString.\")\";\n\n //echo \"\u0026lt;br\u0026gt;\u0026lt;font color='red'\u0026gt;$MainCrosstabSelectQuery\u0026lt;/font\u0026gt;\u0026lt;br\u0026gt;\";\n\n $QueryResult=pg_query ($dbconn, $MainCrosstabSelectQuery);\n $CrosstabArray = pg_fetch_all($QueryResult);\n //echo \"CrosstabArray: \" . $CrosstabArray ;\n //$table = good_query_table($CrosstabArray, $QueryResult, 0);\n //BetterTable($QueryResult); //this functions outputs a nicely formatted crosstab!\n\n if (!$QueryResult) \n echo \"PG Error: \". pg_last_error().chr(13);\n\n // create bracketed Array of Arrays GoogleDataRow\n $GoogleDataRow =\"[\"; //opening bracket inserted\n while ($field = pg_fetch_row($QueryResult)) \n {\n\n $GoogleDataRow .=\"[\"; \n $index =0;\n\n switch ($TableType)\n {\n case \"boolean\":\n foreach ($field as $col_value) {\n $index++;\n if ($index\u0026lt;6)\n //the first five columns are strings (date headers)\n {$GoogleDataRow .= \"'\".$col_value.\"', \";} \n else{\n //anythign above 5 is data\n //substitute NULL with zeroes, else GoogleChart doesnt work\n if($col_value == NULL) $col_value = \"null\"; \n $GoogleDataRow .= $col_value.\", \";\n }\n }\n break;\n\n case \"integer\":\n foreach ($field as $col_value) {\n ++$index;\n if ($index\u0026lt;6)\n {//the first give columns are strings (date headers)\n $GoogleDataRow .= \"'\".$col_value.\"', \";} \n else{\n //anythign above 5 is data\n //substitute NULL with 5x zeroes, else GoogleChart doesnt work\n if($col_value == NULL) $col_value = \"null,null,null,null,null\"; \n $GoogleDataRow .= $col_value.\", \";\n }\n }\n break;\n\n case \"float\":\n foreach ($field as $col_value) {\n ++$index;\n if ($index\u0026lt;6)\n {//the first give columns are strings (date headers)\n $GoogleDataRow .= \"'\".$col_value.\"', \";} \n else{\n //anythign above 5 is data\n //substitute NULL with 5x zeroes, else GoogleChart doesnt work\n if($col_value == NULL) $col_value = \"null,null,null,null,null\"; \n $GoogleDataRow .= $col_value.\", \";\n }\n }\n break;\n\n case \"string\":\n foreach ($field as $col_value) {\n ++$index;\n if ($index\u0026lt;5)\n //the first give columns are strings (date headers)\n {$GoogleDataRow .= \"'\".$col_value.\"', \";} \n else{\n //anythign above 5 is data\n //substitute NULL with zeroes, else GoogleChart doesnt work\n if($col_value == NULL) $col_value = 0; \n $GoogleDataRow .= $col_value.\" \";\n }\n }\n break;\n }\n\n $GoogleDataRow = substr($GoogleDataRow,0,-5).\"], \";\n\n //echo \"\u0026lt;br\u0026gt;\u0026lt;font color='blue'\u0026gt;$GoogleDataRow \u0026lt;/font\u0026gt;\u0026lt;br\u0026gt;\"; \n }\n\n\n $GoogleDataRow = substr($GoogleDataRow,0,-2).\"]\";\n\n $DataCollectionArray = array(\n \"GoogleDataRow\"=\u0026gt;$GoogleDataRow,\n \"NumberOfColumns\"=\u0026gt;pg_num_fields($QueryResult), // total number of columns, including all row headers\n \"CategoryArray\"=\u0026gt;$CategoryArray,\n \"TableType\"=\u0026gt;$TableType,\n \"DataTableName\" =\u0026gt; $DataTableName, \n \"MainCrosstabSelectQuery\" =\u0026gt; $MainCrosstabSelectQuery \n );\n return $DataCollectionArray;\n }\n\n\n\n //---------------------------------------\n\n function BetterTable($result)\n {\n $i = 0;\n echo \"\u0026lt;html\u0026gt;\n \u0026lt;body\u0026gt;\n \u0026lt;table\u0026gt;\n \u0026lt;table class='BetterTable' border='1'\u0026gt;\";\n\n echo \"\u0026lt;tr\u0026gt;\";\n echo '\u0026lt;td\u0026gt;Line #\n \u0026lt;/td\u0026gt;';\n while ($i \u0026lt; pg_num_fields($result))\n {\n $fieldName = pg_field_name($result, $i);\n echo '\u0026lt;td\u0026gt;' . $fieldName . '\u0026lt;/td\u0026gt;';\n $i = $i + 1;\n }\n echo '\u0026lt;/tr\u0026gt;';\n $i = 0;\n\n while ($field = pg_fetch_row($result)) \n {\n if ($i%2 == 0) \n Echo \"\u0026lt;tr bgcolor=\\\"#d0d0d0\\\" \u0026gt;\";\n else \n Echo \"\u0026lt;tr bgcolor=\\\"#eeeeee\\\"\u0026gt;\";\n $fields = count($field);\n $y = 0;\n echo '\u0026lt;td\u0026gt;'.$i. '\u0026lt;/td\u0026gt;';\n while ($y \u0026lt; $fields)\n {\n $c_row = current($field);\n echo '\u0026lt;td\u0026gt;'.$c_row . '\u0026lt;/td\u0026gt;';\n next($field);\n $y = $y + 1;\n }\n echo '\u0026lt;/tr\u0026gt;';\n $i = $i + 1;\n }\n\n\n echo '\u0026lt;/table\u0026gt;\u0026lt;br\u0026gt;\u0026lt;br\u0026gt;\u0026lt;/body\u0026gt;\u0026lt;/html\u0026gt;';\n\n }\n\n //----------------------------------------------------\n\n Function GetSensorNames($SensorType, $TableType, $prefix, $postfix, $QueryType, $column)\n {//TableType specifies the type of variable, and redirectes to the correct table.\n //prefix and postfix are adapters returned for each row\n //\n //retrieve full names of DataCollection variables, including parent names\n //QueryColumns specifies which query columns (see below)\n\n $dbconn = pg_connect(\"host=10.10.10.8 port=5432 dbname=IpsLogging user=*** password=***\") \n or die ('connection aborted: ' . pg_last_error().chr(13));\n\n\n switch ($TableType)\n {\n case \"boolean\":\n $IpsTable = \"loggingdb_ips_boolean\";\n break;\n case \"integer\":\n $IpsTable = \"loggingdb_ips_integer\";\n break;\n case \"float\":\n $IpsTable = \"loggingdb_ips_float\";\n break;\n case \"string\":\n $IpsTable = \"loggingdb_ips_string\";\n break;\n }\n // echo \"type \".$IpsTable.\" \u0026lt;br\u0026gt;\";\n\n\n if ($prefix!=\"\") $prefix = $prefix.\" || \";\n if ($postfix!=\"\")$postfix = \" || \". $postfix;\n\n $GetSensorNamesString = \n \"SELECT \n DISTINCT '\\\"' || varid ||'\\\"' || ' integer ' as integername,\n varid as NakedVariable, \n '\\\"' || ips.parentname || ' - ' || ips.objectname || ' (' || ips.objectid || ')\\\"' || ' integer ' AS fullname,\n '\\\"' || ips.parentname || ' - ' || ips.objectname || ' (' || ips.objectid || ')\\\"' || ' numeric(8,2) ' AS fullnamenumeric,\n '\\\"' || ips.parentname || ' - ' || ips.objectname || ' (' || ips.objectid || ')\\\"' || ' text ' AS fullnamestring,\n '\\\"' || ips.parentname || ' - ' || ips.objectname || ' (' || ips.objectid || ')\\\"' AS fullnamestring,\n ips.parentname || ' - ' || ips.objectname || ' (' || ips.objectid || ')' || ' text ' AS fullnamestringwithoutquotes,\n $prefix varid $postfix as DecoratedVariable\n\n FROM $IpsTable As log \n JOIN ipsobjects_with_parent ips \n ON log.varid = ips.objectid\n WHERE (ips.objectname LIKE '$SensorType')\n ORDER BY 1;\n \";\n //echo \"\u0026lt;strong\u0026gt;$GetSensorNamesString\u0026lt;/strong\u0026gt;\"; \n\n $QueryResult=pg_query ($dbconn, $GetSensorNamesString);\n if (!$QueryResult) \n echo \"PG Error: \". pg_last_error().chr(13);\n else\n {return $QueryResult;}\n }\n //-----------------------------\n Function ColumnLabel($TimeUnit)\n {\n switch ($TimeUnit)\n {\n case \"minutes\": $ColumnLabel= \"0\"; break;\n case \"hours\": $ColumnLabel= \"1\"; break;\n case \"days\": $ColumnLabel= \"2\"; break;\n case \"months\": $ColumnLabel= \"3\"; break;\n case \"years\": $ColumnLabel= \"4\"; break;}\n return($ColumnLabel);\n }\n //--------------------------------------------\n function VerboseEcho($Anything)\n {global $Verbose;\n if ($Verbose == true) Echo $Anything;}\n ?\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"1","comment_count":"0","creation_date":"2016-03-29 18:13:17.953 UTC","last_activity_date":"2016-03-29 18:40:05.923 UTC","last_edit_date":"2016-03-29 18:40:05.923 UTC","last_editor_display_name":"","last_editor_user_id":"1320581","owner_display_name":"","owner_user_id":"1320581","post_type_id":"1","score":"2","tags":"javascript|php|postgresql|charts|google-visualization","view_count":"87"} {"id":"40345980","title":"Trying to add 10 to this.y variable, but returns NaN","body":"\u003cp\u003eI seem to have done something wrong and cant find any solutions. I've tried to convert them into numbers and tried += but i get NaN.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003efunction circle() {\n this.x = 60;\n this.y = 200;\n this.draw = function() {\n ellipse(this.x, this.y, 20, \"green\");\n };\n\n\n this.move = function() {\n $(document).keydown(function(e) {\n // console.log(e.keyCode);\n if (e.keyCode === 68) {\n this.y += 1;\n console.log(this.y);\n }\n });\n };\n\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eMight it be because they are not variables?\u003c/p\u003e\n\n\u003cp\u003ethanks :)\u003c/p\u003e","accepted_answer_id":"40346111","answer_count":"1","comment_count":"11","creation_date":"2016-10-31 16:01:59.417 UTC","last_activity_date":"2016-10-31 16:12:21.017 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"7035941","post_type_id":"1","score":"0","tags":"javascript|jquery|html","view_count":"49"} {"id":"38765068","title":"Strange happenings in the barren wastes of visual studio","body":"\u003cp\u003eSo I was just happily going along defining a new class when this happend: \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eclass Thing : public OtherThing\n{\npublic:\n Thing : public OtherThing();//here\n};\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI really have no idea why visual assist/studio did this and i've never seen it before so really my question is what does it mean?\u003c/p\u003e\n\n\u003cp\u003eJust for the sake of clarity I would normally define the same class like this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eclass Thing : public OtherThing\n{\npublic:\n Thing();\n};\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"38766386","answer_count":"1","comment_count":"5","creation_date":"2016-08-04 10:39:54.527 UTC","last_activity_date":"2016-08-04 12:07:26.017 UTC","last_edit_date":"2016-08-04 12:07:26.017 UTC","last_editor_display_name":"","last_editor_user_id":"6564148","owner_display_name":"","owner_user_id":"6564148","post_type_id":"1","score":"0","tags":"c++|visual-studio-2012","view_count":"66"} {"id":"6321663","title":"NSButton over QTCaptureView","body":"\u003cp\u003eIs there any way to put NSButton object over QTCaptureView? \nI have done following, \u003c/p\u003e\n\n\u003col\u003e\n\u003cli\u003eIn interface builder, added a\nQTCaptureView, \u003c/li\u003e\n\u003cli\u003eAdded a button\non top of QTCaptureView and it's\nallowing to do so.\u003c/li\u003e\n\u003c/ol\u003e\n\n\u003cp\u003eWhen i launch the application, I can see the button over the QTCaptureView but when I start the Camera which will show the Preview in the QTCaptureView session, button is overriding by QTCaptureView. \u003c/p\u003e\n\n\u003cp\u003eAny idea what i am doing wrong ?\u003c/p\u003e\n\n\u003cp\u003eBasically I need to implement a Control which shows QTCaptureView and a Button over it; when user presses the button then I need to Launch the NSImageView over the QTCaptureView.\u003c/p\u003e","accepted_answer_id":"6322313","answer_count":"1","comment_count":"0","creation_date":"2011-06-12 11:24:20.627 UTC","favorite_count":"1","last_activity_date":"2011-06-17 19:47:48.46 UTC","last_edit_date":"2011-06-12 11:29:59.803 UTC","last_editor_display_name":"","last_editor_user_id":"24424","owner_display_name":"","owner_user_id":"1565490","post_type_id":"1","score":"1","tags":"objective-c|cocoa|nsbutton","view_count":"234"} @@ -2433,11 +2433,11 @@ {"id":"2680288","title":"Freebase; select a random record?","body":"\u003cp\u003e1) Is there any way to select a random record from Freebase? If I do a limit of 1, it consistently returns the same record. I could grab the larger data set and select a random rec from that but that seems like overkill. Analogous to MySQL's :\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eselect * from profiles order by rand() limit 1;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e2) Is there any way to tell Freebase not to select certain items in a set?\u003c/p\u003e\n\n\u003cp\u003eAnalogous to MySQL's :\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eselect * from profiles where id NOT IN (SELECT profile_id from approved_profiles)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThanks in advance\u003c/p\u003e","accepted_answer_id":"2685330","answer_count":"1","comment_count":"0","creation_date":"2010-04-21 04:19:12.577 UTC","favorite_count":"3","last_activity_date":"2010-04-21 17:56:04.4 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"168083","post_type_id":"1","score":"2","tags":"freebase|mql","view_count":"275"} {"id":"33225352","title":"Regex: how to separate strings by apostrophes in certain cases only","body":"\u003cp\u003eI am looking to capitalize the first letter of words in a string. I've managed to put together something by reading examples on here. However, I'm trying to get any names that start with O' to separate into 2 strings so that each gets capitalized. I have this so far:\u003c/p\u003e\n\n\u003cp\u003e\u003ccode\u003e\\b([^\\W_\\d](?!')[^\\s-]*) *\u003c/code\u003e\u003c/p\u003e\n\n\u003cp\u003ewhich omits selecting the X' from any string X'XYZ. That works for capitalizing the part after the ', but doesn't capitalize the X'. Further more, i'm becomes i'M since it's not specific to O'. To state the goal:\no'malley should go to O'Malley\no'malley's should go to O'Malley's\ndon't should go to Don't\ni'll should go to I'll\n(as an aside, I want to omit any strings that start with numbers, like 23F, that seems to work with what I have)\nHow to make it specific to the strings that start with O'? Thx\u003c/p\u003e","accepted_answer_id":"33225673","answer_count":"1","comment_count":"3","creation_date":"2015-10-19 23:00:07.92 UTC","last_activity_date":"2015-10-20 00:26:00.097 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"5464822","post_type_id":"1","score":"1","tags":"regex","view_count":"38"} {"id":"45107199","title":"Rails 5 with Devise - Devise User has_one Login","body":"\u003cp\u003eI am making a website for an existing database. This database is from a game and I can't make many changes in the existing tables. \u003c/p\u003e\n\n\u003cp\u003eI decided to use Devise as the authentication solution.\nI will use the User model from Devise for the website and the database has a Login table with some important informations.\u003c/p\u003e\n\n\u003cp\u003eThey will have a \u003cstrong\u003eone to one association\u003c/strong\u003e where the User has_one Login and the Login belongs to User.\u003c/p\u003e\n\n\u003cp\u003eI changed the User registration form to have some Login information. I used nested form for that. When I signup it should create the User and Login.\u003c/p\u003e\n\n\u003cp\u003eI'm trying this create part but it's not working. I tried many different ways but it never works. The two main problems are: \u003c/p\u003e\n\n\u003col\u003e\n\u003cli\u003eit creates the User but do not create the Login\u003c/li\u003e\n\u003cli\u003eit creates both but the Login does not have the information that i\nput in the form. They are all blank\u003c/li\u003e\n\u003c/ol\u003e\n\n\u003cp\u003eI tried many different ways:\u003c/p\u003e\n\n\u003cul\u003e\n\u003cli\u003eoverride the new method in the RegistrationController using resource.build_login\u003c/li\u003e\n\u003cli\u003eoverride sign_up_params method with permit inside\u003c/li\u003e\n\u003cli\u003eput the resource.build_login in the new view\u003c/li\u003e\n\u003cli\u003eoverride build_resource and put resource.build_login there\u003c/li\u003e\n\u003c/ul\u003e\n\n\u003cp\u003eNone of them works.\u003c/p\u003e\n\n\u003cp\u003eI'm using Rails 5.0.2 and Devise 4.2.0.\u003c/p\u003e\n\n\u003cp\u003eThese are the models:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eclass Login \u0026lt; ApplicationRecord\n belongs_to :user\n # accepts_nested_attributes_for :user\nend\n\nclass User \u0026lt; ApplicationRecord\n devise :database_authenticatable, :registerable,\n :recoverable, :rememberable, :trackable, :validatable\n\n has_one :login\n # accepts_nested_attributes_for :login\nend\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eOne important question is where should I put the \u003cstrong\u003eaccepts_nested_attributes_for\u003c/strong\u003e? I saw people using it in the Model that has belong and I also saw people using in the has_one model.\u003c/p\u003e\n\n\u003cp\u003eThis is my RegistrationController:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eclass Users::RegistrationsController \u0026lt; Devise::RegistrationsController\n def new\n super\n resource.build_login\n end\n def create\n super\n end\n def sign_up_params\n params.require(resource_name).permit(:email, :password, \n :password_confirmation, login_attributes: \n [:userid, :birthdate, :sex])\n end\nend\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAnd this is my view:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;%= simple_form_for(resource, as: resource_name, url: \n registration_path(resource_name)) do |f| %\u0026gt;\n \u0026lt;%= f.error_notification %\u0026gt;\n \u0026lt;%= f.input :email, required: true, autofocus: true, class: 'form-\n control' %\u0026gt;\n \u0026lt;%= f.input :password, required: true, hint: (\"No mínimo #\n {@minimum_password_length} caracteres\" if \n @minimum_password_length) %\u0026gt;\n \u0026lt;%= f.input :password_confirmation, required: true %\u0026gt;\n \u0026lt;%= f.simple_fields_for :login do |ff| %\u0026gt;\n \u0026lt;%= ff.input :userid %\u0026gt;\n \u0026lt;%= ff.input :birthdate %\u0026gt;\n \u0026lt;%= ff.label :sex %\u0026gt;\n \u0026lt;%= ff.input_field :sex, collection: [['Feminino', 'F'], \n ['Masculino', 'M']], class: 'form-control' %\u0026gt;\n \u0026lt;% end %\u0026gt;\n \u0026lt;%= f.button :submit, 'Cadastrar', class: 'btn btn-primary' %\u0026gt;\n\u0026lt;% end %\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI hope that all the information needed are there.\u003c/p\u003e\n\n\u003cp\u003eMost answers I found for this problem were to Rails 4 or Rails 3 and maybe they didn't work for me because I'm using Rails 5.\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eEdit #1:\u003c/strong\u003e Added create method in RegistrationController.\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eEdit #2:\u003c/strong\u003e With \u003ccode\u003eaccepts_nested_attributes_for\u003c/code\u003e in user the fields doesn't appear so I changed \u003ccode\u003eaccepts_nested_attributes_for\u003c/code\u003e to login model.\u003c/p\u003e\n\n\u003cp\u003eAnd here is the log for how the code is now:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eStarted POST \"/users\" for 127.0.0.1 at 2017-07-14 20:24:40 -0300\nProcessing by Users::RegistrationsController#create as HTML\n Parameters: {\"utf8\"=\u0026gt;\"✓\", \"authenticity_token\"=\u0026gt;\n \"habj5iep5SaE5nkyimzFyVslsCAIvy7ZokmM\n KA8WDgbgQkYCa/mofo83sllRiwX13OCkPXIjbkR+CcDKBICXOw==\",\n \"user\"=\u0026gt;{\"email\"=\u0026gt;\"breno@gmail.com\", \"password\"=\u0026gt;\"[FILTERED]\", \n \"password_confirmation\"=\u0026gt;\"[FILTERED]\", \"login\"=\u0026gt;\n {\"userid\"=\u0026gt;\"breno1\", \"birthdate\"=\u0026gt;\"13/07/2017\", \"sex\"=\u0026gt;\"M\"}}, \n \"commit\"=\u0026gt;\"Cadastrar\"}\nUnpermitted parameter: login\n(10.8ms) BEGIN\nUser Exists (10.1ms) SELECT 1 AS one FROM `users` WHERE \n `users`.`email` = BINARY 'breno@gmail.com' LIMIT 1\nSQL (11.5ms) INSERT INTO `users` (`email`, `encrypted_password`, \n `created_at`, `updated_at`) VALUES ('breno@gmail.com', \n '$2a$11$4le6ZB5JyrYZGYLXvtlwa.c6BA463BvNYkSINfU0C10LoJADEYJ8q', \n '2017-07-14 23:24:41', '2017-07-14 23:24:41')\n(18.3ms) COMMIT\n(12.6ms) BEGIN\nSQL (11.0ms) UPDATE `users` SET `sign_in_count` = 1, \n `current_sign_in_at` = '2017-07-14 23:24:41', `last_sign_in_at` = \n '2017-07-14 23:24:41', `current_sign_in_ip` = '127.0.0.1', \n `last_sign_in_ip` = '127.0.0.1' WHERE `users`.`id` = 33\n(11.6ms) COMMIT\nRedirected to http://localhost:3000/\nCompleted 302 Found in 436ms (ActiveRecord: 85.8ms)\n\n\nStarted GET \"/\" for 127.0.0.1 at 2017-07-14 20:24:41 -0300\nProcessing by HomeController#index as HTML\nRendering home/index.html.erb within layouts/application\nRendered home/index.html.erb within layouts/application (0.7ms)\nUser Load (13.7ms) SELECT `users`.* FROM `users` WHERE `users`.`id` \n = 33 ORDER BY `users`.`id` ASC LIMIT 1\nLogin Load (11.1ms) SELECT `login`.* FROM `login` WHERE \n `login`.`user_id` = 33 LIMIT 1\nRendered layouts/_side_navbar.html.erb (26.0ms)\nCompleted 500 Internal Server Error in 619ms (ActiveRecord: 24.8ms)\n\n\n\nActionView::Template::Error (undefined method `userid' for \n nil:NilClass):\n4: \u0026lt;div class=\"sidenav-header-inner text-center\"\u0026gt;\n5: \u0026lt;%= image_tag 'avatar-1.jpg', class: 'img-fluid rounded-\n circle' %\u0026gt;\n6: \u0026lt;h2 class=\"h5 text-uppercase\"\u0026gt;\n7: \u0026lt;%= current_user.login.userid %\u0026gt;\n8: \u0026lt;/h2\u0026gt;\n9: \u0026lt;span class=\"text-uppercase\"\u0026gt;\n10: \u0026lt;%= current_user.is_admin? ? 'administrador' : 'jogador' \n %\u0026gt;\n\napp/views/layouts/_side_navbar.html.erb:7:in \n`_app_views_layouts__side_navbar_html_erb__415501206315934300_\n 70011534596860'\napp/views/layouts/application.html.erb:13:in \n`_app_views_layouts_application_html_erb__1458307398416558594_\n 70011827322320'\nRendering /home/prikster/.rvm/gems/ruby-2.3.1/gems/actionpack-\n 5.0.2/lib/action_dispatch/middleware/templates/rescues/\n template_error.html.erb within rescues/layout\nRendering /home/prikster/.rvm/gems/ruby-2.3.1/gems/actionpack-\n 5.0.2/lib/action_dispatch/middleware/templates/rescues/\n _source.html.erb\nRendered /home/prikster/.rvm/gems/ruby-2.3.1/gems/actionpack-\n 5.0.2/lib/action_dispatch/middleware/templates/rescues/\n _source.html.erb (32.9ms)\nRendering /home/prikster/.rvm/gems/ruby-2.3.1/gems/actionpack-\n 5.0.2/lib/action_dispatch/middleware/templates/rescues/\n _trace.html.erb\nRendered /home/prikster/.rvm/gems/ruby-2.3.1/gems/actionpack-\n 5.0.2/lib/action_dispatch/middleware/templates/rescues/\n _trace.html.erb (5.0ms)\nRendering /home/prikster/.rvm/gems/ruby-2.3.1/gems/actionpack-\n 5.0.2/lib/action_dispatch/middleware/templates/rescues/\n _request_and_response.html.erb\nRendered /home/prikster/.rvm/gems/ruby-2.3.1/gems/actionpack-\n 5.0.2/lib/action_dispatch/middleware/templates/rescues/\n _request_and_response.html.erb (1.7ms)\nRendered /home/prikster/.rvm/gems/ruby-2.3.1/gems/actionpack-\n 5.0.2/lib/action_dispatch/middleware/templates/rescues/\n template_error.html.erb within rescues/layout (62.6ms)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eIs \u003ccode\u003eaccepts_nested_attributes_for\u003c/code\u003e in the right model?\u003c/p\u003e\n\n\u003cp\u003eIn the log there is a line pointing to an \u003ccode\u003eUnpermitted parameter: login\u003c/code\u003e. What should I do to correct this?\u003c/p\u003e","answer_count":"1","comment_count":"3","creation_date":"2017-07-14 15:57:59.847 UTC","last_activity_date":"2017-07-15 03:25:34.11 UTC","last_edit_date":"2017-07-14 23:38:33.857 UTC","last_editor_display_name":"","last_editor_user_id":"7999165","owner_display_name":"","owner_user_id":"7999165","post_type_id":"1","score":"0","tags":"ruby-on-rails|devise|nested-forms|accepts-nested-attributes","view_count":"66"} -{"id":"40666801","title":"Why does scala.beans.beanproperty work differently in spark","body":"\u003cp\u003eIn a scala REPL the following code\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eimport scala.beans.BeanProperty\n\nclass EmailAccount {\n @scala.beans.BeanProperty var accountName: String = null\n\n override def toString: String = {\n return s\"acct ($accountName)\"\n }\n}\nclassOf[EmailAccount].getDeclaredConstructor()\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eresults in \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eres0: java.lang.reflect.Constructor[EmailAccount] = public EmailAccount()\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ehowever in spark's REPL I get\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ejava.lang.NoSuchMethodException: EmailAccount.\u0026lt;init\u0026gt;()\n at java.lang.Class.getConstructor0(Class.java:2810)\n at java.lang.Class.getDeclaredConstructor(Class.java:2053)\n ... 48 elided\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhat causes this discrepancy? How can I get spark to match the behavior of the spark shell.\u003c/p\u003e\n\n\u003cp\u003eI launched the REPLs like so:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e/home/placey/Downloads/spark-2.0.0-bin-hadoop2.7/bin/spark-shell --master local --jars /home/placey/snakeyaml-1.17.jar\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eand\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003escala -classpath \"/home/placey/snakeyaml-1.17.jar\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eScala versions are \nspark:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eUsing Scala version 2.11.8 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_55)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003escala:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eWelcome to Scala version 2.11.6 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_55).\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"40689204","answer_count":"1","comment_count":"0","creation_date":"2016-11-17 23:19:59.523 UTC","last_activity_date":"2016-11-19 04:26:14.61 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1269969","post_type_id":"1","score":"1","tags":"scala|apache-spark|javabeans","view_count":"80"} +{"id":"40666801","title":"Why does scala.beans.beanproperty work differently in spark","body":"\u003cp\u003eIn a scala REPL the following code\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eimport scala.beans.BeanProperty\n\nclass EmailAccount {\n @scala.beans.BeanProperty var accountName: String = null\n\n override def toString: String = {\n return s\"acct ($accountName)\"\n }\n}\nclassOf[EmailAccount].getDeclaredConstructor()\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eresults in \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eres0: java.lang.reflect.Constructor[EmailAccount] = public EmailAccount()\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ehowever in spark's REPL I get\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ejava.lang.NoSuchMethodException: EmailAccount.\u0026lt;init\u0026gt;()\n at java.lang.Class.getConstructor0(Class.java:2810)\n at java.lang.Class.getDeclaredConstructor(Class.java:2053)\n ... 48 elided\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhat causes this discrepancy? How can I get spark to match the behavior of the spark shell.\u003c/p\u003e\n\n\u003cp\u003eI launched the REPLs like so:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e/home/placey/Downloads/spark-2.0.0-bin-hadoop2.7/bin/spark-shell --cluster-manager local --jars /home/placey/snakeyaml-1.17.jar\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eand\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003escala -classpath \"/home/placey/snakeyaml-1.17.jar\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eScala versions are \nspark:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eUsing Scala version 2.11.8 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_55)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003escala:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eWelcome to Scala version 2.11.6 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_55).\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"40689204","answer_count":"1","comment_count":"0","creation_date":"2016-11-17 23:19:59.523 UTC","last_activity_date":"2016-11-19 04:26:14.61 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1269969","post_type_id":"1","score":"1","tags":"scala|apache-spark|javabeans","view_count":"80"} {"id":"40004453","title":"Is this number a power of two?","body":"\u003cp\u003eI have a number (in base 10) represented as a string with up to 10^6 digits. I want to check if this number is a power of two. One thing I can think of is binary search on exponents and using FFT and fast exponentiation algorithm, but it is quite long and complex to code. Let n denote the length of the input (i.e., the number of decimal digits in the input). What's the most efficient algorithm for solving this problem, as a function of n?\u003c/p\u003e","answer_count":"3","comment_count":"8","creation_date":"2016-10-12 17:07:58.207 UTC","favorite_count":"2","last_activity_date":"2016-10-14 20:00:40.82 UTC","last_edit_date":"2016-10-13 16:26:35.32 UTC","last_editor_display_name":"","last_editor_user_id":"4201961","owner_display_name":"","owner_user_id":"4201961","post_type_id":"1","score":"3","tags":"algorithm|binary","view_count":"197"} {"id":"16131358","title":"show data from multiple table order by datetime","body":"\u003cp\u003eI have a php page and want to display data from multiple tables (currently 3 tables)\u003cbr\u003e\nall tables have date-time column\u003cbr\u003e\nand other columns are totally different (in numbers \u0026amp; data-type etc)\nI want to display\u003cbr\u003e\nmost recent row from either of three tables\u003cbr\u003e\n2nd most recent row from either of three tables\u003cbr\u003e\n3rd most recent row from either of three tables\u003cbr\u003e\nand so on \u003c/p\u003e\n\n\u003cp\u003emy tables structure is like below \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eATTANDANCE [a_id,date-time,employee,attandance_more....] \n\nTASKS_ASSIGN[ta_id,date-time,employee,title,detail,duration,task_assign_more.....]\n\nTASK_COMPLETED [tc_id,date-time,employee,stars,task_completed_more....] \n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ei want to display as facebook as \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e Alam has joined office at 23-mar-2013 **08:00am** \n Haider has joined office at 23-mar-2013 **08:01am** \n Alam has completed xyz-task at 22-mar-2013 **03:45pm**\n Alam has joined office at 22-mar-2013 **10:12am**\n ......\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"16131581","answer_count":"2","comment_count":"4","creation_date":"2013-04-21 12:58:02.723 UTC","last_activity_date":"2013-04-21 13:24:37.203 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"2287589","post_type_id":"1","score":"0","tags":"php|mysql|sql-order-by","view_count":"684"} {"id":"11693666","title":"bootstrap modal dialog from another modal dialog","body":"\u003cp\u003eI am using the twitter bootstrap modal plugin and I have a modal dialog from which, on the click of a button, I want to show a smaller modal dialog.\u003c/p\u003e\n\n\u003cp\u003eWhat is happening is that my second smaller modal dialog is not really modal, because I can still access the first dialog underneath it ( click buttons select text etc..)\u003c/p\u003e\n\n\u003cp\u003eI do have the data-backdrop=\"static\" attribute setup for the second modal dialog but it does not seem to work properly.\u003c/p\u003e\n\n\u003cp\u003eIs this normal behavior ?\u003c/p\u003e","accepted_answer_id":"11693806","answer_count":"2","comment_count":"0","creation_date":"2012-07-27 18:32:21.683 UTC","favorite_count":"1","last_activity_date":"2013-03-07 19:47:29.69 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"130211","post_type_id":"1","score":"1","tags":"twitter-bootstrap|modal-dialog","view_count":"2785"} -{"id":"12692071","title":"Jenkins Amazon EC2 agent cloud - Windows slaves","body":"\u003cp\u003eI need to create Jenkins agent cloud which runs under Windows VMs on Amazon EC2.\u003c/p\u003e\n\n\u003cp\u003eMy view of this is simple scenario:\u003c/p\u003e\n\n\u003cp\u003eI have few of pre-configures AMIs, each of VM have specific environment which matches one of my projects. I have few projects to build often enough to keep VM running. But some builds will run weekly, others mounthly... Jenkins should be able to start VM automatically when project should be built and terminate VM when build is completed. I have several BCB projects and many .NET projects, Windows as slave VM OS is absolutely necessary.\u003c/p\u003e\n\n\u003cp\u003eIt is not a problem to prepare pre-configured AMI where Jenkins slave is installed and configured. But I have no idea how to manage such slave VMs from master (run/terminate them)\u003c/p\u003e\n\n\u003cp\u003eI found Amazon EC2 plugin which can be used to run and terminate VMs. But it also tries to install and run slave there. Unfortunately, windows slaves are not supported yet.\nIs there a way to use pre-configured AMIs or let Amazon EC2 plugin install agent on Windows VM?\u003c/p\u003e\n\n\u003cp\u003eI tried to use TeamCity also - it can run pre-configured windows AMI and build projects there (exact my scenario). But I need too many VMs and my boss is not ready to pay for licenses (3 free licenses are not enough)\u003c/p\u003e\n\n\u003cp\u003eIs it possible to use Jenkins for my scenario? Is it any other alternatives?\u003c/p\u003e","answer_count":"1","comment_count":"2","creation_date":"2012-10-02 14:17:35.19 UTC","favorite_count":"2","last_activity_date":"2014-06-09 19:39:20.09 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"820349","post_type_id":"1","score":"6","tags":".net|continuous-integration|jenkins|build-automation","view_count":"1089"} +{"id":"12692071","title":"Jenkins Amazon EC2 agent cloud - Windows slaves","body":"\u003cp\u003eI need to create Jenkins agent cloud which runs under Windows VMs on Amazon EC2.\u003c/p\u003e\n\n\u003cp\u003eMy view of this is simple scenario:\u003c/p\u003e\n\n\u003cp\u003eI have few of pre-configures AMIs, each of VM have specific environment which matches one of my projects. I have few projects to build often enough to keep VM running. But some builds will run weekly, others mounthly... Jenkins should be able to start VM automatically when project should be built and terminate VM when build is completed. I have several BCB projects and many .NET projects, Windows as slave VM OS is absolutely necessary.\u003c/p\u003e\n\n\u003cp\u003eIt is not a problem to prepare pre-configured AMI where Jenkins slave is installed and configured. But I have no idea how to manage such slave VMs from cluster manager (run/terminate them)\u003c/p\u003e\n\n\u003cp\u003eI found Amazon EC2 plugin which can be used to run and terminate VMs. But it also tries to install and run slave there. Unfortunately, windows slaves are not supported yet.\nIs there a way to use pre-configured AMIs or let Amazon EC2 plugin install agent on Windows VM?\u003c/p\u003e\n\n\u003cp\u003eI tried to use TeamCity also - it can run pre-configured windows AMI and build projects there (exact my scenario). But I need too many VMs and my boss is not ready to pay for licenses (3 free licenses are not enough)\u003c/p\u003e\n\n\u003cp\u003eIs it possible to use Jenkins for my scenario? Is it any other alternatives?\u003c/p\u003e","answer_count":"1","comment_count":"2","creation_date":"2012-10-02 14:17:35.19 UTC","favorite_count":"2","last_activity_date":"2014-06-09 19:39:20.09 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"820349","post_type_id":"1","score":"6","tags":".net|continuous-integration|jenkins|build-automation","view_count":"1089"} {"id":"40122967","title":"Place twilio call on hold","body":"\u003cp\u003eI have an existing softphone dialer using the php \u0026amp; javascript sdk's. It accepts \u0026amp; makes calls without problems.\u003c/p\u003e\n\n\u003cp\u003eI'm trying to add 'hold' functionality to the dialer, however every time i try to update the call's url:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e$call = $client\n -\u0026gt;calls($_REQUEST['callSid'])\n -\u0026gt;update(['url' =\u0026gt; '/hold-queue]);\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eand \u003ccode\u003e/hold-queue\u003c/code\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;Response\u0026gt;\n \u0026lt;Enqueue waitUrl=\"/hold-music\"\u0026gt;test\u0026lt;/Enqueue\u0026gt;\n\u0026lt;/Response\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe external phone is disconnected and the soft phone is placed into the queue instead.\u003c/p\u003e\n\n\u003cp\u003eEven if I dont try the \u003ccode\u003e\u0026lt;Enqueue\u0026gt;\u003c/code\u003e and use a simple \u003ccode\u003e\u0026lt;Play\u0026gt;\u003c/code\u003e tag I still have this problem.\u003c/p\u003e\n\n\u003cp\u003eI need to apply the twiml to the context of the external caller, not the soft phone.\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2016-10-19 05:35:55.017 UTC","last_activity_date":"2016-10-20 09:25:17.497 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"123429","post_type_id":"1","score":"0","tags":"javascript|php|twilio|twilio-php","view_count":"117"} {"id":"46815507","title":"Buffer is too large error despite assigning ReliableFragmented channel to Network Manager","body":"\u003cp\u003eI'm having trouble with sending an image file that's around 1.5 mb across my network. I have configured NetworkManager to use QoSType ReliableFragmented, but it's apparently not working. What am I doing wrong? Code and screenshot of NetworkManager component attached.\u003c/p\u003e\n\n\u003cp\u003eThe error I'm receving is:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eNetworkWriter WriteBytes: buffer is too large (1699064) bytes. The maximum buffer size is 64K bytes.\nUnityEngine.Networking.NetworkWriter:WriteBytesFull(Byte[])\nTextureMessage:Serialize(NetworkWriter)\nUnityEngine.Networking.NetworkServer:SendToAll(Int16, MessageBase)\nServer:SendTexture(Texture2D, String) (at Assets/Scripts/Server.cs:41)\nServer:SendOnButtonPress() (at Assets/Scripts/Server.cs:28)\nUnityEngine.EventSystems.EventSystem:Update()\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eCode to start network and serialize data\u003c/p\u003e\n\n\u003cp\u003eTextureMessage.cs\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eusing UnityEngine.Networking;\n\npublic class TextureMessage : MessageBase\n{\n public byte[] textureBytes;\n public string message; //Optional\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eMyMsgType.cs\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eusing UnityEngine.Networking;\n\npublic class MyMsgType\n{\n public static short texture = MsgType.Highest + 1;\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eServer.cs\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eusing System.Collections;\nusing System.Collections.Generic;\nusing UnityEngine;\nusing UnityEngine.Networking;\n\npublic class Server : MonoBehaviour {\n\n public Texture2D textureToSend;\n string messageToSend = \"Test Message\";\n\n // Use this for initialization\n void Start ()\n {\n NetworkManager.singleton.StartHost();\n Debug.Log(\"Server Started.\");\n }\n\n public void SendOnButtonPress()\n {\n SendTexture(textureToSend, messageToSend);\n }\n\n //Call to send the Texture and a simple string message\n public void SendTexture(Texture2D texture, string message)\n {\n TextureMessage msg = new TextureMessage();\n\n //Convert Texture2D to byte array\n\n msg.textureBytes = texture.GetRawTextureData();\n msg.message = message;\n\n NetworkServer.SendToAll(MyMsgType.texture, msg);\n }\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003ca href=\"https://i.stack.imgur.com/56hsd.jpg\" rel=\"nofollow noreferrer\"\u003e\u003cimg src=\"https://i.stack.imgur.com/56hsd.jpg\" alt=\"Network Manager Component\"\u003e\u003c/a\u003e\u003c/p\u003e","answer_count":"1","comment_count":"1","creation_date":"2017-10-18 17:00:46.573 UTC","last_activity_date":"2017-10-18 19:57:47.17 UTC","last_edit_date":"2017-10-18 18:26:40.08 UTC","last_editor_display_name":"","last_editor_user_id":"2037258","owner_display_name":"","owner_user_id":"2037258","post_type_id":"1","score":"0","tags":"c#|unity3d|networking|networkmanager","view_count":"37"} {"id":"36124515","title":"Sonarqube integration in hudson and SVN","body":"\u003cp\u003eI am trying to run sonarqube as part of a hudson job. I installed sonarqube 5.4 and sonar plugin 2.0.1 in hudson. \u003c/p\u003e\n\n\u003cp\u003eBut when the job runs I get the following error, where do I provide SVN authentication details for Sonar? \u003c/p\u003e\n\n\u003cp\u003eI already provided SVN details as part of my job but sonar is unable to read that properties.\u003c/p\u003e\n\n\u003cp\u003eCan't I make sonar to read source downloaded by hudson instead of again trying to connect to SVN?\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eFailed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.0.1:sonar (default-cli) on project MyProject: Error when executing blame for file Myfile.java: svn: E170001: Authentication required for ' Subversion repository' \n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"36127184","answer_count":"1","comment_count":"1","creation_date":"2016-03-21 06:31:26.633 UTC","last_activity_date":"2016-03-21 09:27:16.473 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"4702372","post_type_id":"1","score":"1","tags":"svn|jenkins|sonarqube|hudson|sonar-runner","view_count":"1080"} @@ -2549,7 +2549,7 @@ {"id":"16096046","title":"How to specify cx_Oracle stored function RECORD return type?","body":"\u003cpre\u003e\u003ccode\u003e CREATE OR REPLACE my_package as \n TYPE x_type IS RECORD { a_val number,\n b_val varchar2(20),\n c_val boolean }; \n FUNCTION my_func ( d number )\n RETURN x_type;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003chr\u003e\n\n\u003cp\u003eWhat should be the correct way to specify x_type in cx Oracle code?\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ecurs.callfunc('my_func', x_type, [1])\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThanks,\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2013-04-19 02:03:28.073 UTC","last_activity_date":"2013-04-19 05:00:08.593 UTC","last_edit_date":"2013-04-19 02:59:11.09 UTC","last_editor_display_name":"","last_editor_user_id":"965229","owner_display_name":"","owner_user_id":"965229","post_type_id":"1","score":"1","tags":"python|oracle|cx-oracle|stored-functions","view_count":"631"} {"id":"9884952","title":"Where to start for Jruby on rails?","body":"\u003cp\u003eAny tutorials or blog are available to start with JRuby on Rails\u003cbr\u003e\nwhich guide me to the installation and small JRuby on Rails application ?\nI have gone through this Walkthroughs And Tutorials(https://github.com/jruby/jruby/wiki/WalkthroughsAndTutorials) link but most of the JRuby on Rails links are broken. \u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2012-03-27 07:18:45.177 UTC","favorite_count":"7","last_activity_date":"2013-04-12 09:40:04.717 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"363503","post_type_id":"1","score":"5","tags":"jruby|jrubyonrails","view_count":"4100"} {"id":"44635780","title":"Function is not called in pagemethods","body":"\u003cp\u003eI have a asp .net site in which I'm using PageMethods to call a function in code-behind from a javascript event. In this case my website is configured as follows:\u003c/p\u003e\n\n\u003cp\u003e\u003ccode\u003e\u0026lt;asp:ScriptManager ID=\"ScriptManager1\" runat=\"server\" EnablePageMethods=\"true\" /\u0026gt;\u003c/code\u003e\u003c/p\u003e\n\n\u003cp\u003eThe javascript is the following\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e$(document).ready(function () {\n $('.btnLike').click(function () {\n PageMethods.update(this.id,OnSucceeded, OnFailed);\n });\n\n function OnSucceeded(response) {\n alert('Success: ' + response)\n }\n function OnFailed(error) {\n alert ('Failed: ' + error)\n }\n });\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe function in the code-behind page is the next one\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;System.Web.Services.WebMethod()\u0026gt;\n\u0026lt;System.Web.Script.Services.ScriptMethod()\u0026gt;\nPublic Shared Function update(ByVal text As String) As String\n Debug.Print(\" -- Method update() called with argument: \" \u0026amp; text)\n Return text\nEnd Function\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThis is what it is happening:\u003c/p\u003e\n\n\u003cul\u003e\n\u003cli\u003eJavascript function \u003ccode\u003e$('.btnLike').click(function ()\u003c/code\u003e is getting called\u003c/li\u003e\n\u003cli\u003eIn code-bihd the method \u003ccode\u003ePage_Load()\u003c/code\u003e is called but it never reaches the \u003ccode\u003eupdate()\u003c/code\u003e method which is the one I actually requested from the javascript\u003c/li\u003e\n\u003cli\u003eThe OnSucceed function in the javascript response for PageMethods is getting fired\u003c/li\u003e\n\u003c/ul\u003e\n\n\u003cp\u003eCan anyone help me figure out why is the method not being called?\u003c/p\u003e","answer_count":"0","comment_count":"0","creation_date":"2017-06-19 16:38:29.507 UTC","last_activity_date":"2017-06-19 16:38:29.507 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"7613143","post_type_id":"1","score":"0","tags":"javascript|asp.net|vb.net|pagemethods","view_count":"59"} -{"id":"21354656","title":"Method for converting diverse JSON files into RDBMS schema?","body":"\u003cp\u003eI have a large amount of JSON instances. I would like to store them in an RDBMS for querying. Once there they will never change, it's a data warehousing issue. I have lots of RDBMS data that I want to match the JSON data with, so it would be poor efficiency to store the JSON in a more traditional manner (e.g. couchdb).\u003c/p\u003e\n\n\u003cp\u003eFrom hunting the web, I gather that the best approach might be to create JSON schema (\u003ca href=\"http://json-schema.org/\" rel=\"nofollow\"\u003ehttp://json-schema.org/\u003c/a\u003e) files using a tool such as (\u003ca href=\"https://github.com/perenecabuto/json_schema_generator\" rel=\"nofollow\"\u003ehttps://github.com/perenecabuto/json_schema_generator\u003c/a\u003e) and then use that to build a structured RDBMS series of tables. My data is sufficiently limited in scope (minimal JSON nesting) that I could do this by hand if needed, but a tool that automatically converted from JSON schema -\u003e DB DDL statements would be great if it is our there.\u003c/p\u003e\n\n\u003cp\u003eMy question is two parted but aimed at the first issue - is there a tool or method by which I can create a master schema that describes all of my data, as many instances are missing various fields (and I have tens of gigs of json data)? The second part is with the serialization process. Does there exist a library (ideally python, I'm flexible though) that would take a schema file and a json object and output the DML to insert that into a RDBMS?\u003c/p\u003e\n\n\u003cp\u003eAll suggestions welcome!\u003c/p\u003e\n\n\u003cp\u003eChris \u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2014-01-25 18:41:14.35 UTC","last_activity_date":"2014-08-26 23:08:19.2 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"3137396","post_type_id":"1","score":"2","tags":"python|json|rdbms","view_count":"587"} +{"id":"21354656","title":"Method for converting diverse JSON files into RDBMS schema?","body":"\u003cp\u003eI have a large amount of JSON instances. I would like to store them in an RDBMS for querying. Once there they will never change, it's a data warehousing issue. I have lots of RDBMS data that I want to match the JSON data with, so it would be poor efficiency to store the JSON in a more traditional manner (e.g. couchdb).\u003c/p\u003e\n\n\u003cp\u003eFrom hunting the web, I gather that the best approach might be to create JSON schema (\u003ca href=\"http://json-schema.org/\" rel=\"nofollow\"\u003ehttp://json-schema.org/\u003c/a\u003e) files using a tool such as (\u003ca href=\"https://github.com/perenecabuto/json_schema_generator\" rel=\"nofollow\"\u003ehttps://github.com/perenecabuto/json_schema_generator\u003c/a\u003e) and then use that to build a structured RDBMS series of tables. My data is sufficiently limited in scope (minimal JSON nesting) that I could do this by hand if needed, but a tool that automatically converted from JSON schema -\u003e DB DDL statements would be great if it is our there.\u003c/p\u003e\n\n\u003cp\u003eMy question is two parted but aimed at the first issue - is there a tool or method by which I can create a cluster manager schema that describes all of my data, as many instances are missing various fields (and I have tens of gigs of json data)? The second part is with the serialization process. Does there exist a library (ideally python, I'm flexible though) that would take a schema file and a json object and output the DML to insert that into a RDBMS?\u003c/p\u003e\n\n\u003cp\u003eAll suggestions welcome!\u003c/p\u003e\n\n\u003cp\u003eChris \u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2014-01-25 18:41:14.35 UTC","last_activity_date":"2014-08-26 23:08:19.2 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"3137396","post_type_id":"1","score":"2","tags":"python|json|rdbms","view_count":"587"} {"id":"24434464","title":"Different views based on user type - Correct segue type after login?","body":"\u003cp\u003eI have a Login View Controller which is the initial view controller. Here users input their username and password, which is then sent off to the server to be checked. If the user has inputted correct credentials the server responds with some JSON data including the user type (either 'student' or 'demonstrator'). I'm using the returned user type to decide on what views the user the will see. (users will see different tab controllers)\u003c/p\u003e\n\n\u003cp\u003eThe bit I'm struggling on is on what type of segue to perform. Push or Modal? I tried embedding a navigation controller into the Login View Controller and performing a Push Segue to the correct view, but this seems to not play nice with other navigation controllers that are embedded in the other views (title's disappear etc). \u003c/p\u003e\n\n\u003cp\u003eIs the modal segue type the correct one to use in this situation? The user wont be returning back to the login screen at all. \u003c/p\u003e","accepted_answer_id":"24437916","answer_count":"1","comment_count":"0","creation_date":"2014-06-26 15:25:03.14 UTC","last_activity_date":"2014-06-26 18:45:00.98 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"273173","post_type_id":"1","score":"0","tags":"ios|xcode|ios7|xcode5|segue","view_count":"317"} {"id":"29990247","title":"Software keyboard move editTexts for android","body":"\u003cp\u003eI'm trying to get the editTexts, and sign in button to move up when the software keyboard is out however I want the background to not be compressed(I'm going to add an image soon). I have the TextView(Login), two EditTexts(email and password) and signin button in a ScrollView because I thought that might help however I have not be able to figure anything out.\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"http://i.imgur.com/vlYifc6.png\" rel=\"nofollow\"\u003ehttp://i.imgur.com/vlYifc6.png\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"http://i.imgur.com/vlYifc6.png\" rel=\"nofollow\"\u003ehttp://i.imgur.com/vlYifc6.png\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eThis is the xml\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n xmlns:tools=\"http://schemas.android.com/tools\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"match_parent\"\n android:paddingLeft=\"@dimen/activity_horizontal_margin\"\n android:paddingRight=\"@dimen/activity_horizontal_margin\"\n android:paddingTop=\"@dimen/activity_vertical_margin\"\n android:paddingBottom=\"@dimen/activity_vertical_margin\" tools:context=\".MainActivity\"\u0026gt;\n\n \u0026lt;ScrollView\n android:layout_width=\"fill_parent\"\n android:layout_height=\"wrap_content\"\n android:id=\"@+id/scrollView\"\n android:layout_centerVertical=\"true\"\n android:layout_centerHorizontal=\"true\" \u0026gt;\n\n \u0026lt;LinearLayout\n android:orientation=\"vertical\"\n android:layout_width=\"fill_parent\"\n android:layout_height=\"wrap_content\"\n android:layout_centerVertical=\"true\"\n android:layout_centerHorizontal=\"true\"\n android:gravity=\"center\"\n android:id=\"@+id/textLayout\"\u0026gt;\n\n \u0026lt;TextView\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"\n android:textAppearance=\"?android:attr/textAppearanceLarge\"\n android:text=\"Login\"\n android:id=\"@+id/loginView\"\n android:textSize=\"22dp\"\n android:layout_above=\"@+id/textLayout\"\n android:layout_centerHorizontal=\"true\" /\u0026gt;\n\n \u0026lt;EditText\n android:layout_width=\"fill_parent\"\n android:layout_height=\"wrap_content\"\n android:id=\"@+id/emailTextfield\"\n android:inputType=\"textEmailAddress\"\n android:background=\"@android:drawable/edit_text\"\n android:textColor=\"@android:color/primary_text_light\"\n android:text=\"andresc1305@yahoo.com\"\n android:hint=\"Email\" /\u0026gt;\n\n \u0026lt;EditText\n android:layout_width=\"fill_parent\"\n android:layout_height=\"wrap_content\"\n android:inputType=\"textPassword\"\n android:hint=\"Password\"\n android:text=\"Andres123\"\n android:background=\"@android:drawable/edit_text\"\n android:textColor=\"@android:color/primary_text_light\"\n android:ems=\"10\"\n android:id=\"@+id/passwordTextfield\" /\u0026gt;\n\n \u0026lt;Button\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"\n android:text=\"SIGN IN\"\n android:background=\"@android:color/transparent\"\n android:textSize=\"24dp\"\n android:id=\"@+id/signinButton\"\n android:layout_below=\"@+id/textLayout\"\n android:layout_centerHorizontal=\"true\"\n android:onClick=\"onSigninClick\"/\u0026gt;\n \u0026lt;/LinearLayout\u0026gt;\n \u0026lt;/ScrollView\u0026gt;\n\n \u0026lt;Button\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"\n android:text=\"Forgot your password?\"\n android:background=\"@android:color/transparent\"\n android:textSize=\"14dp\"\n android:id=\"@+id/forgotButton\"\n android:layout_alignParentBottom=\"true\"\n android:layout_alignParentLeft=\"true\"\n android:layout_alignParentStart=\"true\"\n android:onClick=\"onPasswordRecoverClick\"/\u0026gt;\n\n \u0026lt;Button\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"\n android:text=\"Register\"\n android:background=\"@android:color/transparent\"\n android:textSize=\"14dp\"\n android:id=\"@+id/registerButton\"\n android:layout_alignTop=\"@+id/forgotButton\"\n android:layout_alignParentRight=\"true\"\n android:layout_alignParentEnd=\"true\"\n android:onClick=\"onRegisterClick\"/\u0026gt;\n\n\n\u0026lt;/RelativeLayout\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"3","comment_count":"1","creation_date":"2015-05-01 15:49:22.237 UTC","last_activity_date":"2016-01-15 16:31:17.837 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"4813346","post_type_id":"1","score":"0","tags":"android|android-layout|keyboard|android-softkeyboard","view_count":"202"} {"id":"24191442","title":"How do I get WordPress emails working on OpenShift?","body":"\u003cp\u003eI installed WordPress using OpenShift's default package. Emails are not being sent (default welcome message and forgotten password link, new user, etc). What do I have to do to get these working?\u003c/p\u003e","accepted_answer_id":"24192686","answer_count":"1","comment_count":"0","creation_date":"2014-06-12 18:26:31.553 UTC","last_activity_date":"2014-06-12 19:39:09.477 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"225835","post_type_id":"1","score":"1","tags":"openshift","view_count":"523"} @@ -2619,7 +2619,7 @@ {"id":"29371522","title":"Set div to width and height of child image?","body":"\u003cp\u003e\u003ca href=\"http://jsfiddle.net/1tbrtoaj/1/\" rel=\"nofollow\"\u003eJSFiddle\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eI have a div with class of container. The height of this div must equal the width. I have achieved this with:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e.container{\n background-color: #e6e6e6;\n position: relative;\n}\n\n.container:before{\n content: \"\";\n display: block;\n padding-top: 100%;\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eInside the container is an image holder, and inside this an image. The image must be constrained, it's height or width must not exceed the container and still maintain aspect ratio. This is achieved by:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eimg{\n position: absolute;\n top: 0;\n left: 0;\n bottom: 0;\n right: 0;\n\n max-height: 100%; \n max-width: 100%; \n width: auto;\n height: auto;\n\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eMy question concerns the image holder, I need this to be the same width and height as the image that is inside of it. How can I do this? Using CSS only please.\u003c/p\u003e","answer_count":"1","comment_count":"3","creation_date":"2015-03-31 14:47:22.257 UTC","last_activity_date":"2015-03-31 15:18:07.067 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1013512","post_type_id":"1","score":"0","tags":"css|css3","view_count":"949"} {"id":"43474378","title":"Problems with \"Team Foundation Server is not your current Source Control plug-in\" when I try to start a new project in VS2017","body":"\u003cp\u003eI am new to Visual Studio 2017 and VSTS.\nFrom my VSTS page I choose to create a new application and clone it in Visual Studio.\nWhen I do this it launches Visual Studio. But then I get these error messages. How do I fix this?\n\u003ca href=\"https://i.stack.imgur.com/4XWt1.png\" rel=\"nofollow noreferrer\"\u003e\u003cimg src=\"https://i.stack.imgur.com/4XWt1.png\" alt=\"enter image description here\"\u003e\u003c/a\u003e\u003c/p\u003e","accepted_answer_id":"43486003","answer_count":"2","comment_count":"1","creation_date":"2017-04-18 14:01:04.477 UTC","last_activity_date":"2017-06-12 08:20:40.51 UTC","last_edit_date":"2017-04-18 14:16:49.017 UTC","last_editor_display_name":"","last_editor_user_id":"125673","owner_display_name":"","owner_user_id":"125673","post_type_id":"1","score":"0","tags":"git|visual-studio|vsts","view_count":"652"} {"id":"21687487","title":"Hide data, process to new div with each function","body":"\u003cp\u003eI have multiple same class divs that produce an array and a script that puts them into lists.\u003cbr\u003e\nI would like to hide a JSON array object from briefly flashing (unprocessed) on the page before the script can process it into lists.\u003c/p\u003e\n\n\u003cp\u003eSo I put them into a hidden div and the each function stops working.\u003c/p\u003e\n\n\u003cp\u003eThe .hid divs actually contain:\u003cbr\u003e\n\u003ccode\u003e\u0026lt;%=getCurrentAttribute('item','lists')%\u0026gt;\u003c/code\u003e that produce the JSON array.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;div class=\"hid\" style=\"display:none;\"\u0026gt;[{\"k\":\"Model\",\"v\":\"AB\"},{\"k\":\"Color\",\"v\":\"green\"}]\u0026lt;/div\u0026gt;\n\u0026lt;div class=\"overview\"\u0026gt;\u0026lt;/div\u0026gt;\n\u0026lt;div class=\"hid\" style=\"display:none;\"\u0026gt;[{\"k\":\"Model\",\"v\":\"AC\"},{\"k\":\"Color\",\"v\":\"blue\"}]\u0026lt;/div\u0026gt;\n\u0026lt;div class=\"overview\"\u0026gt;\u0026lt;/div\u0026gt;\n\u0026lt;div class=\"hid\" style=\"display:none;\"\u0026gt;[{\"k\":\"Model\",\"v\":\"AD\"},{\"k\":\"Color\",\"v\":\"red\"}]\u0026lt;/div\u0026gt;\n\u0026lt;div class=\"overview\"\u0026gt;\u0026lt;/div\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eMy script\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ejQuery('.hid').each(function () {\n var $data = jQuery(this), spec,\n specs = jQuery.parseJSON($data.html());\n jQuery(\".overview\").html('\u0026lt;div class=\"bullet_spec\"\u0026gt;\u0026lt;/div\u0026gt;');\n jQuery.each(specs, function () {\n jQuery(\".overview\").children('div').append('\u0026lt;div class=\"specs\"\u0026gt;\u0026lt;span class=\"label\"\u0026gt;' + this.k + ':\u0026lt;/span\u0026gt;\u0026lt;span class=\"value\"\u0026gt; ' + this.v + '\u0026lt;/span\u0026gt;\u0026lt;/div\u0026gt;');\n });\n { \n }\n});\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003ca href=\"http://jsfiddle.net/Qta2p/\" rel=\"nofollow\"\u003ehttp://jsfiddle.net/Qta2p/\u003c/a\u003e\u003c/p\u003e","answer_count":"0","comment_count":"3","creation_date":"2014-02-10 20:43:18.733 UTC","last_activity_date":"2014-02-10 21:46:41.487 UTC","last_edit_date":"2014-02-10 21:46:41.487 UTC","last_editor_display_name":"","last_editor_user_id":"369450","owner_display_name":"","owner_user_id":"2430319","post_type_id":"1","score":"0","tags":"javascript|jquery|arrays|json|each","view_count":"95"} -{"id":"42201046","title":"How to configure the publish address of opensearch 5.0 with CLI flags?","body":"\u003cp\u003eI've used opensearch 2.0 with start up flags to configure the publish_addres. I need the publish address to be configured, because I want to start opensearch in a docker container and access it from outside. So the publish address must be the IP of the docker host, which is in my case 192.168.99.100. I want to access opensearch on port 9201.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003edocker run -d -p 9201:9201 --name opensearch_test opensearch:5.2-alpine opensearch -Enetwork.publish_host=\"192.168.99.100\" -Ehttp.port=\"9201\"\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ewhich is like the old command\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003edocker run -d -p 9201:9201 --name opensearch_test opensearch:2.4.1 opensearch -Des.network.publish_host=\"192.168.99.100\" -Des.http.port=\"9201\"\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eBut when I start the container and look into the logs I don't get the publish address 192.168.99.100:9201, but 192.168.99.100:9300 and 172.17.0.2:9201. How can I force opensearch to use my combination of address and port?\u003c/p\u003e\n\n\u003cp\u003eThanks in advance\u003c/p\u003e\n\n\u003cp\u003eOutput of \u003ccode\u003edocker logs opensearch_test\u003c/code\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e[2017-02-13T09:17:03,095][INFO ][o.e.n.Node ] [] initializing ...\n[2017-02-13T09:17:03,252][INFO ][o.e.e.NodeEnvironment ] [ntIFoHQ] using [1] data paths, mounts [[/usr/share/opensearch/data (/dev/sda1)]], net usable_space [1gb], net total_space [17.8gb], spins? [possibly], types [ext4]\n[2017-02-13T09:17:03,252][INFO ][o.e.e.NodeEnvironment ] [ntIFoHQ] heap size [1.9gb], compressed ordinary object pointers [true]\n[2017-02-13T09:17:03,253][INFO ][o.e.n.Node ] node name [ntIFoHQ] derived from node ID [ntIFoHQnTAahC7_0cEt32Q]; set [node.name] to override\n[2017-02-13T09:17:03,257][INFO ][o.e.n.Node ] version[5.2.0], pid[1], build[24e05b9/2017-01-24T19:52:35.800Z], OS[Linux/4.4.43-boot2docker/amd64], JVM[Oracle Corporation/OpenJDK 64-Bit Server VM/1.8.0_111-internal/25.111-b14]\n[2017-02-13T09:17:05,249][INFO ][o.e.p.PluginsService ] [ntIFoHQ] loaded module [aggs-matrix-stats]\n[2017-02-13T09:17:05,250][INFO ][o.e.p.PluginsService ] [ntIFoHQ] loaded module [ingest-common]\n[2017-02-13T09:17:05,251][INFO ][o.e.p.PluginsService ] [ntIFoHQ] loaded module [lang-expression]\n[2017-02-13T09:17:05,251][INFO ][o.e.p.PluginsService ] [ntIFoHQ] loaded module [lang-groovy]\n[2017-02-13T09:17:05,251][INFO ][o.e.p.PluginsService ] [ntIFoHQ] loaded module [lang-mustache]\n[2017-02-13T09:17:05,251][INFO ][o.e.p.PluginsService ] [ntIFoHQ] loaded module [lang-painless]\n[2017-02-13T09:17:05,251][INFO ][o.e.p.PluginsService ] [ntIFoHQ] loaded module [percolator]\n[2017-02-13T09:17:05,251][INFO ][o.e.p.PluginsService ] [ntIFoHQ] loaded module [reindex]\n[2017-02-13T09:17:05,254][INFO ][o.e.p.PluginsService ] [ntIFoHQ] loaded module [transport-netty3]\n[2017-02-13T09:17:05,254][INFO ][o.e.p.PluginsService ] [ntIFoHQ] loaded module [transport-netty4]\n[2017-02-13T09:17:05,254][INFO ][o.e.p.PluginsService ] [ntIFoHQ] no plugins loaded\n[2017-02-13T09:17:05,677][WARN ][o.e.d.s.g.GroovyScriptEngineService] [groovy] scripts are deprecated, use [painless] scripts instead\n[2017-02-13T09:17:10,757][INFO ][o.e.n.Node ] initialized\n[2017-02-13T09:17:10,757][INFO ][o.e.n.Node ] [ntIFoHQ] starting ...\n[2017-02-13T09:17:11,015][WARN ][i.n.u.i.MacAddressUtil ] Failed to find a usable hardware address from the network interfaces; using random bytes: 07:0a:ef:37:62:95:b2:77\n[2017-02-13T09:17:11,198][INFO ][o.e.t.TransportService ] [ntIFoHQ] publish_address {192.168.99.100:9300}, bound_addresses {[::1]:9300}, {127.0.0.1:9300}\n[2017-02-13T09:17:11,203][INFO ][o.e.b.BootstrapChecks ] [ntIFoHQ] bound or publishing to a non-loopback or non-link-local address, enforcing bootstrap checks\n[2017-02-13T09:17:14,351][INFO ][o.e.c.s.ClusterService ] [ntIFoHQ] new_master {ntIFoHQ}{ntIFoHQnTAahC7_0cEt32Q}{cW1MZt0-RmutLXz_Tkm8mw}{192.168.99.100}{192.168.99.100:9300}, reason: zen-disco-elected-as-master ([0] nodes joined)\n[2017-02-13T09:17:14,395][INFO ][o.e.h.HttpServer ] [ntIFoHQ] publish_address {172.17.0.2:9201}, bound_addresses {[::]:9201}\n[2017-02-13T09:17:14,396][INFO ][o.e.n.Node ] [ntIFoHQ] started\n[2017-02-13T09:17:14,423][INFO ][o.e.g.GatewayService ] [ntIFoHQ] recovered [0] indices into cluster_state\n[2017-02-13T09:17:44,398][WARN ][o.e.c.r.a.DiskThresholdMonitor] [ntIFoHQ] high disk watermark [90%] exceeded on [ntIFoHQnTAahC7_0cEt32Q][ntIFoHQ][/usr/share/opensearch/data/nodes/0] free: 1gb[5.7%], shards will be relocated away from this node\n[2017-02-13T09:17:44,398][INFO ][o.e.c.r.a.DiskThresholdMonitor] [ntIFoHQ] rerouting shards: [high disk watermark exceeded on one or more nodes]\n[2017-02-13T09:18:14,434][WARN ][o.e.c.r.a.DiskThresholdMonitor] [ntIFoHQ] high disk watermark [90%] exceeded on [ntIFoHQnTAahC7_0cEt32Q][ntIFoHQ][/usr/share/opensearch/data/nodes/0] free: 1gb[5.7%], shards will be relocated away from this node\n[2017-02-13T09:18:44,438][WARN ][o.e.c.r.a.DiskThresholdMonitor] [ntIFoHQ] high disk watermark [90%] exceeded on [ntIFoHQnTAahC7_0cEt32Q][ntIFoHQ][/usr/share/opensearch/data/nodes/0] free: 1gb[5.7%], shards will be relocated away from this node\n[2017-02-13T09:18:44,438][INFO ][o.e.c.r.a.DiskThresholdMonitor] [ntIFoHQ] rerouting shards: [high disk watermark exceeded on one or more nodes]\n[2017-02-13T09:19:14,443][WARN ][o.e.c.r.a.DiskThresholdMonitor] [ntIFoHQ] high disk watermark [90%] exceeded on [ntIFoHQnTAahC7_0cEt32Q][ntIFoHQ][/usr/share/opensearch/data/nodes/0] free: 1gb[5.7%], shards will be relocated away from this node\n[2017-02-13T09:19:44,446][WARN ][o.e.c.r.a.DiskThresholdMonitor] [ntIFoHQ] high disk watermark [90%] exceeded on [ntIFoHQnTAahC7_0cEt32Q][ntIFoHQ][/usr/share/opensearch/data/nodes/0] free: 1gb[5.7%], shards will be relocated away from this node\n[2017-02-13T09:19:44,447][INFO ][o.e.c.r.a.DiskThresholdMonitor] [ntIFoHQ] rerouting shards: [high disk watermark exceeded on one or more nodes]\n[2017-02-13T09:20:14,453][WARN ][o.e.c.r.a.DiskThresholdMonitor] [ntIFoHQ] high disk watermark [90%] exceeded on [ntIFoHQnTAahC7_0cEt32Q][ntIFoHQ][/usr/share/opensearch/data/nodes/0] free: 1gb[5.7%], shards will be relocated away from this node\n[2017-02-13T09:20:44,459][WARN ][o.e.c.r.a.DiskThresholdMonitor] [ntIFoHQ] high disk watermark [90%] exceeded on [ntIFoHQnTAahC7_0cEt32Q][ntIFoHQ][/usr/share/opensearch/data/nodes/0] free: 1gb[5.7%], shards will be relocated away from this node\n[2017-02-13T09:20:44,459][INFO ][o.e.c.r.a.DiskThresholdMonitor] [ntIFoHQ] rerouting shards: [high disk watermark exceeded on one or more nodes]\n[2017-02-13T09:21:14,467][WARN ][o.e.c.r.a.DiskThresholdMonitor] [ntIFoHQ] high disk watermark [90%] exceeded on [ntIFoHQnTAahC7_0cEt32Q][ntIFoHQ][/usr/share/opensearch/data/nodes/0] free: 1gb[5.7%], shards will be relocated away from this node\n[2017-02-13T09:21:44,471][WARN ][o.e.c.r.a.DiskThresholdMonitor] [ntIFoHQ] high disk watermark [90%] exceeded on [ntIFoHQnTAahC7_0cEt32Q][ntIFoHQ][/usr/share/opensearch/data/nodes/0] free: 1gb[5.7%], shards will be relocated away from this node\n[2017-02-13T09:21:44,471][INFO ][o.e.c.r.a.DiskThresholdMonitor] [ntIFoHQ] rerouting shards: [high disk watermark exceeded on one or more nodes]\n[2017-02-13T09:22:14,482][WARN ][o.e.c.r.a.DiskThresholdMonitor] [ntIFoHQ] high disk watermark [90%] exceeded on [ntIFoHQnTAahC7_0cEt32Q][ntIFoHQ][/usr/share/opensearch/data/nodes/0] free: 1gb[5.7%], shards will be relocated away from this node\n[2017-02-13T09:22:44,485][WARN ][o.e.c.r.a.DiskThresholdMonitor] [ntIFoHQ] high disk watermark [90%] exceeded on [ntIFoHQnTAahC7_0cEt32Q][ntIFoHQ][/usr/share/opensearch/data/nodes/0] free: 1gb[5.7%], shards will be relocated away from this node\n[2017-02-13T09:22:44,485][INFO ][o.e.c.r.a.DiskThresholdMonitor] [ntIFoHQ] rerouting shards: [high disk watermark exceeded on one or more nodes]\n[2017-02-13T09:23:14,497][WARN ][o.e.c.r.a.DiskThresholdMonitor] [ntIFoHQ] high disk watermark [90%] exceeded on [ntIFoHQnTAahC7_0cEt32Q][ntIFoHQ][/usr/share/opensearch/data/nodes/0] free: 1gb[5.7%], shards will be relocated away from this node\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"1","comment_count":"0","creation_date":"2017-02-13 09:48:55.953 UTC","last_activity_date":"2017-09-19 11:57:56.39 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"2000569","post_type_id":"1","score":"2","tags":"opensearch|docker|opensearch-5","view_count":"211"} +{"id":"42201046","title":"How to configure the publish address of opensearch 5.0 with CLI flags?","body":"\u003cp\u003eI've used opensearch 2.0 with start up flags to configure the publish_addres. I need the publish address to be configured, because I want to start opensearch in a docker container and access it from outside. So the publish address must be the IP of the docker host, which is in my case 192.168.99.100. I want to access opensearch on port 9201.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003edocker run -d -p 9201:9201 --name opensearch_test opensearch:5.2-alpine opensearch -Enetwork.publish_host=\"192.168.99.100\" -Ehttp.port=\"9201\"\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ewhich is like the old command\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003edocker run -d -p 9201:9201 --name opensearch_test opensearch:2.4.1 opensearch -Des.network.publish_host=\"192.168.99.100\" -Des.http.port=\"9201\"\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eBut when I start the container and look into the logs I don't get the publish address 192.168.99.100:9201, but 192.168.99.100:9300 and 172.17.0.2:9201. How can I force opensearch to use my combination of address and port?\u003c/p\u003e\n\n\u003cp\u003eThanks in advance\u003c/p\u003e\n\n\u003cp\u003eOutput of \u003ccode\u003edocker logs opensearch_test\u003c/code\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e[2017-02-13T09:17:03,095][INFO ][o.e.n.Node ] [] initializing ...\n[2017-02-13T09:17:03,252][INFO ][o.e.e.NodeEnvironment ] [ntIFoHQ] using [1] data paths, mounts [[/usr/share/opensearch/data (/dev/sda1)]], net usable_space [1gb], net total_space [17.8gb], spins? [possibly], types [ext4]\n[2017-02-13T09:17:03,252][INFO ][o.e.e.NodeEnvironment ] [ntIFoHQ] heap size [1.9gb], compressed ordinary object pointers [true]\n[2017-02-13T09:17:03,253][INFO ][o.e.n.Node ] node name [ntIFoHQ] derived from node ID [ntIFoHQnTAahC7_0cEt32Q]; set [node.name] to override\n[2017-02-13T09:17:03,257][INFO ][o.e.n.Node ] version[5.2.0], pid[1], build[24e05b9/2017-01-24T19:52:35.800Z], OS[Linux/4.4.43-boot2docker/amd64], JVM[Oracle Corporation/OpenJDK 64-Bit Server VM/1.8.0_111-internal/25.111-b14]\n[2017-02-13T09:17:05,249][INFO ][o.e.p.PluginsService ] [ntIFoHQ] loaded module [aggs-matrix-stats]\n[2017-02-13T09:17:05,250][INFO ][o.e.p.PluginsService ] [ntIFoHQ] loaded module [ingest-common]\n[2017-02-13T09:17:05,251][INFO ][o.e.p.PluginsService ] [ntIFoHQ] loaded module [lang-expression]\n[2017-02-13T09:17:05,251][INFO ][o.e.p.PluginsService ] [ntIFoHQ] loaded module [lang-groovy]\n[2017-02-13T09:17:05,251][INFO ][o.e.p.PluginsService ] [ntIFoHQ] loaded module [lang-mustache]\n[2017-02-13T09:17:05,251][INFO ][o.e.p.PluginsService ] [ntIFoHQ] loaded module [lang-painless]\n[2017-02-13T09:17:05,251][INFO ][o.e.p.PluginsService ] [ntIFoHQ] loaded module [percolator]\n[2017-02-13T09:17:05,251][INFO ][o.e.p.PluginsService ] [ntIFoHQ] loaded module [reindex]\n[2017-02-13T09:17:05,254][INFO ][o.e.p.PluginsService ] [ntIFoHQ] loaded module [transport-netty3]\n[2017-02-13T09:17:05,254][INFO ][o.e.p.PluginsService ] [ntIFoHQ] loaded module [transport-netty4]\n[2017-02-13T09:17:05,254][INFO ][o.e.p.PluginsService ] [ntIFoHQ] no plugins loaded\n[2017-02-13T09:17:05,677][WARN ][o.e.d.s.g.GroovyScriptEngineService] [groovy] scripts are deprecated, use [painless] scripts instead\n[2017-02-13T09:17:10,757][INFO ][o.e.n.Node ] initialized\n[2017-02-13T09:17:10,757][INFO ][o.e.n.Node ] [ntIFoHQ] starting ...\n[2017-02-13T09:17:11,015][WARN ][i.n.u.i.MacAddressUtil ] Failed to find a usable hardware address from the network interfaces; using random bytes: 07:0a:ef:37:62:95:b2:77\n[2017-02-13T09:17:11,198][INFO ][o.e.t.TransportService ] [ntIFoHQ] publish_address {192.168.99.100:9300}, bound_addresses {[::1]:9300}, {127.0.0.1:9300}\n[2017-02-13T09:17:11,203][INFO ][o.e.b.BootstrapChecks ] [ntIFoHQ] bound or publishing to a non-loopback or non-link-local address, enforcing bootstrap checks\n[2017-02-13T09:17:14,351][INFO ][o.e.c.s.ClusterService ] [ntIFoHQ] new_cluster_manager {ntIFoHQ}{ntIFoHQnTAahC7_0cEt32Q}{cW1MZt0-RmutLXz_Tkm8mw}{192.168.99.100}{192.168.99.100:9300}, reason: zen-disco-elected-as-cluster-manager ([0] nodes joined)\n[2017-02-13T09:17:14,395][INFO ][o.e.h.HttpServer ] [ntIFoHQ] publish_address {172.17.0.2:9201}, bound_addresses {[::]:9201}\n[2017-02-13T09:17:14,396][INFO ][o.e.n.Node ] [ntIFoHQ] started\n[2017-02-13T09:17:14,423][INFO ][o.e.g.GatewayService ] [ntIFoHQ] recovered [0] indices into cluster_state\n[2017-02-13T09:17:44,398][WARN ][o.e.c.r.a.DiskThresholdMonitor] [ntIFoHQ] high disk watermark [90%] exceeded on [ntIFoHQnTAahC7_0cEt32Q][ntIFoHQ][/usr/share/opensearch/data/nodes/0] free: 1gb[5.7%], shards will be relocated away from this node\n[2017-02-13T09:17:44,398][INFO ][o.e.c.r.a.DiskThresholdMonitor] [ntIFoHQ] rerouting shards: [high disk watermark exceeded on one or more nodes]\n[2017-02-13T09:18:14,434][WARN ][o.e.c.r.a.DiskThresholdMonitor] [ntIFoHQ] high disk watermark [90%] exceeded on [ntIFoHQnTAahC7_0cEt32Q][ntIFoHQ][/usr/share/opensearch/data/nodes/0] free: 1gb[5.7%], shards will be relocated away from this node\n[2017-02-13T09:18:44,438][WARN ][o.e.c.r.a.DiskThresholdMonitor] [ntIFoHQ] high disk watermark [90%] exceeded on [ntIFoHQnTAahC7_0cEt32Q][ntIFoHQ][/usr/share/opensearch/data/nodes/0] free: 1gb[5.7%], shards will be relocated away from this node\n[2017-02-13T09:18:44,438][INFO ][o.e.c.r.a.DiskThresholdMonitor] [ntIFoHQ] rerouting shards: [high disk watermark exceeded on one or more nodes]\n[2017-02-13T09:19:14,443][WARN ][o.e.c.r.a.DiskThresholdMonitor] [ntIFoHQ] high disk watermark [90%] exceeded on [ntIFoHQnTAahC7_0cEt32Q][ntIFoHQ][/usr/share/opensearch/data/nodes/0] free: 1gb[5.7%], shards will be relocated away from this node\n[2017-02-13T09:19:44,446][WARN ][o.e.c.r.a.DiskThresholdMonitor] [ntIFoHQ] high disk watermark [90%] exceeded on [ntIFoHQnTAahC7_0cEt32Q][ntIFoHQ][/usr/share/opensearch/data/nodes/0] free: 1gb[5.7%], shards will be relocated away from this node\n[2017-02-13T09:19:44,447][INFO ][o.e.c.r.a.DiskThresholdMonitor] [ntIFoHQ] rerouting shards: [high disk watermark exceeded on one or more nodes]\n[2017-02-13T09:20:14,453][WARN ][o.e.c.r.a.DiskThresholdMonitor] [ntIFoHQ] high disk watermark [90%] exceeded on [ntIFoHQnTAahC7_0cEt32Q][ntIFoHQ][/usr/share/opensearch/data/nodes/0] free: 1gb[5.7%], shards will be relocated away from this node\n[2017-02-13T09:20:44,459][WARN ][o.e.c.r.a.DiskThresholdMonitor] [ntIFoHQ] high disk watermark [90%] exceeded on [ntIFoHQnTAahC7_0cEt32Q][ntIFoHQ][/usr/share/opensearch/data/nodes/0] free: 1gb[5.7%], shards will be relocated away from this node\n[2017-02-13T09:20:44,459][INFO ][o.e.c.r.a.DiskThresholdMonitor] [ntIFoHQ] rerouting shards: [high disk watermark exceeded on one or more nodes]\n[2017-02-13T09:21:14,467][WARN ][o.e.c.r.a.DiskThresholdMonitor] [ntIFoHQ] high disk watermark [90%] exceeded on [ntIFoHQnTAahC7_0cEt32Q][ntIFoHQ][/usr/share/opensearch/data/nodes/0] free: 1gb[5.7%], shards will be relocated away from this node\n[2017-02-13T09:21:44,471][WARN ][o.e.c.r.a.DiskThresholdMonitor] [ntIFoHQ] high disk watermark [90%] exceeded on [ntIFoHQnTAahC7_0cEt32Q][ntIFoHQ][/usr/share/opensearch/data/nodes/0] free: 1gb[5.7%], shards will be relocated away from this node\n[2017-02-13T09:21:44,471][INFO ][o.e.c.r.a.DiskThresholdMonitor] [ntIFoHQ] rerouting shards: [high disk watermark exceeded on one or more nodes]\n[2017-02-13T09:22:14,482][WARN ][o.e.c.r.a.DiskThresholdMonitor] [ntIFoHQ] high disk watermark [90%] exceeded on [ntIFoHQnTAahC7_0cEt32Q][ntIFoHQ][/usr/share/opensearch/data/nodes/0] free: 1gb[5.7%], shards will be relocated away from this node\n[2017-02-13T09:22:44,485][WARN ][o.e.c.r.a.DiskThresholdMonitor] [ntIFoHQ] high disk watermark [90%] exceeded on [ntIFoHQnTAahC7_0cEt32Q][ntIFoHQ][/usr/share/opensearch/data/nodes/0] free: 1gb[5.7%], shards will be relocated away from this node\n[2017-02-13T09:22:44,485][INFO ][o.e.c.r.a.DiskThresholdMonitor] [ntIFoHQ] rerouting shards: [high disk watermark exceeded on one or more nodes]\n[2017-02-13T09:23:14,497][WARN ][o.e.c.r.a.DiskThresholdMonitor] [ntIFoHQ] high disk watermark [90%] exceeded on [ntIFoHQnTAahC7_0cEt32Q][ntIFoHQ][/usr/share/opensearch/data/nodes/0] free: 1gb[5.7%], shards will be relocated away from this node\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"1","comment_count":"0","creation_date":"2017-02-13 09:48:55.953 UTC","last_activity_date":"2017-09-19 11:57:56.39 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"2000569","post_type_id":"1","score":"2","tags":"opensearch|docker|opensearch-5","view_count":"211"} {"id":"14044046","title":"Echo \"part\" of array (decoded from JSON)","body":"\u003cp\u003eI'am quite new to JSON and more \"advanced\" arrays. Therefore I don't know what I should search for...\u003c/p\u003e\n\n\u003cp\u003eI have this \"JSON array\" (what do you call it?):\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e{\n \"id\": \"321123321\",\n \"statuses\": {\n \"data\": [\n {\n \"message\": \"testmessage\",\n \"updated_time\": \"2012-12-25T16:33:29+0000\",\n \"id\": \"123321123\"\n }\n ],\n \"paging\": {\n \"previous\": \"1\",\n \"next\": \"1\"\n }\n }\n}​\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI want to create a variable from \"message\" that is called $message and a variable from \"up_datedtime\" that is called $updated.\u003c/p\u003e\n\n\u003cp\u003eTo get id I simple:\n$json_a=json_decode($string,true);\n$id $json_a['id'];\u003c/p\u003e\n\n\u003cp\u003eAnd for statuses: \n$json_a=json_decode($string,true);\n$status = $json_a['id']['statuses'];\u003c/p\u003e\n\n\u003cp\u003eBut when I try to get \"message\" I get \" Cannot use string offset as an array in\":\n $message = $json_a['id']['statuses']['data']['message'];\u003c/p\u003e\n\n\u003cp\u003eHow do I get $message from the array the proper way?\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2012-12-26 17:38:14.877 UTC","last_activity_date":"2012-12-26 17:47:45.887 UTC","last_edit_date":"2012-12-26 17:42:42.623 UTC","last_editor_display_name":"","last_editor_user_id":"1353011","owner_display_name":"","owner_user_id":"1930152","post_type_id":"1","score":"0","tags":"arrays|echo","view_count":"82"} {"id":"32348574","title":"How to calculate the sum of variables in PHP","body":"\u003cp\u003eIt calculates, but starting from the second row.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;?php\ninclude('connect-db.php');\n$query = \"select * from users\";\n$result = mysql_query($query); \n$row = mysql_fetch_array($result);\n$sold= array();\n\nwhile ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { \n $sold=$row['contract']+$row['tva'];\n echo \"\u0026lt;table\u0026gt;\u0026lt;tr\u0026gt;\u0026lt;td\u0026gt;\" . $sold. \"\u0026lt;/td\u0026gt;\u0026lt;/tr\u0026gt;\u0026lt;/table\u0026gt;\";\n}\n?\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"32348651","answer_count":"3","comment_count":"1","creation_date":"2015-09-02 08:47:52.72 UTC","last_activity_date":"2015-09-02 09:06:09.85 UTC","last_edit_date":"2015-09-02 08:55:02.337 UTC","last_editor_display_name":"","last_editor_user_id":"2613662","owner_display_name":"","owner_user_id":"5291684","post_type_id":"1","score":"0","tags":"php|mysql","view_count":"110"} {"id":"46235057","title":"pandas DF column max difference between pair of values recursively","body":"\u003cp\u003eI have a DataFrame with a column 'col1' with integers in it.\nThe DF may have anything from 100 up to 1mln rows.\nHow to compute difference between pair of values in the col1 such as:\u003c/p\u003e\n\n\u003cp\u003erow2 - row1\nrow3 - row2\nrow4 - row3\netc\u003c/p\u003e\n\n\u003cp\u003eand return max difference? \u003c/p\u003e\n\n\u003cp\u003eI know how to use loc, iloc but do not know how to force it to go through pair of values and move to next pair\u003c/p\u003e","answer_count":"1","comment_count":"4","creation_date":"2017-09-15 08:28:10.18 UTC","last_activity_date":"2017-09-15 13:02:47.253 UTC","last_edit_date":"2017-09-15 09:23:21.173 UTC","last_editor_display_name":"","last_editor_user_id":"8144295","owner_display_name":"","owner_user_id":"5892612","post_type_id":"1","score":"0","tags":"python|pandas|dataframe|difference","view_count":"111"} @@ -2657,7 +2657,7 @@ {"id":"45192937","title":"Disadvantages of api extension with predefined (enumerated) option list instead of individual arguments","body":"\u003cp\u003eI currently need to extend a function's API that is very often used in my aplication with a new (boolean) parameter. I also foresee that, as more features are added to the program, the same function may (not yet certain) need more functionality, that (if needed) can be controled by boolean parameters. The extra functionality will only be needed by new function calls, not by the existing ones.\u003c/p\u003e\n\n\u003cp\u003eSo, to simplify its extension in the future, I plan on adding two or tree extra enumerated parameters to its API, so that new features can be added without chasing and editing all fuction calls everytime something is added. So, instead of extending to this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003efunction(currparams..., bool option1, bool option2, bool option3, bool option4);\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eIt would extend to this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003etypedef enum{\n noopt,\n opt1,\n opt2,\n opt3,\n ...\n}APIoptions;\n\nfunction(currparams..., APIoptions option1, APIoptions option2);\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAs long as the enumerated arguments I add now are enough for the future needs, this should make extending the API easier. However I don't recall seing this type of programming in the wild and would like to understand its disadvantages and potential problems and why it wouldn't be more often used.\u003c/p\u003e\n\n\u003cp\u003eThanks in advance.\u003c/p\u003e","accepted_answer_id":"45193798","answer_count":"2","comment_count":"2","creation_date":"2017-07-19 14:02:16.653 UTC","last_activity_date":"2017-07-19 15:53:37.17 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"3456599","post_type_id":"1","score":"1","tags":"c++|c|api-design","view_count":"52"} {"id":"29209417","title":"How to display two plot in a specific position with Matlab","body":"\u003cp\u003e\u003cimg src=\"https://i.stack.imgur.com/rFRKt.png\" alt=\"Example of the result\"\u003e\u003c/p\u003e\n\n\u003cp\u003eHi to all,\u003c/p\u003e\n\n\u003cp\u003eWhen I run a Matlab code which generate two plot, these are overplotted (the second over the first).\u003c/p\u003e\n\n\u003cp\u003eI would like obtain a result as this figure, where the two plots are like in a \u003ccode\u003esubplot(211)\u003c/code\u003e and \u003ccode\u003esubplot(212)\u003c/code\u003e, the first and the second in two colons, but without using \u003ccode\u003esubplot\u003c/code\u003e.\u003c/p\u003e\n\n\u003cp\u003eIt is possible?\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eUPDATE\u003c/strong\u003e\u003c/p\u003e\n\n\u003cp\u003eI generate this two plot with two subfuncion:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003efunction create_figure(X1, YMatrix1, p)\n%CREATE_FIGURE(X1, YMATRIX1)\n% X1: vector of x data\n% YMATRIX1: matrix of y data\n% P: parameters used in legend\n\n% Create figure\nfigure1 = figure('Name','Acceleration Power vs. Velocity LPF 1st order');\n...\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eand\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003efunction create_figure_gamma(X1, YMatrix1, p)\n%CREATE_FIGURE_GAMMA(X1, YMATRIX1, P)\n% X1: vector of x data\n% YMATRIX1: matrix of y data\n% P: parameters used in legend\n\n% Create figure\nfigure1 = figure('Name','gamma trend vs. Velocity');\n...\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eOf course, I can give in output the parameter \u003ccode\u003efigure1\u003c/code\u003e, writing:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003efunction figure1 = create_figure(X1, YMatrix1, p)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI think that which this parameter is possible set the position of the two plots, but I do not know the procedure respect the generic window size.\u003c/p\u003e","accepted_answer_id":"29210678","answer_count":"2","comment_count":"1","creation_date":"2015-03-23 11:45:59.077 UTC","last_activity_date":"2015-03-23 12:49:33.347 UTC","last_edit_date":"2015-03-23 12:13:43.55 UTC","last_editor_display_name":"","last_editor_user_id":"2314915","owner_display_name":"","owner_user_id":"2314915","post_type_id":"1","score":"0","tags":"matlab|plot|matlab-figure","view_count":"114"} {"id":"44181462","title":"Can I use ReportPortal with nightwatchjs?","body":"\u003cp\u003eCan I use ReportPortal with nightwatchjs + mocha?\nIf someone has experience, then tell in details please!\nP.s.: Now for reporting I use mochawesome-report-generator.\u003c/p\u003e","answer_count":"2","comment_count":"0","creation_date":"2017-05-25 13:10:51.99 UTC","last_activity_date":"2017-06-14 16:12:47.003 UTC","last_edit_date":"2017-05-25 14:11:13.973 UTC","last_editor_display_name":"","last_editor_user_id":"7787841","owner_display_name":"","owner_user_id":"7787841","post_type_id":"1","score":"0","tags":"reportportal","view_count":"30"} -{"id":"37614239","title":"How to update angular 1.2 service to 1.5 in angular 2 style","body":"\u003cp\u003e\u003ca href=\"https://github.com/snapjay/ngCart/blob/master/src/ngCart.js#L30\" rel=\"nofollow\"\u003ehttps://github.com/snapjay/ngCart/blob/master/src/ngCart.js#L30\u003c/a\u003e\nI need to update this repo from 1.2 angular to 1.5 and in 2.0 in future\nI am start to upgrade this example from addToCart component\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eimport * as angular from 'angular';\nimport angularMeteor from 'angular-meteor';\n\nimport { name as ngCart } from '../../../api/ngCart/ngCart';\n\n\nimport './addToCart.html';\nclass AddToCart {\n constructor($scope, $reactive) {//, ngCart\n //ngCart object here should service return function?\n //angular_angular.js?hash=08f63d2…:13439 TypeError: _apiNgCartNgCart.name.getItemById is not a function\n 'ngInject';\n $reactive(this).attach($scope);\n\n if (this.inCart()) {\n this.q = ngCart.getItemById(this.id).getQuantity();\n } else {\n this.q = parseInt(this.quantity);\n }\n\n this.qtyOpt = [];\n for (var i = 1; i \u0026lt;= this.quantityMax; i++) {\n this.qtyOpt.push(i);\n }\n }\n\n inCart() {\n console.log(\"cart \" + ngCart);\n return ngCart.getItemById(this.id);\n }\n\n}\n\nconst name = 'addToCart';\n\n// create a module\nexport default angular.module(name, [\n angularMeteor,\n ngCart\n]).component(name, {\n templateUrl: `imports/ui/components/${name}/${name}.html`,\n controllerAs: name,\n bindings: {\n id: '@',\n name: '@',\n quantity: '@',\n quantityMax: '@',\n price: '@',\n data: '='\n },\n controller: AddToCart\n});\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eand it gives me following error \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eTypeError: _apiNgCartNgCart.name.getItemById is not a function\n at AddToCart.inCart (addToCart.js:39)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eand here ngCart service\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eimport { name as ngCartItem } from './ngCartItem';\nimport { name as store } from './store';\n\nclass NgCart {\n constructor($scope, $reactive, $window) {\n 'ngInject';\n $reactive(this).attach($scope);\n }\n\n $onInit() {\n // $rootScope.$on('ngCart:change', function(){ // i shouldn't user rooutscope here\n // ngCart.$save();\n // });\n if (angular.isObject(store.get('cart'))) {\n this.$restore(store.get('cart'));\n } else {\n this.init();\n }\n }\n\n init() {\n this.$cart = {\n shipping: null,\n taxRate: null,\n tax: null,\n items: []\n };\n };\n\n\n\n addItem(id, name, price, quantity, data) {\n\n var inCart = this.getItemById(id);\n\n if (typeof inCart === 'object') {\n //Update quantity of an item if it's already in the cart\n inCart.setQuantity(quantity, false);\n // $rootScope.$broadcast('ngCart:itemUpdated', inCart);\n } else {\n var newItem = new ngCartItem(id, name, price, quantity, data);\n this.$cart.items.push(newItem);\n // $rootScope.$broadcast('ngCart:itemAdded', newItem);\n }\n\n // $rootScope.$broadcast('ngCart:change', {});\n };\n\n getItemById(itemId) {\n var items = this.getCart().items;\n var build = false;\n\n angular.forEach(items, function (item) {\n if (item.getId() === itemId) {\n build = item;\n }\n });\n return build;\n };\n\n setShipping(shipping) {\n this.$cart.shipping = shipping;\n return this.getShipping();\n };\n\n getShipping() {\n if (this.getCart().items.length == 0) return 0;\n return this.getCart().shipping;\n };\n\n setTaxRate(taxRate) {\n this.$cart.taxRate = +parseFloat(taxRate).toFixed(2);\n return this.getTaxRate();\n };\n\n getTaxRate() {\n return this.$cart.taxRate\n };\n\n getTax() {\n return +parseFloat(((this.getSubTotal() / 100) * this.getCart().taxRate)).toFixed(2);\n };\n\n setCart(cart) {\n this.$cart = cart;\n return this.getCart();\n };\n\n getCart() {\n return this.$cart;\n };\n\n getItems() {\n return this.getCart().items;\n };\n\n getTotalItems() {\n var count = 0;\n var items = this.getItems();\n angular.forEach(items, function (item) {\n count += item.getQuantity();\n });\n return count;\n };\n\n getTotalUniqueItems() {\n return this.getCart().items.length;\n };\n\n getSubTotal() {\n var total = 0;\n angular.forEach(this.getCart().items, function (item) {\n total += item.getTotal();\n });\n return +parseFloat(total).toFixed(2);\n };\n\n totalCost() {\n return +parseFloat(this.getSubTotal() + this.getShipping() + this.getTax()).toFixed(2);\n };\n\n removeItem(index) {\n var item = this.$cart.items.splice(index, 1)[0] || {};\n // $rootScope.$broadcast('ngCart:itemRemoved', item);\n // $rootScope.$broadcast('ngCart:change', {});\n\n };\n\n removeItemById(id) {\n var item;\n var cart = this.getCart();\n angular.forEach(cart.items, function (item, index) {\n if (item.getId() === id) {\n item = cart.items.splice(index, 1)[0] || {};\n }\n });\n this.setCart(cart);\n // $rootScope.$broadcast('ngCart:itemRemoved', item);\n // $rootScope.$broadcast('ngCart:change', {});\n };\n\n empty() {\n\n // $rootScope.$broadcast('ngCart:change', {});\n this.$cart.items = [];\n $window.localStorage.removeItem('cart');\n };\n\n isEmpty() {\n\n return (this.$cart.items.length \u0026gt; 0 ? false : true);\n\n };\n\n toObject() {\n\n if (this.getItems().length === 0) return false;\n\n var items = [];\n angular.forEach(this.getItems(), function (item) {\n items.push(item.toObject());\n });\n\n return {\n shipping: this.getShipping(),\n tax: this.getTax(),\n taxRate: this.getTaxRate(),\n subTotal: this.getSubTotal(),\n totalCost: this.totalCost(),\n items: items\n }\n };\n\n\n $restore(storedCart) {\n var _self = this;\n _self.init();\n _self.$cart.shipping = storedCart.shipping;\n _self.$cart.tax = storedCart.tax;\n\n angular.forEach(storedCart.items, function (item) {\n _self.$cart.items.push(new ngCartItem(item._id, item._name, item._price, item._quantity, item._data));\n });\n this.$save();\n };\n\n $save() {\n return store.set('cart', JSON.stringify(this.getCart()));\n }\n\n\n\n}\n\nconst name = 'ngCart';\n\n// create a module\nexport default angular.module(name, [\n angularMeteor,\n ngCartItem,\n store\n]).service(name, {\n controllerAs: name,\n controller: NgCart\n});\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHow to import service in 1.5?\nI am using angular-meteor and followed \u003ca href=\"http://www.angular-meteor.com/tutorials/socially/angular1/bootstrapping\" rel=\"nofollow\"\u003ethis\u003c/a\u003e tutorial\u003c/p\u003e\n\n\u003cp\u003eAnd also there can't be scope in service \n// This controller throws an unknown provider error because\n// a scope object cannot be injected into a service.\u003c/p\u003e\n\n\u003cblockquote\u003e\n \u003cp\u003e\u003ca href=\"https://docs.angularjs.org/error/\" rel=\"nofollow\"\u003ehttps://docs.angularjs.org/error/\u003c/a\u003e$injector/unpr?p0=$scopeProvider%20%3C-%20$scope%20%3C-%20ngCart\u003c/p\u003e\n\u003c/blockquote\u003e","accepted_answer_id":"37875647","answer_count":"2","comment_count":"0","creation_date":"2016-06-03 12:19:01.233 UTC","last_activity_date":"2016-06-17 07:31:18.693 UTC","last_edit_date":"2016-06-03 13:21:54.92 UTC","last_editor_display_name":"","last_editor_user_id":"880709","owner_display_name":"","owner_user_id":"880709","post_type_id":"1","score":"4","tags":"angularjs|angular-meteor","view_count":"170"} +{"id":"37614239","title":"How to update angular 1.2 service to 1.5 in angular 2 style","body":"\u003cp\u003e\u003ca href=\"https://github.com/snapjay/ngCart/blob/main/src/ngCart.js#L30\" rel=\"nofollow\"\u003ehttps://github.com/snapjay/ngCart/blob/main/src/ngCart.js#L30\u003c/a\u003e\nI need to update this repo from 1.2 angular to 1.5 and in 2.0 in future\nI am start to upgrade this example from addToCart component\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eimport * as angular from 'angular';\nimport angularMeteor from 'angular-meteor';\n\nimport { name as ngCart } from '../../../api/ngCart/ngCart';\n\n\nimport './addToCart.html';\nclass AddToCart {\n constructor($scope, $reactive) {//, ngCart\n //ngCart object here should service return function?\n //angular_angular.js?hash=08f63d2…:13439 TypeError: _apiNgCartNgCart.name.getItemById is not a function\n 'ngInject';\n $reactive(this).attach($scope);\n\n if (this.inCart()) {\n this.q = ngCart.getItemById(this.id).getQuantity();\n } else {\n this.q = parseInt(this.quantity);\n }\n\n this.qtyOpt = [];\n for (var i = 1; i \u0026lt;= this.quantityMax; i++) {\n this.qtyOpt.push(i);\n }\n }\n\n inCart() {\n console.log(\"cart \" + ngCart);\n return ngCart.getItemById(this.id);\n }\n\n}\n\nconst name = 'addToCart';\n\n// create a module\nexport default angular.module(name, [\n angularMeteor,\n ngCart\n]).component(name, {\n templateUrl: `imports/ui/components/${name}/${name}.html`,\n controllerAs: name,\n bindings: {\n id: '@',\n name: '@',\n quantity: '@',\n quantityMax: '@',\n price: '@',\n data: '='\n },\n controller: AddToCart\n});\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eand it gives me following error \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eTypeError: _apiNgCartNgCart.name.getItemById is not a function\n at AddToCart.inCart (addToCart.js:39)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eand here ngCart service\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eimport { name as ngCartItem } from './ngCartItem';\nimport { name as store } from './store';\n\nclass NgCart {\n constructor($scope, $reactive, $window) {\n 'ngInject';\n $reactive(this).attach($scope);\n }\n\n $onInit() {\n // $rootScope.$on('ngCart:change', function(){ // i shouldn't user rooutscope here\n // ngCart.$save();\n // });\n if (angular.isObject(store.get('cart'))) {\n this.$restore(store.get('cart'));\n } else {\n this.init();\n }\n }\n\n init() {\n this.$cart = {\n shipping: null,\n taxRate: null,\n tax: null,\n items: []\n };\n };\n\n\n\n addItem(id, name, price, quantity, data) {\n\n var inCart = this.getItemById(id);\n\n if (typeof inCart === 'object') {\n //Update quantity of an item if it's already in the cart\n inCart.setQuantity(quantity, false);\n // $rootScope.$broadcast('ngCart:itemUpdated', inCart);\n } else {\n var newItem = new ngCartItem(id, name, price, quantity, data);\n this.$cart.items.push(newItem);\n // $rootScope.$broadcast('ngCart:itemAdded', newItem);\n }\n\n // $rootScope.$broadcast('ngCart:change', {});\n };\n\n getItemById(itemId) {\n var items = this.getCart().items;\n var build = false;\n\n angular.forEach(items, function (item) {\n if (item.getId() === itemId) {\n build = item;\n }\n });\n return build;\n };\n\n setShipping(shipping) {\n this.$cart.shipping = shipping;\n return this.getShipping();\n };\n\n getShipping() {\n if (this.getCart().items.length == 0) return 0;\n return this.getCart().shipping;\n };\n\n setTaxRate(taxRate) {\n this.$cart.taxRate = +parseFloat(taxRate).toFixed(2);\n return this.getTaxRate();\n };\n\n getTaxRate() {\n return this.$cart.taxRate\n };\n\n getTax() {\n return +parseFloat(((this.getSubTotal() / 100) * this.getCart().taxRate)).toFixed(2);\n };\n\n setCart(cart) {\n this.$cart = cart;\n return this.getCart();\n };\n\n getCart() {\n return this.$cart;\n };\n\n getItems() {\n return this.getCart().items;\n };\n\n getTotalItems() {\n var count = 0;\n var items = this.getItems();\n angular.forEach(items, function (item) {\n count += item.getQuantity();\n });\n return count;\n };\n\n getTotalUniqueItems() {\n return this.getCart().items.length;\n };\n\n getSubTotal() {\n var total = 0;\n angular.forEach(this.getCart().items, function (item) {\n total += item.getTotal();\n });\n return +parseFloat(total).toFixed(2);\n };\n\n totalCost() {\n return +parseFloat(this.getSubTotal() + this.getShipping() + this.getTax()).toFixed(2);\n };\n\n removeItem(index) {\n var item = this.$cart.items.splice(index, 1)[0] || {};\n // $rootScope.$broadcast('ngCart:itemRemoved', item);\n // $rootScope.$broadcast('ngCart:change', {});\n\n };\n\n removeItemById(id) {\n var item;\n var cart = this.getCart();\n angular.forEach(cart.items, function (item, index) {\n if (item.getId() === id) {\n item = cart.items.splice(index, 1)[0] || {};\n }\n });\n this.setCart(cart);\n // $rootScope.$broadcast('ngCart:itemRemoved', item);\n // $rootScope.$broadcast('ngCart:change', {});\n };\n\n empty() {\n\n // $rootScope.$broadcast('ngCart:change', {});\n this.$cart.items = [];\n $window.localStorage.removeItem('cart');\n };\n\n isEmpty() {\n\n return (this.$cart.items.length \u0026gt; 0 ? false : true);\n\n };\n\n toObject() {\n\n if (this.getItems().length === 0) return false;\n\n var items = [];\n angular.forEach(this.getItems(), function (item) {\n items.push(item.toObject());\n });\n\n return {\n shipping: this.getShipping(),\n tax: this.getTax(),\n taxRate: this.getTaxRate(),\n subTotal: this.getSubTotal(),\n totalCost: this.totalCost(),\n items: items\n }\n };\n\n\n $restore(storedCart) {\n var _self = this;\n _self.init();\n _self.$cart.shipping = storedCart.shipping;\n _self.$cart.tax = storedCart.tax;\n\n angular.forEach(storedCart.items, function (item) {\n _self.$cart.items.push(new ngCartItem(item._id, item._name, item._price, item._quantity, item._data));\n });\n this.$save();\n };\n\n $save() {\n return store.set('cart', JSON.stringify(this.getCart()));\n }\n\n\n\n}\n\nconst name = 'ngCart';\n\n// create a module\nexport default angular.module(name, [\n angularMeteor,\n ngCartItem,\n store\n]).service(name, {\n controllerAs: name,\n controller: NgCart\n});\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHow to import service in 1.5?\nI am using angular-meteor and followed \u003ca href=\"http://www.angular-meteor.com/tutorials/socially/angular1/bootstrapping\" rel=\"nofollow\"\u003ethis\u003c/a\u003e tutorial\u003c/p\u003e\n\n\u003cp\u003eAnd also there can't be scope in service \n// This controller throws an unknown provider error because\n// a scope object cannot be injected into a service.\u003c/p\u003e\n\n\u003cblockquote\u003e\n \u003cp\u003e\u003ca href=\"https://docs.angularjs.org/error/\" rel=\"nofollow\"\u003ehttps://docs.angularjs.org/error/\u003c/a\u003e$injector/unpr?p0=$scopeProvider%20%3C-%20$scope%20%3C-%20ngCart\u003c/p\u003e\n\u003c/blockquote\u003e","accepted_answer_id":"37875647","answer_count":"2","comment_count":"0","creation_date":"2016-06-03 12:19:01.233 UTC","last_activity_date":"2016-06-17 07:31:18.693 UTC","last_edit_date":"2016-06-03 13:21:54.92 UTC","last_editor_display_name":"","last_editor_user_id":"880709","owner_display_name":"","owner_user_id":"880709","post_type_id":"1","score":"4","tags":"angularjs|angular-meteor","view_count":"170"} {"id":"21088407","title":"Perfectly linear spacing between gridview items","body":"\u003cp\u003eI am using following code to show the GirdView items.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;GridView\n android:id=\"@+id/gridView\"\n android:gravity=\"center_horizontal\"\n android:layout_below=\"@+id/searchLayout\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"match_parent\"\n android:horizontalSpacing=\"10dp\"\n android:numColumns=\"3\"\n android:stretchMode=\"columnWidth\"\n android:verticalSpacing=\"10dp\" /\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eEach GridItem (ImageView) is of size \u003ccode\u003e92dp\u003c/code\u003e\u003c/p\u003e\n\n\u003cp\u003eWhat i want is to show only 3 Columns or 3 images each Row and each Top, bottom ,left right all needs to be perfectly aligned and equal.\u003c/p\u003e\n\n\u003cp\u003eBelow is the result of above code.\u003c/p\u003e\n\n\u003cp\u003e\u003cimg src=\"https://i.stack.imgur.com/HTKxv.png\" alt=\"enter image description here\"\u003e\u003c/p\u003e\n\n\u003cp\u003eIt can be seen that spaces on left and right of the grid are very less as compared with the ones in between images and also between rows are very small.\u003c/p\u003e\n\n\u003cp\u003eSecondly, I am using 92dp. above is the result of S3, but when i use small screen the 3rd image doesn't get fit like in 320 dp screen. \u003c/p\u003e\n\n\u003cp\u003eShouldn't using \"dp\" automatically adjust according to screen size?\u003c/p\u003e","answer_count":"6","comment_count":"1","creation_date":"2014-01-13 10:01:38.767 UTC","last_activity_date":"2015-02-10 11:45:16.64 UTC","last_edit_date":"2014-02-07 12:55:13.75 UTC","last_editor_display_name":"","last_editor_user_id":"1528942","owner_display_name":"","owner_user_id":"1921872","post_type_id":"1","score":"3","tags":"java|android|android-layout","view_count":"1965"} {"id":"10846066","title":"OpenGL opensearch snapshot for multi-sampling giving odd colors in iOS","body":"\u003cp\u003eWhen trying to get opengl view snapshot as UIImage for multi-sampling the image colors are different.\u003c/p\u003e\n\n\u003cp\u003eWhen multi-sampling is off, it is proper.\nThis is how I am taking the snapshot:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e- (UIImage*)snapshot\n{\n\n GLint backingWidth, backingHeight;\n\n backingWidth = framebufferWidth;\n backingHeight = framebufferHeight;\n\n NSInteger myDataLength = backingWidth * backingHeight * 4;\n\n GLubyte *buffer = (GLubyte *) malloc(myDataLength);\n glReadPixels(0, 0, backingWidth, backingHeight, GL_RGBA, GL_UNSIGNED_BYTE, buffer);\n\n // gl renders \"upside down\" so swap top to bottom into new array.\n GLubyte *buffer2 = (GLubyte *) malloc(myDataLength);\n\n for(int y = 0; y \u0026lt; backingHeight; y++) {\n for(int x = 0; x \u0026lt; backingWidth * 4; x++) {\n buffer2[y*4*backingWidth + x] = buffer[(backingHeight - y -1 ) * backingWidth * 4 + x];\n }\n }\n // make data provider with data.\n CGDataProviderRef provider = CGDataProviderCreateWithData(NULL, buffer2, myDataLength, myProviderReleaseData);\n\n // prep the ingredients\n int bitsPerComponent = 8;\n int bitsPerPixel = 32;\n int bytesPerRow = 4 * backingWidth;\n CGColorSpaceRef colorSpaceRef = CGColorSpaceCreateDeviceRGB();\n CGBitmapInfo bitmapInfo = kCGBitmapByteOrderDefault | kCGImageAlphaPremultipliedLast ;\n CGColorRenderingIntent renderingIntent = kCGRenderingIntentDefault;\n\n // make the cgimage\n CGImageRef imageRef = CGImageCreate(backingWidth, backingHeight, bitsPerComponent, bitsPerPixel, bytesPerRow, colorSpaceRef, bitmapInfo, provider, NULL, NO, renderingIntent);\n\n // then make the uiimage from that\n UIImage *image1 = [UIImage imageWithCGImage:imageRef];\n\n CGImageRelease(imageRef);\n CGColorSpaceRelease(colorSpaceRef);\n CGDataProviderRelease(provider);\n free(buffer);\n\n return image1;\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHere are the result of taking the snapshot :\u003c/p\u003e\n\n\u003cp\u003e\u003cimg src=\"https://i.stack.imgur.com/VCJpr.png\" alt=\"opengl view\"\u003e\u003c/p\u003e\n\n\u003cp\u003e\u003cimg src=\"https://i.stack.imgur.com/TYEfJ.png\" alt=\"snapshot of the same view\"\u003e\u003c/p\u003e\n\n\u003cp\u003eFirst one is the opengl view I am drawing and second image is the snapshot of the image I am getting for the above mentioned code. \u003c/p\u003e\n\n\u003cp\u003eI am not using GLKit framework. want to know why multisampling is messing up the snapshot.\u003c/p\u003e","accepted_answer_id":"10846373","answer_count":"1","comment_count":"0","creation_date":"2012-06-01 07:20:05.307 UTC","last_activity_date":"2012-06-01 14:48:24.51 UTC","last_edit_date":"2012-06-01 14:48:24.51 UTC","last_editor_display_name":"","last_editor_user_id":"44729","owner_display_name":"","owner_user_id":"515915","post_type_id":"1","score":"0","tags":"ios|opengl-opensearch|snapshot","view_count":"413"} {"id":"47534469","title":"geting server IP that post data","body":"\u003cp\u003eI am POSTing some data from one server to another using following code:\u003c/p\u003e\n\n\u003cblockquote\u003e\n\u003cpre\u003e\u003ccode\u003e $data2 = http_build_query(\n array(\n 'desc' =\u0026gt; $desc\n ) );\n $options = array('http' =\u0026gt;\n array(\n 'method' =\u0026gt; 'POST',\n 'header' =\u0026gt; 'Content-type: application/x-www-form-urlencoded',\n 'content' =\u0026gt; $data2\n ) );\n $context = stream_context_create($options); // post request $result = file_get_contents($payment_url, false, $context);\n $result = @json_decode($result, true);\n\u003c/code\u003e\u003c/pre\u003e\n\u003c/blockquote\u003e\n\n\u003cp\u003eI would like to ensure that following POST comming from correct server so I have to check server IP posting this data. but $_SERVER['SERVER_ADDR'] give me wrong IP (actually give me destination`s server IP instead Posting server IP).\u003c/p\u003e","answer_count":"1","comment_count":"4","creation_date":"2017-11-28 14:52:06.933 UTC","last_activity_date":"2017-11-28 15:10:35.45 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1081526","post_type_id":"1","score":"0","tags":"php|http-post","view_count":"23"} @@ -2749,7 +2749,7 @@ {"id":"14727585","title":"How to make fgets stop reading from the keyboard","body":"\u003cp\u003eI am trying to run somebody's code and I am new to c so I have a problem with reading the input. The following loop read it from the keyboard, but when I am finished it doesn't stop\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ewhile (fgets(in_line, MAXLINE, stdin) != NULL ) {\n ...\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eIs there any kind of character that I have to enter to simulate 'NULL'? I've tried \\0 but that doesn't seem to work. \u003c/p\u003e\n\n\u003cp\u003eI am very sorry, this problem has probably arisen tons of times, but I just cannot find a proper explanation.\u003c/p\u003e","accepted_answer_id":"14727619","answer_count":"1","comment_count":"0","creation_date":"2013-02-06 11:10:13.8 UTC","last_activity_date":"2013-02-06 11:17:42.487 UTC","last_edit_date":"2013-02-06 11:17:42.487 UTC","last_editor_display_name":"","last_editor_user_id":"1931271","owner_display_name":"","owner_user_id":"1859586","post_type_id":"1","score":"0","tags":"c","view_count":"1180"} {"id":"45078772","title":"Ajax get with jsonp gives \"SyntaxError: missing ; before statement\" error","body":"\u003cp\u003eI am using jqeuery for GET request and getting a response in json format. But when I try to use it, it throws below error message in browser developer tools console.\u003c/p\u003e\n\n\u003cp\u003e\u0026lt;\u0026lt; SyntaxError: missing ; before statement[Learn More] hosts:1:10 \u003e\u003e\u003c/p\u003e\n\n\u003cp\u003eBelow is my code.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e$.ajax({\n type: \"GET\", \n url: url, \n async: false,\n cache: false,\n data: { \"filter\": \"host.vars.osgroup==\\\"unix\\\"\"},\n jsonp: \"callback\",\n dataType: \"jsonp\",\n contentType: \"application/json; charset=utf-8\",\n headers: {\n accept:'application/json',\n \"Authorization\": \"Basic \" + btoa(username + \":\" + password)\n }\n // },\n // success : function(data)\n // {\n // console.log(data);\n // }\n\n})\n .done(function(html) {\n $(\"#displayElement\").append(html);\n });\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"1","comment_count":"3","creation_date":"2017-07-13 11:04:19.09 UTC","last_activity_date":"2017-09-07 06:55:09.34 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"6727208","post_type_id":"1","score":"0","tags":"javascript|jquery|ajax|api|jsonp","view_count":"214"} {"id":"30866693","title":"Memory leak with Mongo Java Connection","body":"\u003cp\u003eI am constructing MongoClient Connection in the below manner :\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epublic static synchronized MongoClient getInstance(String mongoDbUri) {\n try {\n // Standard URI format: mongodb://[dbuser:dbpassword@]host:port/dbname\n if( mongoClient == null ){\n mongoClient = new MongoClient(\n new MongoClientURI(mongoDbUri));\n }\n } catch (Exception e) {\n log.error(\n \"Error mongo connection : \",\n e.getCause());\n }\n return mongoClient;\n }\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eOver a period of time when multiple transaction is run I am seeing some memory eat up with the application which is not getting released.\u003c/p\u003e\n\n\u003cp\u003eWhen analysed the heap dump saw that there was memory consumption was maximum with the class \u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003ecom.mongodb.internal.connection.PowerOfTwoBufferPool\u003c/strong\u003e\u003c/p\u003e\n\n\u003cp\u003eThe mongo client is trying to connect to a mongos instance.The application has 3 replica sets on 3 shards and one config server to hold the metadata.\u003c/p\u003e\n\n\u003cp\u003eTo add more details to the same , I have a spring managed bean annotated with @Component.There is an annotation with @PostConstruct for the bean in which the above method is called.In the spring class we are doing insert/update/create using the Mongo Client.\u003c/p\u003e\n\n\u003cp\u003eThanks.\u003c/p\u003e","answer_count":"0","comment_count":"11","creation_date":"2015-06-16 11:48:45.943 UTC","favorite_count":"0","last_activity_date":"2015-06-16 12:03:35.62 UTC","last_edit_date":"2015-06-16 12:03:35.62 UTC","last_editor_display_name":"","last_editor_user_id":"2470141","owner_display_name":"","owner_user_id":"2470141","post_type_id":"1","score":"5","tags":"java|mongodb|memory-leaks","view_count":"879"} -{"id":"10469340","title":"django haystack - using a generic Views function to do search","body":"\u003cp\u003eI'm trying to convert this code from haystack into urls.py calling a generic view function, but I'm getting \u003cstrong\u003e'function' object has no attribute 'status_code'\u003c/strong\u003e. I think it's because it's not returning a response object. \u003c/p\u003e\n\n\u003cp\u003ehaystack code:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003efrom django.conf.urls.defaults import *\nfrom haystack.forms import ModelSearchForm, HighlightedSearchForm\nfrom haystack.query import SearchQuerySet\nfrom haystack.views import SearchView\n\nsqs = SearchQuerySet().filter(author='john')\n\n# With threading...\nfrom haystack.views import SearchView, search_view_factory\n\nurlpatterns = patterns('haystack.views',\n url(r'^$', search_view_factory(\n view_class=SearchView,\n template='search/search.html',\n searchqueryset=sqs,\n form_class=HighlightedSearchForm\n ), name='haystack_search'),\n)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eMy new urls.py just calls search() in views.py.\u003c/p\u003e\n\n\u003cp\u003eIn views.py, I have\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003edef search(request):\n sqs = SearchQuerySet().all()\n return search_view_factory(\n view_class=SearchView,\n template='search/search.html',\n searchqueryset=sqs,\n form_class=HighlightedSearchForm\n )\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI'm doing this because I want to mess around with sqs quite a bit depending on user inputs and status.\u003c/p\u003e\n\n\u003cp\u003eShouldn't search_view_factory above return a SearchView class, seems like it calls create_response() automatically which returns render_to_response. Tried calling create_response() manually, but that wasn't working either.\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"https://github.com/toastdriven/django-haystack/blob/master/haystack/views.py\" rel=\"nofollow\"\u003edjango-haystack code\u003c/a\u003e can be found here.\u003c/p\u003e\n\n\u003cp\u003eThank you.\u003c/p\u003e","accepted_answer_id":"10469648","answer_count":"1","comment_count":"0","creation_date":"2012-05-06 08:57:09.36 UTC","favorite_count":"1","last_activity_date":"2012-05-06 09:58:42.863 UTC","last_edit_date":"2012-05-06 09:02:41.543 UTC","last_editor_display_name":"","last_editor_user_id":"589876","owner_display_name":"","owner_user_id":"589876","post_type_id":"1","score":"3","tags":"django|django-views|django-urls|django-haystack","view_count":"2382"} +{"id":"10469340","title":"django haystack - using a generic Views function to do search","body":"\u003cp\u003eI'm trying to convert this code from haystack into urls.py calling a generic view function, but I'm getting \u003cstrong\u003e'function' object has no attribute 'status_code'\u003c/strong\u003e. I think it's because it's not returning a response object. \u003c/p\u003e\n\n\u003cp\u003ehaystack code:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003efrom django.conf.urls.defaults import *\nfrom haystack.forms import ModelSearchForm, HighlightedSearchForm\nfrom haystack.query import SearchQuerySet\nfrom haystack.views import SearchView\n\nsqs = SearchQuerySet().filter(author='john')\n\n# With threading...\nfrom haystack.views import SearchView, search_view_factory\n\nurlpatterns = patterns('haystack.views',\n url(r'^$', search_view_factory(\n view_class=SearchView,\n template='search/search.html',\n searchqueryset=sqs,\n form_class=HighlightedSearchForm\n ), name='haystack_search'),\n)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eMy new urls.py just calls search() in views.py.\u003c/p\u003e\n\n\u003cp\u003eIn views.py, I have\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003edef search(request):\n sqs = SearchQuerySet().all()\n return search_view_factory(\n view_class=SearchView,\n template='search/search.html',\n searchqueryset=sqs,\n form_class=HighlightedSearchForm\n )\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI'm doing this because I want to mess around with sqs quite a bit depending on user inputs and status.\u003c/p\u003e\n\n\u003cp\u003eShouldn't search_view_factory above return a SearchView class, seems like it calls create_response() automatically which returns render_to_response. Tried calling create_response() manually, but that wasn't working either.\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"https://github.com/toastdriven/django-haystack/blob/main/haystack/views.py\" rel=\"nofollow\"\u003edjango-haystack code\u003c/a\u003e can be found here.\u003c/p\u003e\n\n\u003cp\u003eThank you.\u003c/p\u003e","accepted_answer_id":"10469648","answer_count":"1","comment_count":"0","creation_date":"2012-05-06 08:57:09.36 UTC","favorite_count":"1","last_activity_date":"2012-05-06 09:58:42.863 UTC","last_edit_date":"2012-05-06 09:02:41.543 UTC","last_editor_display_name":"","last_editor_user_id":"589876","owner_display_name":"","owner_user_id":"589876","post_type_id":"1","score":"3","tags":"django|django-views|django-urls|django-haystack","view_count":"2382"} {"id":"14778392","title":"Input dialog loop end early","body":"\u003cp\u003eWhen the user enters nothing in the input dialog box it ends the loop anyway. I've debugged the code and name is indeed \"\" when the user enters nothing. When the window is closed or cancel is clicked it doesn't exit the loop. It's like it sees the name == null and not the name == \"\". Here is the loop.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ewhile(name == \"\" || name == null){\n name = JOptionPane.showInputDialog(\"Enter you're name:\");\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eCan anyone provide some insight for me?\u003c/p\u003e","answer_count":"4","comment_count":"0","creation_date":"2013-02-08 17:48:30.763 UTC","last_activity_date":"2013-02-08 18:16:44.253 UTC","last_edit_date":"2013-02-08 18:16:44.253 UTC","last_editor_display_name":"","last_editor_user_id":"232196","owner_display_name":"","owner_user_id":"2055311","post_type_id":"1","score":"0","tags":"java|while-loop|joptionpane","view_count":"387"} {"id":"33260789","title":"Create and Send Zip file -NODE JS","body":"\u003cp\u003eI'm trying to create and then send zip file to client. I know how to create it but I've got a problem with send it to client. I tried many ways. \nI'm sending POST request from Client and as response I want to send a file.\nThis is my server-site example code\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003evar Zip = require('node-zip');\nrouter.post('/generator', function(req, res, next) {\n var zip = new Zip;\n\n zip.file('hello.txt', 'Hello, World!');\n var options = {base64: false, compression:'DEFLATE'};\n fs.writeFile('test1.zip', zip.generate(options), 'binary', function (error) {\n console.log('wrote test1.zip', error);\n });\n res.setHeader('Content-disposition', 'attachment; filename=test1.zip');\n res.download('test1.zip');\n\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e});\n I also tried something like this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e res.setHeader('Content-disposition', 'attachment; filename=' + filename);\n res.setHeader('Content-type', mimetype);\n\n var filestream = fs.createReadStream(file);\n filestream.pipe(res);\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI tried to use such libraries as:\u003c/p\u003e\n\n\u003col\u003e\n\u003cli\u003e\u003cp\u003enode-zip \u003c/p\u003e\u003c/li\u003e\n\u003cli\u003e\u003cp\u003earchiver\u003c/p\u003e\u003c/li\u003e\n\u003c/ol\u003e\n\n\u003cp\u003eCan anyone explain me how to do that ?\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2015-10-21 13:34:45.43 UTC","last_activity_date":"2015-10-21 13:53:11.993 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"4585678","post_type_id":"1","score":"2","tags":"javascript|node.js|post|zip","view_count":"1684"} {"id":"46862328","title":"How to write a spec file not to run ./configure in CentOS7","body":"\u003cp\u003eI have written spec file just copy some files to some directory on CentOS7.\u003c/p\u003e\n\n\u003cp\u003e...(snip)...\u003c/p\u003e\n\n\u003cp\u003e%prep\n%setup -q\u003c/p\u003e\n\n\u003cp\u003e%build\u003c/p\u003e\n\n\u003cp\u003e%install\ninstall -m 644 -p $RPM_SOURCE_DIR/some/file \\\n $RPM_BUILD_ROOT%{_sysconfdir}/file\u003c/p\u003e\n\n\u003cp\u003e%clean\nrm -rf $RPM_BUILD_ROOT\u003c/p\u003e\n\n\u003cp\u003e%files\n%doc\n%config(noreplace) %{_sysconfdir}/some/file\u003c/p\u003e\n\n\u003chr\u003e\n\n\u003cp\u003e$cd rpmbuild\n$rpmbuild SPECS/my.spec\n...(snip)...\n+ ./configure --build=x86_64 ...\n/var/tmp/rpm-tmp.RidAmi: line41: ./configure: No such file or directory\u003c/p\u003e\n\n\u003cp\u003eI have not written \"./configure\" ... anywhere.\nI don't know why rpmbuild fails.\nThanks.\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2017-10-21 10:30:31.093 UTC","last_activity_date":"2017-10-21 11:02:15.713 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"5619648","post_type_id":"1","score":"0","tags":"rpmbuild","view_count":"18"} @@ -2840,7 +2840,7 @@ {"id":"31458420","title":"dependent: :destroy - can I delay this with Delayed Job?","body":"\u003cp\u003eI have two models, one stores events and the other is a join model to a calendar model. The join model integrates with a remote Calendar API, and manages itself through API calls when created or deleted (through before_save and before_destroy callbacks).\u003c/p\u003e\n\n\u003cp\u003eThis works great when deleting join model records one at a time, but since I have dependent: :destroy on the has_many association defined in my event model (I do not want orphaned events in the remote calendar), deletion of a single event will cause N api calls (where N is the number of join model records, which could hypothetically be thousands) which would readily cause timeouts.\u003c/p\u003e\n\n\u003cp\u003eIdeally I would like to delay the CalendarEvent.destroy call, but only when it is called from the deletion of an Event. For example:\u003c/p\u003e\n\n\u003cp\u003eEvent.destroy [call delay.destroy on all CalendarEvent (join model) records]\nCalendarEvent.destroy [destroy without delayed_job]\u003c/p\u003e\n\n\u003cp\u003eIs there a way to delay this through the has_many call?\u003c/p\u003e\n\n\u003cp\u003eIs there a way to pass a custom destroy method through dependent:?\u003c/p\u003e\n\n\u003cp\u003eIs there a way, in the CalendarEvent.destroy method, to know whether or not it's being called from a dependent: :destroy definition?\u003c/p\u003e","accepted_answer_id":"31462171","answer_count":"2","comment_count":"1","creation_date":"2015-07-16 15:25:20.11 UTC","last_activity_date":"2015-07-16 18:46:24.483 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"2215882","post_type_id":"1","score":"0","tags":"ruby-on-rails|ruby|ruby-on-rails-4|activerecord|delayed-job","view_count":"483"} {"id":"26870686","title":"SIGCHLD causing segmentation fault, not going into handler","body":"\u003cp\u003eI'm trying to make a simple shell and am adding in functionality to run processes in the background with \u0026amp;. \nIn my main method I basically have:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eint main() {\n if (signal(SIGCHLD, handle) == SIG_ERR)\n perror(\"Cannot catch SIGCHLD\");\n pid_t child = fork();\n if (child == 0)\n execvp(command, arguments);\n else {\n if (background == 1) {\n printf(\"1\");\n backgroundList(command, child);\n printf(\"2\"); }\n else \n waitpid(child, NULL, 0);\n }\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAnd for my handler I have:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003evoid handle(int s) {\n printf(\"a\");\n if (signal(SIGCHLD, handle) == SIG_ERR)\n perror(\"Cannot catch SIGCHLD\");\n pid_t pid;\n printf(\"b\");\n while((pid = waitpid(0, NULL, WNOHANG)) \u0026gt; 0) {\n printf(\"c\");\n rmBackgroundList(pid);\n printf(\"d\");\n }\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI can can have it run a process in the foreground just fine. Running \"ls\" has the contents print to the screen, then \"a\" and \"b\" are printed since it goes into the SIGCHLD handler, but it doesn't go to \"c\" since it's already been waited on. \u003c/p\u003e\n\n\u003cp\u003eHowever, running something in the background (\"ls\u0026amp;\") will print \"1\" and \"2\", have the parent go back to the prompt, then the child will print the contents to the screen, then segmentation fault. It does not print any of the letters I have in the handler. \u003c/p\u003e\n\n\u003cp\u003eI cannot figure out why SIGCHLD is good for children that are already waited on but causes a segmentation fault and never even goes into the handler for processes that were not waited on. \u003c/p\u003e","accepted_answer_id":"26870869","answer_count":"1","comment_count":"1","creation_date":"2014-11-11 17:22:44.977 UTC","last_activity_date":"2014-11-11 17:42:32.027 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"3448835","post_type_id":"1","score":"0","tags":"c|shell|signals","view_count":"208"} {"id":"35777388","title":"opencart Add to cart in category page not adding item to cart","body":"\u003cp\u003eI am trying to add items from category page. But it is taking me to next product page rather then adding such product into the cart. But same functionality is working ok in product page.\u003c/p\u003e\n\n\u003cp\u003eTo find the solution i have added \u003cpre\u003e to check what array i am getting. After adding it such functionality of add to cart in category page was working. I am a bit confuse what to do with that. Kindly help or advice. Following is the code for Add-to-Cart button in category.tpl file.\u003c/p\u003e\n\n\u003ccode\u003e\u0026lt;button type=\"button\" onclick=\"cart.add('\u0026lt;?php echo $product['product_id']; ?\u0026gt;', '\u0026lt;?php echo $product['minimum']; ?\u0026gt;');\"\u0026gt;\u0026lt;span class=\"hidden-xs hidden-sm hidden-md\"\u0026gt;\u0026lt;?php echo $button_cart; ?\u0026gt;\u0026lt;/span\u0026gt; \u0026lt;i class=\"fa fa-shopping-cart\"\u0026gt;\u0026lt;/i\u0026gt;\u0026lt;/button\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"35777600","answer_count":"1","comment_count":"0","creation_date":"2016-03-03 16:16:14.25 UTC","last_activity_date":"2017-07-16 08:38:28.187 UTC","last_edit_date":"2016-03-03 16:31:47.81 UTC","last_editor_display_name":"","last_editor_user_id":"5525487","owner_display_name":"","owner_user_id":"5525487","post_type_id":"1","score":"0","tags":"javascript|php|jquery|opencart","view_count":"460"} -{"id":"46176780","title":"R Plotly: Bugs in parcoords plot","body":"\u003cp\u003eI'm experiencing very strange bugs when working with \u003ccode\u003eplotly\u003c/code\u003e in \u003ccode\u003eR\u003c/code\u003e when using the \u003ccode\u003eparcoords\u003c/code\u003e plot. \u003c/p\u003e\n\n\u003cp\u003eFor example, using the example provided here: \u003ca href=\"https://plot.ly/r/parallel-coordinates-plot/\" rel=\"nofollow noreferrer\"\u003ehttps://plot.ly/r/parallel-coordinates-plot/\u003c/a\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003elibrary(plotly)\n\ndf \u0026lt;- read.csv(\"https://raw.githubusercontent.com/bcdunbar/datasets/master/iris.csv\")\n\ndf %\u0026gt;%\n plot_ly(type = 'parcoords',\n line = list(color = ~species_id,\n colorscale = list(c(0,'red'),c(0.5,'green'),c(1,'blue'))),\n dimensions = list(\n list(range = c(2,4.5),\n label = 'Sepal Width', values = ~sepal_width),\n list(range = c(4,8),\n constraintrange = c(5,6),\n label = 'Sepal Length', values = ~sepal_length),\n list(range = c(0,2.5),\n label = 'Petal Width', values = ~petal_width),\n list(range = c(1,7),\n label = 'Petal Length', values = ~petal_length)\n )\n )\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eresults in this plot:\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"https://i.stack.imgur.com/DmwEU.jpg\" rel=\"nofollow noreferrer\"\u003e\u003cimg src=\"https://i.stack.imgur.com/DmwEU.jpg\" alt=\"enter image description here\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eThis is the \u003cem\u003ewhole\u003c/em\u003e plot, I did not crop the image on the right. If I move the axes around, the data flickers on and off and usually, RStudio crashes. Here's my sessionInfo:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026gt; sessionInfo()\n\nR version 3.4.1 (2017-06-30)\nPlatform: x86_64-w64-mingw32/x64 (64-bit)\nRunning under: Windows \u0026gt;= 8 x64 (build 9200)\n\nMatrix products: default\n\nlocale:\n[1] LC_COLLATE=German_Switzerland.1252 LC_CTYPE=German_Switzerland.1252 LC_MONETARY=German_Switzerland.1252\n[4] LC_NUMERIC=C LC_TIME=German_Switzerland.1252 \n\nattached base packages:\n[1] stats graphics grDevices utils datasets methods base \n\nloaded via a namespace (and not attached):\n[1] compiler_3.4.1 tools_3.4.1 \n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eand my the Version of \u003ccode\u003eplotly\u003c/code\u003e:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026gt; packageVersion('plotly')\n[1] ‘4.7.1’\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eDoes anybody experience the same problem? Is there a solution to this? \u003c/p\u003e","accepted_answer_id":"46179061","answer_count":"1","comment_count":"0","creation_date":"2017-09-12 12:46:15.663 UTC","last_activity_date":"2017-09-12 14:38:43.903 UTC","last_edit_date":"2017-09-12 14:37:30.377 UTC","last_editor_display_name":"","last_editor_user_id":"1166684","owner_display_name":"","owner_user_id":"4139249","post_type_id":"1","score":"0","tags":"r|plot|rstudio|plotly|parallel-coordinates","view_count":"66"} +{"id":"46176780","title":"R Plotly: Bugs in parcoords plot","body":"\u003cp\u003eI'm experiencing very strange bugs when working with \u003ccode\u003eplotly\u003c/code\u003e in \u003ccode\u003eR\u003c/code\u003e when using the \u003ccode\u003eparcoords\u003c/code\u003e plot. \u003c/p\u003e\n\n\u003cp\u003eFor example, using the example provided here: \u003ca href=\"https://plot.ly/r/parallel-coordinates-plot/\" rel=\"nofollow noreferrer\"\u003ehttps://plot.ly/r/parallel-coordinates-plot/\u003c/a\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003elibrary(plotly)\n\ndf \u0026lt;- read.csv(\"https://raw.githubusercontent.com/bcdunbar/datasets/main/iris.csv\")\n\ndf %\u0026gt;%\n plot_ly(type = 'parcoords',\n line = list(color = ~species_id,\n colorscale = list(c(0,'red'),c(0.5,'green'),c(1,'blue'))),\n dimensions = list(\n list(range = c(2,4.5),\n label = 'Sepal Width', values = ~sepal_width),\n list(range = c(4,8),\n constraintrange = c(5,6),\n label = 'Sepal Length', values = ~sepal_length),\n list(range = c(0,2.5),\n label = 'Petal Width', values = ~petal_width),\n list(range = c(1,7),\n label = 'Petal Length', values = ~petal_length)\n )\n )\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eresults in this plot:\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"https://i.stack.imgur.com/DmwEU.jpg\" rel=\"nofollow noreferrer\"\u003e\u003cimg src=\"https://i.stack.imgur.com/DmwEU.jpg\" alt=\"enter image description here\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eThis is the \u003cem\u003ewhole\u003c/em\u003e plot, I did not crop the image on the right. If I move the axes around, the data flickers on and off and usually, RStudio crashes. Here's my sessionInfo:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026gt; sessionInfo()\n\nR version 3.4.1 (2017-06-30)\nPlatform: x86_64-w64-mingw32/x64 (64-bit)\nRunning under: Windows \u0026gt;= 8 x64 (build 9200)\n\nMatrix products: default\n\nlocale:\n[1] LC_COLLATE=German_Switzerland.1252 LC_CTYPE=German_Switzerland.1252 LC_MONETARY=German_Switzerland.1252\n[4] LC_NUMERIC=C LC_TIME=German_Switzerland.1252 \n\nattached base packages:\n[1] stats graphics grDevices utils datasets methods base \n\nloaded via a namespace (and not attached):\n[1] compiler_3.4.1 tools_3.4.1 \n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eand my the Version of \u003ccode\u003eplotly\u003c/code\u003e:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026gt; packageVersion('plotly')\n[1] ‘4.7.1’\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eDoes anybody experience the same problem? Is there a solution to this? \u003c/p\u003e","accepted_answer_id":"46179061","answer_count":"1","comment_count":"0","creation_date":"2017-09-12 12:46:15.663 UTC","last_activity_date":"2017-09-12 14:38:43.903 UTC","last_edit_date":"2017-09-12 14:37:30.377 UTC","last_editor_display_name":"","last_editor_user_id":"1166684","owner_display_name":"","owner_user_id":"4139249","post_type_id":"1","score":"0","tags":"r|plot|rstudio|plotly|parallel-coordinates","view_count":"66"} {"id":"37559822","title":"Mutually exclusive elements in XSD","body":"\u003cp\u003eI want to implement a relationship where \"Rate\" element should only exists when \"ComponentInstId and \"ComponentInstIdServ\" are not present and vice versa. How can I do that in below xsd code?\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;?xml version=\"1.0\" encoding=\"UTF-8\"?\u0026gt;\n\u0026lt;xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" elementFormDefault=\"qualified\" attributeFormDefault=\"unqualified\"\u0026gt;\n\u0026lt;xs:element name=\"Request\"\u0026gt;\n \u0026lt;xs:complexType\u0026gt;\n \u0026lt;xs:sequence\u0026gt;\n \u0026lt;xs:element name=\"Component\"\u0026gt;\n \u0026lt;xs:complexType\u0026gt;\n \u0026lt;xs:all\u0026gt;\n \u0026lt;xs:element name=\"ComponentId\" nillable=\"false\"\u0026gt;\n \u0026lt;xs:simpleType\u0026gt;\n \u0026lt;xs:restriction base=\"xs:integer\"\u0026gt;\n \u0026lt;xs:whiteSpace value=\"collapse\"/\u0026gt;\n \u0026lt;/xs:restriction\u0026gt;\n \u0026lt;/xs:simpleType\u0026gt;\n \u0026lt;/xs:element\u0026gt;\n \u0026lt;xs:element name=\"ComponentInstId\" nillable=\"true\" minOccurs=\"0\"\u0026gt;\n \u0026lt;xs:simpleType\u0026gt;\n \u0026lt;xs:restriction base=\"xs:integer\"\u0026gt;\n \u0026lt;xs:whiteSpace value=\"collapse\"/\u0026gt;\n \u0026lt;/xs:restriction\u0026gt;\n \u0026lt;/xs:simpleType\u0026gt;\n \u0026lt;/xs:element\u0026gt;\n \u0026lt;xs:element name=\"ComponentInstIdServ\" nillable=\"true\" minOccurs=\"0\"\u0026gt;\n \u0026lt;xs:simpleType\u0026gt;\n \u0026lt;xs:restriction base=\"xs:int\"\u0026gt;\n \u0026lt;xs:whiteSpace value=\"collapse\"/\u0026gt;\n \u0026lt;/xs:restriction\u0026gt;\n \u0026lt;/xs:simpleType\u0026gt;\n \u0026lt;/xs:element\u0026gt;\n \u0026lt;xs:element name=\"Rate\" nillable=\"true\" minOccurs=\"0\"\u0026gt;\n \u0026lt;xs:simpleType\u0026gt;\n \u0026lt;xs:restriction base=\"xs:int\"\u0026gt;\n \u0026lt;xs:whiteSpace value=\"collapse\"/\u0026gt;\n \u0026lt;xs:minInclusive value=\"0\"/\u0026gt;\n \u0026lt;/xs:restriction\u0026gt;\n \u0026lt;/xs:simpleType\u0026gt;\n \u0026lt;/xs:element\u0026gt;\n \u0026lt;/xs:all\u0026gt;\n \u0026lt;/xs:complexType\u0026gt;\n \u0026lt;/xs:element\u0026gt;\n \u0026lt;/xs:sequence\u0026gt;\n \u0026lt;/xs:complexType\u0026gt;\n\u0026lt;/xs:element\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2016-06-01 05:03:19.19 UTC","last_activity_date":"2016-06-03 15:13:29.627 UTC","last_edit_date":"2016-06-02 23:18:56.227 UTC","last_editor_display_name":"","last_editor_user_id":"3366906","owner_display_name":"","owner_user_id":"3366906","post_type_id":"1","score":"-1","tags":"xsd|xsd-validation","view_count":"357"} {"id":"5614196","title":"Group by 2 columns and count","body":"\u003cp\u003eI have the following MySql table - user_actions:\nid - int\nuser_id - int\ntimestamp - datetime\naction - int\u003c/p\u003e\n\n\u003cp\u003ea data example:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e1|5|01.01.2011 21:00:00|1\n2|5|01.01.2011 21:00:00|3\n3|6|01.01.2011 21:00:00|5\n3|6|01.02.2011 21:00:00|5\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI want to count the number of users who made an action in each day (no matter how many actions), in the above example the output should be:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e01.01.2011|2 \n01.02.2011|1 \n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cul\u003e\n\u003cli\u003emeaning 2 users made actions in 01.01.2011 and one user in 01.02.2011\u003c/li\u003e\n\u003c/ul\u003e\n\n\u003cp\u003eany thoughts? \u003c/p\u003e","accepted_answer_id":"5614213","answer_count":"1","comment_count":"0","creation_date":"2011-04-10 19:36:42.137 UTC","last_activity_date":"2011-04-10 20:12:50.78 UTC","last_edit_date":"2011-04-10 19:44:35.087 UTC","last_editor_display_name":"","last_editor_user_id":"553823","owner_display_name":"","owner_user_id":"553823","post_type_id":"1","score":"2","tags":"mysql","view_count":"288"} {"id":"38860936","title":"Tracking Conversions with Facebook Conversion Pixel","body":"\u003cp\u003eFacebook recommends including their tracking pixel in the head section:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;head\u0026gt;\n\u0026lt;!-- Facebook Pixel Code --\u0026gt;\n \u0026lt;script\u0026gt;\n ... code ...\n fbq('init', 'XXXXX');\n fbq('track', \"PageView\");\n ... more code\n \u0026lt;/script\u0026gt;\n \u0026lt;!-- End Facebook Pixel Code --\u0026gt;\n\u0026lt;/head\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eBut I also want to track conversions. Do I add \u003ccode\u003efbq('track', 'CompleteRegistration');\u003c/code\u003e in the original pixel code in the head? Or do I fire it only on the pages where the user is converted? (e.g. \"Thank You\" page)\u003c/p\u003e\n\n\u003cp\u003eIf I just include it in the head, how does FB know what a \"Complete Registration\" is?\u003c/p\u003e","answer_count":"1","comment_count":"1","creation_date":"2016-08-09 21:44:20.467 UTC","last_activity_date":"2017-07-19 18:20:12.857 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"4621100","post_type_id":"1","score":"0","tags":"facebook","view_count":"266"} @@ -2957,7 +2957,7 @@ {"id":"10222216","title":"Implementing a simple proxy server using node.js","body":"\u003cp\u003eI'm trying to create a simple node.js proxy server for experimental purposes and I came up with this simple script:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003evar url = require(\"url\");\nvar http = require(\"http\");\nvar https = require(\"https\");\n\nhttp.createServer(function (request, response) {\n var path = url.parse(request.url).path;\n\n if (!path.indexOf(\"/resource/\")) {\n var protocol;\n path = path.slice(10);\n var location = url.parse(path);\n\n switch (location.protocol) {\n case \"http:\":\n protocol = http;\n break;\n case \"https:\":\n protocol = https;\n break;\n default:\n response.writeHead(400);\n response.end();\n return;\n }\n\n var options = {\n host: location.host,\n hostname: location.hostname,\n port: +location.port,\n method: request.method,\n path: location.path,\n headers: request.headers,\n auth: location.auth\n };\n\n var clientRequest = protocol.request(options, function (clientResponse) {\n response.writeHead(clientResponse.statusCode, clientResponse.headers);\n clientResponse.on(\"data\", response.write);\n clientResponse.on(\"end\", function () {\n response.addTrailers(clientResponse.trailers);\n response.end();\n });\n });\n\n request.on(\"data\", clientRequest.write);\n request.on(\"end\", clientRequest.end);\n } else {\n response.writeHead(404);\n response.end();\n }\n}).listen(8484);\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI don't know where I'm going wrong but it gives me the following error when I try to load any page:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ehttp.js:645\n this._implicitHeader();\n ^\nTypeError: Object #\u0026lt;IncomingMessage\u0026gt; has no method '_implicitHeader'\n at IncomingMessage.\u0026lt;anonymous\u0026gt; (http.js:645:10)\n at IncomingMessage.emit (events.js:64:17)\n at HTTPParser.onMessageComplete (http.js:137:23)\n at Socket.ondata (http.js:1410:22)\n at TCP.onread (net.js:374:27)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI wonder what could the problem be. Debugging in node.js is so much more difficult than in Rhino. Any help will be greatly appreciated.\u003c/p\u003e","accepted_answer_id":"10223205","answer_count":"1","comment_count":"6","creation_date":"2012-04-19 05:35:22.83 UTC","favorite_count":"1","last_activity_date":"2012-04-19 07:08:09.503 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"783743","post_type_id":"1","score":"2","tags":"javascript|http|node.js|https|proxy-server","view_count":"2928"} {"id":"38627066","title":"In R, how do I make an iterative calculation without using a loop?","body":"\u003cp\u003eHere is a simple example of one type of iterative calc:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003evals \u0026lt;- data.frame( \"x\"=c( 14, 15, 12, 10, 17 ), \"ema\"=0 )\nvals$ema[1] \u0026lt;- vals$x[1]\nK \u0026lt;- 0.90\nfor( jj in 2:nrow( vals ) )\n vals$ema[jj] \u0026lt;- K * vals$ema[jj-1] + (1-K) * vals$x[jj]\n\nvals\n x ema\n1 14 14.0000\n2 15 14.1000\n3 12 13.8900\n4 10 13.5010\n5 17 13.8509\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe more involved examples use if...else to determine the next value:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003efor( jj in 2:nrow( vals ) )\n if( K * vals$ema[jj-1] + (1-K) * vals$x[jj] \u0026lt; 5.0 )\n vals$ema[jj] \u0026lt;- 5.0\n else if( K * vals$ema[jj-1] + (1-K) * vals$x[jj] \u0026gt; 15.0 )\n vals$ema[jj] \u0026lt;- 15.0\n else\n vals$ema[jj] \u0026lt;- K * vals$ema[jj-1] + (1-K) * vals$x[jj]\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI am not sure if it would be more involved or not, but the decision can be based on the previous value as well:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eK1 \u0026lt;- 0.999\nK2 \u0026lt;- 0.95\nK3 \u0026lt;- 0.90\nfor( jj in 2:now( vals ) )\n if( vals$ema[jj-1] \u0026lt; 0.0 )\n vals$ema[jj] \u0026lt;- K1 * vals$ema[jj-1] + (1-K1) * vals$x[jj]\n else if( vals$ema[jj-1] \u0026gt; 100.0 )\n vals$ema[jj] \u0026lt;- K3 * vals$ema[jj-1] + (1-K3) * vals$x[jj]\n else\n vals$ema[jj] \u0026lt;- K2 * vals$ema[jj-1] + (1-K2) * vals$x[jj]\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"5","comment_count":"1","creation_date":"2016-07-28 04:23:25.353 UTC","last_activity_date":"2016-08-01 19:52:58.51 UTC","last_edit_date":"2016-07-31 03:23:43.78 UTC","last_editor_display_name":"","last_editor_user_id":"2137931","owner_display_name":"","owner_user_id":"2137931","post_type_id":"1","score":"0","tags":"r|loops|iteration|shift","view_count":"254"} {"id":"6806068","title":"the type system does not tell the whole story due to \"exception\"","body":"\u003cp\u003eMy question should be somewhat vague and very superficial. Sorry. But I am wondering whether it is a bad style to use \"exception\". For example, in Ocaml, the exception does not appear as the .mli file. So it appears to me that \"exception\" is something that cannot be tracked by a type system. \u003c/p\u003e\n\n\u003cp\u003eSo my question in general is, is using exception a bad style because it hides information against the type system?\u003c/p\u003e\n\n\u003cp\u003eConcretely, I am trying to implement a type checker for an imperative language, say, Pascal. The essential judgment should have been of this signature, \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ewell-typed_1: environment -\u0026gt; statement -\u0026gt; unit\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eBut this seems to be insufficient because the environment would be modified due to a local variable declaration, thus a more reasonable interface for typechecker would be \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ewell-typed_2: environment -\u0026gt; statement -\u0026gt; environment\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAn alternative would be use the former one, well-typed_1, dealing with local variables declaration through an exception Var_declaration (e : environment) which returns the updated environment to the type checker for its other recursion. \u003c/p\u003e\n\n\u003cp\u003eSo, my question for this concrete example is , should I use the well-typed_1 + exception for variable declaration, or well-typed_2? \u003c/p\u003e\n\n\u003cp\u003eThe disadvantage of well-typed_2 seems to be that, for most statement there are no side effect with regard to environment of types, thus that signature of well-typed_2 seems to be a bit redundant. The disadvantage of well_typed_2 + exception seems to reveal a general issue: the the signature of well-typed_1 in does not tell the whole story. (it does not tell the potential exception)\u003c/p\u003e","answer_count":"0","comment_count":"3","creation_date":"2011-07-24 09:39:29.09 UTC","last_activity_date":"2011-07-24 09:44:43.573 UTC","last_edit_date":"2011-07-24 09:44:43.573 UTC","last_editor_display_name":"","last_editor_user_id":"166749","owner_display_name":"","owner_user_id":"815653","post_type_id":"1","score":"1","tags":"exception|programming-languages|type-systems","view_count":"64"} -{"id":"21802756","title":"Why does git rm -rf not get rid of a folder with a submodule in it?","body":"\u003cp\u003eWhen I do \u003ccode\u003egit status\u003c/code\u003e this is what I see:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e$ git status\n# On branch master\n# Your branch is ahead of 'github/master' by 1 commit.\n# (use \"git push\" to publish your local commits)\n#\n# Changes not staged for commit:\n# (use \"git add \u0026lt;file\u0026gt;...\" to update what will be committed)\n# (use \"git checkout -- \u0026lt;file\u0026gt;...\" to discard changes in working directory)\n# (commit or discard the untracked or modified content in submodules)\n#\n# modified: octopress (modified content, untracked content)\n#\nno changes added to commit (use \"git add\" and/or \"git commit -a\")\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhen I do \u003ccode\u003egit rm -rf octopress\u003c/code\u003e, this is what I see:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e$ git rm -rf octopress\nerror: submodule 'octopress' (or one of its nested submodules) uses a .git directory\n(use 'rm -rf' if you really want to remove it including all of its history)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThoughts?\u003c/p\u003e","answer_count":"2","comment_count":"0","creation_date":"2014-02-15 19:49:31.433 UTC","favorite_count":"2","last_activity_date":"2016-06-21 20:08:38.45 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"91970","post_type_id":"1","score":"4","tags":"git","view_count":"2412"} +{"id":"21802756","title":"Why does git rm -rf not get rid of a folder with a submodule in it?","body":"\u003cp\u003eWhen I do \u003ccode\u003egit status\u003c/code\u003e this is what I see:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e$ git status\n# On branch main\n# Your branch is ahead of 'github/main' by 1 commit.\n# (use \"git push\" to publish your local commits)\n#\n# Changes not staged for commit:\n# (use \"git add \u0026lt;file\u0026gt;...\" to update what will be committed)\n# (use \"git checkout -- \u0026lt;file\u0026gt;...\" to discard changes in working directory)\n# (commit or discard the untracked or modified content in submodules)\n#\n# modified: octopress (modified content, untracked content)\n#\nno changes added to commit (use \"git add\" and/or \"git commit -a\")\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhen I do \u003ccode\u003egit rm -rf octopress\u003c/code\u003e, this is what I see:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e$ git rm -rf octopress\nerror: submodule 'octopress' (or one of its nested submodules) uses a .git directory\n(use 'rm -rf' if you really want to remove it including all of its history)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThoughts?\u003c/p\u003e","answer_count":"2","comment_count":"0","creation_date":"2014-02-15 19:49:31.433 UTC","favorite_count":"2","last_activity_date":"2016-06-21 20:08:38.45 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"91970","post_type_id":"1","score":"4","tags":"git","view_count":"2412"} {"id":"40028974","title":"Visual Studio variadic macro expansion yields unexpected results","body":"\u003cp\u003ecurrently I'm trying to compile some code with Visual Studio 2015 Service Pack 2 that makes use of the following macros not written by me:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e#define REM(...) __VA_ARGS__\n#define EAT(...)\n\n// Retrieve the type\n#define TYPEOF(x) DETAIL_TYPEOF(DETAIL_TYPEOF_PROBE x,)\n#define DETAIL_TYPEOF(...) DETAIL_TYPEOF_HEAD(__VA_ARGS__)\n#define DETAIL_TYPEOF_HEAD( x , ... ) REM x\n#define DETAIL_TYPEOF_PROBE(...) (__VA_ARGS__),\n// Strip off the type\n#define STRIP(x) EAT x\n// Show the type without parenthesis\n#define PAIR(x) REM x\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eSupposedly the TYPEOF macro would isolate the type of an expression.\nI have tried to invoke the TYPEOF macro with the following call:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eTYPEOF( (int) m ) c;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eIn theory, the result should be\u003c/p\u003e\n\n\u003cp\u003eint c;\u003c/p\u003e\n\n\u003cp\u003ebut instead the preprocessor outputs\u003c/p\u003e\n\n\u003cp\u003eint, m, c;\u003c/p\u003e\n\n\u003cp\u003eReplacing\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e#define DETAIL_TYPEOF_HEAD(x, ...) REM x\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ewith\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e#define DETAIL_TYPEOF_HEAD( x , ... ) X = x and VA_ARGS = __VA_ARGS__\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eYields this output:\u003c/p\u003e\n\n\u003cp\u003eX = (int), m, and VA_ARGS = c;\u003c/p\u003e\n\n\u003cp\u003eIt seems that receiving the input (int), m, the DETAIL_TYPEOF_HEAD macro is unable to pick the first entry x from the variadic parameter list and instead puts the whole list into x.\u003c/p\u003e\n\n\u003cp\u003eDo you know this phenomenon? \u003c/p\u003e\n\n\u003cp\u003eRegards \u003c/p\u003e","answer_count":"1","comment_count":"4","creation_date":"2016-10-13 19:04:30.093 UTC","last_activity_date":"2016-10-14 09:01:44.193 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"5024425","post_type_id":"1","score":"0","tags":"c++|visual-c++","view_count":"78"} {"id":"23310198","title":"ValueError: The file could not be found with \u003cpipeline.storage.PipelineCachedStorage object\u003e","body":"\u003cp\u003eI'm trying to compile SASS and compress CSS files with \u003ca href=\"http://django-pipeline.readthedocs.org/en/latest/\" rel=\"nofollow noreferrer\"\u003e\u003cstrong\u003edjango pipeline\u003c/strong\u003e\u003c/a\u003e on \u003cem\u003eDjango 1.6.3\u003c/em\u003e, but I get the following error after visiting my site:\u003c/p\u003e\n\n\u003cblockquote\u003e\n \u003cp\u003eValueError: The file 'css/test2.css' could not be found with \u0026lt;pipeline.storage.PipelineCachedStorage object at 0x0585DF50\u0026gt;.\u003c/p\u003e\n\u003c/blockquote\u003e\n\n\u003cp\u003eI configured pipeline following the guide on \u003ca href=\"https://readthedocs.org/\" rel=\"nofollow noreferrer\"\u003ereadthedocs.org\u003c/a\u003e: I added pipeline to \u003ccode\u003eINSTALLED_APPS\u003c/code\u003e then I defined \u003ccode\u003eSTATIC_URL\u003c/code\u003e and \u003ccode\u003eSTATIC_ROOT\u003c/code\u003e:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eSTATIC_URL = '/test/forum/skins/default/media/'\nSTATIC_ROOT = '/test/forum/skins/default/media/'\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eFolders tree:\u003c/p\u003e\n\n\u003cul\u003e\n\u003cli\u003etest \n\n\u003cul\u003e\n\u003cli\u003eforum \n\n\u003cul\u003e\n\u003cli\u003eskins \n\n\u003cul\u003e\n\u003cli\u003edefault \n\n\u003cul\u003e\n\u003cli\u003e\u003cstrong\u003emedia\u003c/strong\u003e (static files) \n\n\u003cul\u003e\n\u003cli\u003ecss \u003c/li\u003e\n\u003cli\u003ejs \u003c/li\u003e\n\u003cli\u003eimages \u003c/li\u003e\n\u003c/ul\u003e\u003c/li\u003e\n\u003c/ul\u003e\u003c/li\u003e\n\u003cli\u003esite1 \u003c/li\u003e\n\u003cli\u003esite2 \u003c/li\u003e\n\u003cli\u003esite3 \u003c/li\u003e\n\u003c/ul\u003e\u003c/li\u003e\n\u003c/ul\u003e\u003c/li\u003e\n\u003c/ul\u003e\u003c/li\u003e\n\u003cli\u003eviews \u003c/li\u003e\n\u003cli\u003eutils \u003c/li\u003e\n\u003cli\u003esettings.py\u003c/li\u003e\n\u003c/ul\u003e\n\n\u003cp\u003eI added \u003ccode\u003eSASSCompiler\u003c/code\u003e to \u003ccode\u003ePIPELINE_COMPILERS\u003c/code\u003e and then I added the path to the file to be compressed:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e# pipeline settings\nSTATICFILES_STORAGE = 'pipeline.storage.PipelineCachedStorage'\nPIPELINE_COMPILERS = (\n 'pipeline.compilers.sass.SASSCompiler',\n)\nPIPELINE_CSS = {\n 'main': {\n 'source_filenames': (\n 'css/test.scss',\n ),\n 'output_filename': 'css/test2.css',\n },\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eFinally I linked the css to my XHTML index:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e{% load compressed %}\n\u0026lt;html xmlns=\"http://www.w3.org/1999/xhtml\"\u0026gt;\n \u0026lt;head\u0026gt;\n {% compressed_css 'main' %}\n \u0026lt;/head\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI do not understand what I did wrong. \nThanks for any help!\u003c/p\u003e\n\n\u003chr\u003e\n\n\u003ch3\u003eUPDATE:\u003c/h3\u003e\n\n\u003cp\u003eWhen I run \u003ccode\u003ecollectstatic\u003c/code\u003e this copy the files from django and not from my project\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eF:\\DEV\\DJANGO\\apps\\test\u0026gt;python manage.py collectstatic\n\nYou have requested to collect static files at the destination\nlocation as specified in your settings:\n\n F:\\test\\forum\\skins\\default\\media\n\nThis will overwrite existing files!\nAre you sure you want to do this?\n\nType 'yes' to continue, or 'no' to cancel: yes\nCopying 'F:\\DEV\\DJANGO\\apps\\django\\django\\contrib\\admin\\static\\admin\\css\\base.\ncss'\nCopying 'F:\\DEV\\DJANGO\\apps\\django\\django\\contrib\\admin\\static\\admin\\css\\chang\nelists.css'\nCopying 'F:\\DEV\\DJANGO\\apps\\django\\django\\contrib\\admin\\static\\admin\\css\\dashb\noard.css'\nCopying 'F:\\DEV\\DJANGO\\apps\\django\\django\\contrib\\admin\\static\\admin\\css\\forms\n.css'\nCopying 'F:\\DEV\\DJANGO\\apps\\django\\django\\contrib\\admin\\static\\admin\\css\\ie.cs\ns'\n[etc .... ]\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eBut the path \u003ccode\u003eF:\\test\\forum\\skins\\default\\media\u003c/code\u003e is wrong, my project is located \nin \u003ccode\u003eF:\\DEV\\DJANGO\\apps\\test\\forum\\skins\\default\\media\u003c/code\u003e.\u003c/p\u003e\n\n\u003cp\u003eThen I tried to find the static file:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eF:\\DEV\\DJANGO\\apps\\test\u0026gt; python manage.py findstatic css/main.css\n\nNo matching file found for 'css/main.css'.\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eBut the file exists.\u003c/p\u003e","accepted_answer_id":"23317512","answer_count":"1","comment_count":"5","creation_date":"2014-04-26 11:29:00.673 UTC","favorite_count":"2","last_activity_date":"2017-03-23 09:29:42.297 UTC","last_edit_date":"2017-03-23 09:29:42.297 UTC","last_editor_display_name":"","last_editor_user_id":"219519","owner_display_name":"","owner_user_id":"1994865","post_type_id":"1","score":"3","tags":"python|django","view_count":"2621"} {"id":"45589772","title":"Error from the SQL syntax","body":"\u003cpre\u003e\u003ccode\u003eSELECT * FROM `111_dossier` AS d\nLEFT JOIN `008_vehicule` AS v\nLEFT JOIN `053_dates` AS da\nLEFT JOIN `descriptif` AS des\n\nWHERE (`d.site_gestion` = 57 OR `d.site_creation` = 57)\nAND `d.etat_dossier` IN(\"V\",\"W\")\nAND year(`da.date_entree`) \u0026gt;= 2014\nAND `v.marque` = \"Tesla\"\nAND `des.C4` LIKE %LONGERON% \n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003cem\u003e#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to\nuse near 'WHERE (\u003ccode\u003ed.site_gestion\u003c/code\u003e = 57 OR \u003ccode\u003ed.site_creation\u003c/code\u003e = 57)\n AND \u003ccode\u003ed.etat_dossier\u003c/code\u003e IN(' at line 6\u003c/em\u003e\u003c/p\u003e\n\n\u003cp\u003e*\u003c/p\u003e\n\n\u003cp\u003eI'm trying to run this request since 2 hours , can someone help me?\nSorry, I think that it's only a small error in the syntax but I'm a beginner. \u003c/p\u003e\n\n\u003cp\u003eSuggest the changes to be done.\u003c/p\u003e","answer_count":"0","comment_count":"3","creation_date":"2017-08-09 11:46:31.83 UTC","last_activity_date":"2017-08-09 14:12:11.83 UTC","last_edit_date":"2017-08-09 14:12:11.83 UTC","last_editor_display_name":"","last_editor_user_id":"6656727","owner_display_name":"","owner_user_id":"8439530","post_type_id":"1","score":"0","tags":"mysql","view_count":"25"} @@ -3098,7 +3098,7 @@ {"id":"39411933","title":"Quaternion lerp back and forth","body":"\u003cp\u003eI want to \u003ccode\u003elerp\u003c/code\u003e along the Z axis forth and back the same amount to avoid spinning (as my \u003ccode\u003esprite\u003c/code\u003e is not a circular one). To do this I planned to random a \u003ccode\u003eforward angle\u003c/code\u003e, store it, \u003ccode\u003elerp\u003c/code\u003e to it then \u003ccode\u003elerp\u003c/code\u003e back with the same amount. However, this gives some weird popping as when the backwards rotations starts the starting angle wouldn't be the same, but it is. When I call it, I give it the same time to interpolate between. Some code:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eIEnumerator LerpQuat(QuatLerpInput rotThis, float time, float leftBoundary, float rightBoundary)\n{\n /*\n * we want to rotate forward, then backward the same amount\n * to avoid spinning. we store the given value to both of these.\n */\n\n Transform stuffToRot = rotThis.godRayGO.transform;\n\n float lastTime = Time.realtimeSinceStartup;\n float timer = 0.0f;\n switch (rotThis.rotState)\n {\n case (QuatLerpInput.RotationStates.rotAway):\n rotThis.deltaRot = Random.Range(leftBoundary, rightBoundary);\n while (timer \u0026lt; time)\n {\n stuffToRot.rotation = Quaternion.Euler(stuffToRot.rotation.x, stuffToRot.rotation.y,\n Mathf.LerpAngle(rotThis.idleRot, rotThis.idleRot + rotThis.deltaRot, timer / time));\n timer += (Time.realtimeSinceStartup - lastTime);\n lastTime = Time.realtimeSinceStartup;\n yield return null;\n }\n rotThis.rotState = QuatLerpInput.RotationStates.setBack;\n break;\n case (QuatLerpInput.RotationStates.setBack):\n while (timer \u0026lt; time)\n {\n stuffToRot.rotation = Quaternion.Euler(stuffToRot.rotation.x, stuffToRot.rotation.y,\n Mathf.LerpAngle(rotThis.idleRot + rotThis.deltaRot, rotThis.idleRot, timer / time));\n timer += (Time.realtimeSinceStartup - lastTime);\n lastTime = Time.realtimeSinceStartup;\n yield return null;\n }\n rotThis.rotState = QuatLerpInput.RotationStates.rotAway;\n break;\n }\n\n}\npublic class QuatLerpInput\n{\n public GameObject godRayGO;\n public float deltaRot;\n public float idleRot;\n public enum RotationStates\n {\n rotAway, setBack\n }\n public RotationStates rotState = RotationStates.rotAway;\n public QuatLerpInput(GameObject godRayGO)\n {\n this.godRayGO = godRayGO;\n deltaRot = godRayGO.transform.rotation.z;\n idleRot = godRayGO.transform.rotation.z;\n }\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eEdited \u003ccode\u003eswitch\u003c/code\u003e with Quaternions:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eswitch (rotThis.rotState)\n {\n case (QuatLerpInput.RotationStates.rotAway):\n rotThis.deltaRot = Random.Range(leftBoundary, rightBoundary);\n Quaternion destination = new Quaternion(rotThis.idleQuat.x, rotThis.idleQuat.y, rotThis.idleQuat.z + rotThis.deltaRot, 1.0f);\n rotThis.deltaQuat = destination;\n while (timer \u0026lt; time)\n {\n stuffToRot.rotation = Quaternion.Slerp(rotThis.idleQuat, rotThis.deltaQuat, timer/time);\n //stuffToRot.rotation = Quaternion.Euler(stuffToRot.rotation.x, stuffToRot.rotation.y,\n // Mathf.LerpAngle(rotThis.idleRot, rotThis.idleRot + rotThis.deltaRot, timer / time));\n timer += (Time.realtimeSinceStartup - lastTime);\n lastTime = Time.realtimeSinceStartup;\n\n yield return null;\n }\n rotThis.rotState = QuatLerpInput.RotationStates.setBack;\n break;\n case (QuatLerpInput.RotationStates.setBack):\n while (timer \u0026lt; time)\n {\n stuffToRot.rotation = Quaternion.Slerp(rotThis.deltaQuat, rotThis.idleQuat, timer / time);\n //stuffToRot.rotation = Quaternion.Euler(stuffToRot.rotation.x, stuffToRot.rotation.y,\n // Mathf.LerpAngle(rotThis.idleRot + rotThis.deltaRot, rotThis.idleRot, timer / time));\n timer += (Time.realtimeSinceStartup - lastTime);\n lastTime = Time.realtimeSinceStartup;\n\n yield return null;\n }\n rotThis.rotState = QuatLerpInput.RotationStates.rotAway;\n break;\n }\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"39419037","answer_count":"2","comment_count":"1","creation_date":"2016-09-09 12:45:28.657 UTC","last_activity_date":"2016-09-09 20:08:53.767 UTC","last_edit_date":"2016-09-09 17:17:25.873 UTC","last_editor_display_name":"","last_editor_user_id":"6207726","owner_display_name":"","owner_user_id":"6207726","post_type_id":"1","score":"0","tags":"c#|unity3d","view_count":"111"} {"id":"29179258","title":"Why is my bash shell script working on v 3.2.5 and failing on 4.1.2?","body":"\u003cp\u003eMy bash shell script is working on Bash 3.2.5.\nI have an input file that contains the following content:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e1234567\n2345678\n3456789\n4567890\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eand a bash shell script that has the following code:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e#!/bin/bash\ncontent=($(cat data.txt | awk {'print $1'}))\nfor (( i=0 ; i\u0026lt;${#content[@]} ; i++ ))\ndo\n if (( i==0 ))\n then\n ele=`echo ${content[$i]}`\n else\n ele=`echo \",\"${content[$i]}`\n fi\n all=`echo $all$ele`\ndone\n# should be a string of csv: works on bash 3.2.5 - fails on bash 4.1.2\necho $all\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhen run with Bash 3.2.5 it outputs: (expected output; correct)\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e1234567,2345678,3456789,4567890\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eBut when run with Bash 4.1.2 it outputs: (the last number in the file; not correct)\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e,4567890\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhy is the same code failing in Bash 4.1.2?\u003c/p\u003e","accepted_answer_id":"29202562","answer_count":"4","comment_count":"7","creation_date":"2015-03-21 04:28:53.47 UTC","last_activity_date":"2015-03-23 02:46:35.337 UTC","last_edit_date":"2015-03-21 04:42:19.04 UTC","last_editor_display_name":"","last_editor_user_id":"15168","owner_display_name":"","owner_user_id":"1084593","post_type_id":"1","score":"0","tags":"arrays|linux|bash|shell","view_count":"363"} {"id":"44470847","title":"Exception in thread \"main\" java.lang.NumberFormatException:","body":"\u003cp\u003eI am executing my code in java But I am getting number exception error everytime. Please help\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eclass TestClass {\npublic static void main(String args[]) throws IOException {\n BufferedReader inp = new BufferedReader (new InputStreamReader(System.in));\n String input = inp.readLine();\n //Scanner sc = new Scanner(System.in);\n StringTokenizer stk = new StringTokenizer(input);\n int n = Integer.parseInt(stk.nextToken());\n int q = Integer.parseInt(stk.nextToken());\n int [] arr = new int[n];\n int [] st = new int [n];\n for(int i =0;i\u0026lt;n;i++){\n arr[i] = Integer.parseInt(stk.nextToken());\n st[i] = fib(arr[i]);\n\n } \nwhile(q\u0026gt;0){\n int l = Integer.parseInt(stk.nextToken());\n int r = Integer.parseInt(stk.nextToken());\n System.out.println(gcd(st,l,r));\n q--;\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI am continuously getting error message:\u003c/p\u003e\n\n\u003cblockquote\u003e\n \u003cp\u003eException in thread \"main\" java.lang.NumberFormatException: For input\n string: \"3 2\" at\n java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)\n at java.lang.Integer.parseInt(Integer.java:580) at\n java.lang.Integer.parseInt(Integer.java:615) at\n TestClass.main(Main.java:14)\u003c/p\u003e\n\u003c/blockquote\u003e","answer_count":"1","comment_count":"4","creation_date":"2017-06-10 07:40:59.973 UTC","last_activity_date":"2017-06-10 13:36:28.947 UTC","last_edit_date":"2017-06-10 09:05:23.7 UTC","last_editor_display_name":"","last_editor_user_id":"7098806","owner_display_name":"","owner_user_id":"8118771","post_type_id":"1","score":"1","tags":"java|parsing|exception|bufferedreader|parseint","view_count":"162"} -{"id":"42880601","title":"Identifying 'upstream' merge commits, not from within a fork","body":"\u003cp\u003eI am trying to identify pull request merge commits in the git history. \u003c/p\u003e\n\n\u003cp\u003eWe can normally use something like:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003egit log --merges |grep 'Merge pull request'`\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHowever, I am part of a distributed project with several repository forks, and have found that pull request merge commits that were part of the fork's development stream are polluting this output. This is even observed in Github's UI.\u003c/p\u003e\n\n\u003cp\u003eExample:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e18b389... Merge pull request #2222 from Fork/master \u0026lt;-- Fork/master to Upstream/master for feature X - Want.\nea3e5b... Merge pull request #12 from Fork/feature-x \u0026lt;-- Fork/feature-x to Fork/master - Dont want.\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI would like to isolate only merge commits between forks and upstream, not between branches of forks or forks-of-a-fork. Is this possible?\u003c/p\u003e\n\n\u003cp\u003eMy actual goal is to be able to identify all pull request merge commit SHAs between a range of commits, but these errant commits pollute the results with references to unrelated PRs - there is no distinction between fork and upstream in the commit message.\u003c/p\u003e","answer_count":"1","comment_count":"2","creation_date":"2017-03-18 22:24:02.343 UTC","favorite_count":"1","last_activity_date":"2017-03-19 10:23:51.71 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"61113","post_type_id":"1","score":"2","tags":"git|github","view_count":"30"} +{"id":"42880601","title":"Identifying 'upstream' merge commits, not from within a fork","body":"\u003cp\u003eI am trying to identify pull request merge commits in the git history. \u003c/p\u003e\n\n\u003cp\u003eWe can normally use something like:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003egit log --merges |grep 'Merge pull request'`\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHowever, I am part of a distributed project with several repository forks, and have found that pull request merge commits that were part of the fork's development stream are polluting this output. This is even observed in Github's UI.\u003c/p\u003e\n\n\u003cp\u003eExample:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e18b389... Merge pull request #2222 from Fork/main \u0026lt;-- Fork/main to Upstream/main for feature X - Want.\nea3e5b... Merge pull request #12 from Fork/feature-x \u0026lt;-- Fork/feature-x to Fork/main - Dont want.\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI would like to isolate only merge commits between forks and upstream, not between branches of forks or forks-of-a-fork. Is this possible?\u003c/p\u003e\n\n\u003cp\u003eMy actual goal is to be able to identify all pull request merge commit SHAs between a range of commits, but these errant commits pollute the results with references to unrelated PRs - there is no distinction between fork and upstream in the commit message.\u003c/p\u003e","answer_count":"1","comment_count":"2","creation_date":"2017-03-18 22:24:02.343 UTC","favorite_count":"1","last_activity_date":"2017-03-19 10:23:51.71 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"61113","post_type_id":"1","score":"2","tags":"git|github","view_count":"30"} {"id":"9276807","title":"What's the advantage of a Java-5 ThreadPoolExecutor over a Java-7 ForkJoinPool?","body":"\u003cp\u003eJava 5 has introduced support for asynchronous task execution by a thread pool in the form of the Executor framework, whose heart is the thread pool implemented by java.util.concurrent.ThreadPoolExecutor. Java 7 has added an alternative thread pool in the form of java.util.concurrent.ForkJoinPool.\u003c/p\u003e\n\n\u003cp\u003eLooking at their respective API, ForkJoinPool provides a superset of ThreadPoolExecutor's functionality in standard scenarios (though strictly speaking ThreadPoolExecutor offers more opportunities for tuning than ForkJoinPool). Adding to this the observation that \nfork/join tasks seem to be faster (possibly due to the work stealing scheduler), need definitely fewer threads (due to the non-blocking join operation), one might get the impression that ThreadPoolExecutor has been superseded by ForkJoinPool.\u003c/p\u003e\n\n\u003cp\u003eBut is this really correct? All the material I have read seems to sum up to a rather vague distinction between the two types of thread pools: \u003c/p\u003e\n\n\u003cul\u003e\n\u003cli\u003eForkJoinPool is for many, dependent, task-generated, short, hardly ever blocking (i.e. compute-intensive) tasks\u003c/li\u003e\n\u003cli\u003eThreadPoolExecutor is for few, independent, externally-generated, long, sometimes blocking tasks\u003c/li\u003e\n\u003c/ul\u003e\n\n\u003cp\u003eIs this distinction correct at all? Can we say anything more specific about this?\u003c/p\u003e","accepted_answer_id":"10366441","answer_count":"4","comment_count":"0","creation_date":"2012-02-14 12:23:21.367 UTC","favorite_count":"13","last_activity_date":"2016-05-06 15:19:51.703 UTC","last_edit_date":"2016-01-18 13:23:27.393 UTC","last_editor_display_name":"","last_editor_user_id":"4999394","owner_display_name":"","owner_user_id":"1208965","post_type_id":"1","score":"31","tags":"java|parallel-processing|threadpool|threadpoolexecutor|forkjoinpool","view_count":"4181"} {"id":"10883651","title":"How can I generate a new row out of two other rows in Postgres?","body":"\u003cp\u003eI have some data in a Postgres table that looks like this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e1 apple datetime1\n2 orange datetime2\n3 apple datetime3\n4 orange datetime4\n5 apple datetime5\n6 orange datetime6\n.\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe datetime is always in ascending order and the majority of times the apple rows are inserted first and orange second with some exceptions that I have to catch and eliminate.\u003c/p\u003e\n\n\u003cp\u003eWhat I practically need is a Postgres query that will pair apples and oranges only: \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e1 apple datetime1 2 orange datetime2\n3 apple datetime3 4 orange datetime4\n5 apple datetime5 6 orange datetime6\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eApples should never be paired with other apples and oranges should never be paired with other oranges.\u003c/p\u003e\n\n\u003cp\u003eThere are couple of conditions:\u003c/p\u003e\n\n\u003cp\u003e1) In the newly generated rows apple should always be first and orange second.\u003c/p\u003e\n\n\u003cp\u003e2) Always pair apple and orange rows with the closest datetimes and ignore the other rows.\u003c/p\u003e\n\n\u003cp\u003eFor example if I have the original data looking like this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e1 apple datetime1\n2 apple datetime2\n3 orange datetime3\n4 orange datetime4\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003epair \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e2 apple datetime2 3 orange datetime3\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eand ignore rows\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e1 apple datetime1\n4 orange datetime4\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAny ideas how to do this in Postgres?\u003c/p\u003e","accepted_answer_id":"10884184","answer_count":"4","comment_count":"5","creation_date":"2012-06-04 15:11:30.987 UTC","last_activity_date":"2012-06-04 16:10:20.237 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"509807","post_type_id":"1","score":"1","tags":"sql|postgresql","view_count":"131"} {"id":"28719086","title":"How to generate multiple SVG's in a Meteor.js #each wrapper","body":"\u003cp\u003eHi there I currently have a template helper that returns me an array with various values used to generate different rows in a table in my HTML.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;template name=\"stop\"\u0026gt; \n {{#each thumb}}\n\n \u0026lt;tr\u0026gt;\n \u0026lt;td\u0026gt;\n \u0026lt;h2\u0026gt; Do you like this product? \u0026lt;/h2\u0026gt;\n \u0026lt;h2\u0026gt;{{text}}\u0026lt;/h2\u0026gt;\n \u0026lt;svg id=\"donutChart\"\u0026gt; \u0026lt;/svg\u0026gt;\n \u0026lt;/td\u0026gt;\n \u0026lt;/tr\u0026gt;\n {{/each}}\n\n\u0026lt;/template\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eIt also contains a svg tag which I also want to generate a graph for each element generated as a table row and this is what the template helper looks like.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e Template.stop.helpers({\n 'thumb': function(data) {\n var result = tweetImages.findOne();\n var newResult = [];\n for (var i = 0; i \u0026lt; result.data.length; i++) {\n newResult[i] = {\n data: result.data[i],\n text: result.text[i]\n };\n }\n console.log(newResult)\n return newResult;\n }\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI'm trying to create a pie reactive pie chart for each element in the table however I don't seem to be able to access the svg in the stop template.\u003c/p\u003e\n\n\u003cp\u003eThe d3 code works fine outside that table but cant seem to be generated for each element of the table because it can't access the svg element.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eTemplate.donutChart.rendered = function() {\n\n//my d3 code is here\n\n\n\n //Width and height\n var w = 300;\n var h = 300;\n var center = w / 2;\n var outerRadius = w / 2;\n var innerRadius = 0;\n var radius = 150;\n var arc = d3.svg.arc()\n .innerRadius(40)\n .outerRadius(radius + 10 - 25);\n\n var pie = d3.layout.pie()\n .sort(null)\n .value(function(d) {\n return d.data;\n });\n\n\n //Create SVG element \n var svg = d3.select(\"#donutChart\")\n .attr(\"width\", w)\n .attr(\"height\", h)\n .attr(\"transform\", \"translate(\" + 200 + \",\" + 100 + \")\");\n\n // GROUP FOR CENTER TEXT\n var center_group = svg.append(\"svg:g\")\n .attr(\"class\", \"ctrGroup\")\n .attr(\"transform\", \"translate(\" + (w / 2) + \",\" + (h / 2) + \")\");\n\n // CENTER LABEL\n var pieLabel = center_group.append(\"svg:text\")\n .attr(\"dy\", \".35em\").attr(\"class\", \"chartLabel\")\n .attr(\"text-anchor\", \"middle\")\n .text(\"Clothes\")\n .attr(\"fill\", \"white\");\n\n\n Deps.autorun(function() {\n var modifier = {\n fields: {\n value: 1\n }\n };\n\n\n Deps.autorun(function() {\n\n var arcs = svg.selectAll(\"g.arc\")\n .data(pie(players))\n\n var arcOutter = d3.svg.arc()\n .innerRadius(outerRadius - 10)\n .outerRadius(outerRadius);\n\n var arcPhantom = d3.svg.arc()\n .innerRadius(-180)\n .outerRadius(outerRadius + 180);\n var newGroups =\n arcs\n .enter()\n .append(\"g\")\n .attr(\"class\", \"arc\")\n .attr(\"transform\", \"translate(\" + 150 + \",\" + 150 + \")\")\n\n //Set up outter arc groups\n var outterArcs = svg.selectAll(\"g.outter-arc\")\n .data(pie(players))\n .enter()\n .append(\"g\")\n .attr(\"class\", \"outter-arc\")\n .attr(\"transform\", \"translate(\" + 150 + \", \" + 150 + \")\");\n\n //Set up phantom arc groups\n var phantomArcs = svg.selectAll(\"g.phantom-arc\")\n .data(pie(players))\n .enter()\n .append(\"g\")\n .attr(\"class\", \"phantom-arc\")\n .attr(\"transform\", \"translate(\" + center + \", \" + center + \")\");\n\n\n outterArcs.append(\"path\")\n .attr(\"fill\", function(d, i) {\n return slickColor[i];\n })\n .attr(\"fill-opacity\", 0.85)\n .attr(\"d\", arcOutter).style('stroke', '#0ca7d2')\n .style('stroke-width', 2)\n\n\n //Draw phantom arc paths\n phantomArcs.append(\"path\")\n .attr(\"fill\", 'white')\n .attr(\"fill-opacity\", 0.1)\n .attr(\"d\", arcPhantom).style('stroke', '#0ca7d2')\n .style('stroke-width', 5);\n\n\n //Draw arc paths\n newGroups\n .append(\"path\")\n .attr(\"fill\", function(d, i) {\n return slickColor[i];\n })\n .attr(\"d\", arc);\n\n //Labels\n newGroups\n .append(\"text\")\n\n .attr(\"transform\", function(d) {\n return \"translate(\" + arc.centroid(d) + \")\";\n })\n .attr(\"text-anchor\", \"middle\")\n .text(function(d) {\n return d.value;\n })\n .style(\"font-size\", function(d) {\n return 24;\n })\n\n\n\n svg.selectAll(\"g.phantom-arc\")\n .transition()\n .select('path')\n .attrTween(\"d\", function(d) {\n this._current = this._current || d;\n var interpolate = d3.interpolate(this._current, d);\n this._current = interpolate(0);\n return function(t) {\n return arc(interpolate(t));\n };\n });\n\n\n arcs\n .transition()\n .select('path')\n .attrTween(\"d\", function(d) {\n this._current = this._current || d;\n var interpolate = d3.interpolate(this._current, d);\n this._current = interpolate(0);\n return function(t) {\n return arc(interpolate(t));\n };\n });\n\n arcs\n .transition()\n .select('text')\n .attr(\"transform\", function(d) {\n return \"translate(\" + arc.centroid(d) + \")\";\n })\n .text(function(d) {\n return d.value;\n })\n .attr(\"fill\", function(d, i) {\n return textColor[i];\n })\n\n arcs\n .exit()\n .remove();\n });\n\n });\n\n\n }\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e}\u003c/p\u003e\n\n\u003cp\u003eI can't seem to find much information on using d3.js or SVG's within a templates #each wrapper. Any help would be truly appreciated.\u003c/p\u003e","answer_count":"1","comment_count":"2","creation_date":"2015-02-25 12:30:08.1 UTC","last_activity_date":"2015-02-25 19:05:21.437 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"3096348","post_type_id":"1","score":"1","tags":"javascript|html|templates|d3.js|meteor","view_count":"232"} @@ -3193,7 +3193,7 @@ {"id":"39869672","title":"How to name a module without conflict with variable name?","body":"\u003cp\u003eI found sometime it's difficult to name a module without conflicting with a variable name latter. For example, I have a following class:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eclass Petition(object):\n def __init__(self, signature_count_requirement):\n self._signature_count_requirement = signature_count_requirement\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eand a following function:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003edef check_if_someone_can_sponsor_a_petition(someone):\n pass\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eso it's nature to write code like this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eif check_if_someone_can_sponsor_a_petition(a):\n petition = Petition(3)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThen I want to put the function and the \u003ccode\u003ePetition\u003c/code\u003e class into a module. Now what should I call the module? It seems nature to name the module \u003ccode\u003epetition\u003c/code\u003e. However it's very easy to conflict with variable names latter like this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eimport petition\nif petition.check_if_someone_can_sponsor_a_petition(a):\n petition = petition.Petition(3) # this is ugly.\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe \u003ccode\u003edatetime\u003c/code\u003e module could be a better(worse?) example. When came across with name \u003ccode\u003edatetime\u003c/code\u003e in code, I often had to make sure it's the module or the class name or someone's variable name.\u003c/p\u003e\n\n\u003cp\u003eIs there any good conventions about how to name a module to avoid conflict with a variable name latter?\u003c/p\u003e","answer_count":"4","comment_count":"6","creation_date":"2016-10-05 09:03:28.787 UTC","last_activity_date":"2016-10-05 09:38:00.527 UTC","last_edit_date":"2016-10-05 09:09:27.447 UTC","last_editor_display_name":"","last_editor_user_id":"355230","owner_display_name":"","owner_user_id":"308587","post_type_id":"1","score":"1","tags":"python","view_count":"251"} {"id":"31535913","title":"How to use trigger mysql for filter","body":"\u003cp\u003eI have a code trigger before insert in MySQLfor filter data but it doesn't work. This is the logical of my code, if new.suhu_udara \u003e 30 and new.suhu_udara - old.suhu_udara \u0026lt;10 then set new.suhu_udara = null \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eUSE `cuaca_maritim`;\nDELIMITER $$\nDROP TRIGGER IF EXISTS cuaca_maritim.filter$$\nUSE `cuaca_maritim`$$\nCREATE DEFINER=`root`@`localhost` TRIGGER `filter` BEFORE INSERT ON data_cuaca` FOR EACH ROW\nif( new.suhu_udara \u0026lt; 21.5 or new.kelembaban_udara \u0026lt; 22 or new.tekanan_udara \u0026lt; 1002.4) then\nSet new.suhu_udara = null ;\nelseif ( new.suhu_udara \u0026gt; 37.6 or new.kelembaban_udara \u0026gt; 100 or new.tekanan_udara \u0026gt;1018.9 or new.kecepatan_angin \u0026gt; 44) then\nSet new.kelembaban_udara = null ;\nend if$$\nDELIMITER ;\nUSE `cuaca_maritim`;\n\nDELIMITER $$\n\nDROP TRIGGER IF EXISTS cuaca_maritim.data_cuaca_AFTER_UPDATE$$\nUSE `cuaca_maritim`$$\nCREATE DEFINER = CURRENT_USER TRIGGER `cuaca_maritim`.`data_cuaca_AFTER_UPDATE` AFTER UPDATE ON `data_cuaca` FOR EACH ROW\nif ( old.suhu_udara - new.suhu_udara \u0026gt; 10) then \nset new.suhu_udara=null ;\nend if\n $$\nDELIMITER ;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eCan you help mex this code? thank you\u003c/p\u003e","answer_count":"1","comment_count":"1","creation_date":"2015-07-21 10:00:05.347 UTC","last_activity_date":"2015-07-21 10:17:03.497 UTC","last_edit_date":"2015-07-21 10:17:03.497 UTC","last_editor_display_name":"","last_editor_user_id":"4771450","owner_display_name":"","owner_user_id":"4771450","post_type_id":"1","score":"0","tags":"mysql","view_count":"84"} {"id":"7011153","title":"Remove DTD from XML SSIS","body":"\u003cp\u003eHi all im struggling with this one. Ive got a foreach loop that will loop over a folder that contains xml files that i want to import there data into a database. The problem is the xml files have a dtd, theres nothing i can do to prevent this from being attached to the xml file. So i need some way of removing the dtd. Ive searched google and various forums and come up blank. Just wondered if anyone has any ideas?\u003c/p\u003e","accepted_answer_id":"7023685","answer_count":"2","comment_count":"0","creation_date":"2011-08-10 12:59:57.647 UTC","favorite_count":"0","last_activity_date":"2011-08-11 09:34:29.157 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"838656","post_type_id":"1","score":"0","tags":"ssis|dtd","view_count":"1757"} -{"id":"28110595","title":"Assign MPI Processes to Nodes","body":"\u003cp\u003eI have an MPI program that uses a master process and multiple worker processes. I want to have the master process running on a single compute node alone, while the worker processes run on another node. The worker processes should be assigned by socket (for example as it is done with the \u003ccode\u003e--map-by-socket\u003c/code\u003e option). Is there any option to assign the master process and the working processes to different nodes or to assign it manually, by consulting the rank maybe?\u003c/p\u003e\n\n\u003cp\u003eThanks\u003c/p\u003e","accepted_answer_id":"28120421","answer_count":"2","comment_count":"0","creation_date":"2015-01-23 13:05:01.14 UTC","last_activity_date":"2015-01-23 23:31:42.183 UTC","last_edit_date":"2015-01-23 15:26:24.907 UTC","last_editor_display_name":"","last_editor_user_id":"491687","owner_display_name":"","owner_user_id":"3523344","post_type_id":"1","score":"1","tags":"mpi|openmpi","view_count":"548"} +{"id":"28110595","title":"Assign MPI Processes to Nodes","body":"\u003cp\u003eI have an MPI program that uses a cluster manager process and multiple worker processes. I want to have the cluster manager process running on a single compute node alone, while the worker processes run on another node. The worker processes should be assigned by socket (for example as it is done with the \u003ccode\u003e--map-by-socket\u003c/code\u003e option). Is there any option to assign the cluster manager process and the working processes to different nodes or to assign it manually, by consulting the rank maybe?\u003c/p\u003e\n\n\u003cp\u003eThanks\u003c/p\u003e","accepted_answer_id":"28120421","answer_count":"2","comment_count":"0","creation_date":"2015-01-23 13:05:01.14 UTC","last_activity_date":"2015-01-23 23:31:42.183 UTC","last_edit_date":"2015-01-23 15:26:24.907 UTC","last_editor_display_name":"","last_editor_user_id":"491687","owner_display_name":"","owner_user_id":"3523344","post_type_id":"1","score":"1","tags":"mpi|openmpi","view_count":"548"} {"id":"31506045","title":"XML documentation for doc generators bloats files","body":"\u003cp\u003eI'm using Doxygen to generate documentation based on the XML commenting on my source files. The problem I have though is the amount of bloat in the file. There's more comments than there are actual lines of code.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eusing System;\nusing System.Diagnostics;\nusing System.Threading;\nusing System.Threading.Tasks;\n\n/// \u0026lt;summary\u0026gt;\n/// \u0026lt;para\u0026gt;\n/// The Engine Timer allows for starting a timer that will execute a callback at a given interval.\n/// \u0026lt;/para\u0026gt;\n/// \u0026lt;para\u0026gt;\n/// The timer may fire:\n/// - infinitely at the given interval\n/// - fire once\n/// - fire _n_ number of times.\n/// \u0026lt;/para\u0026gt;\n/// \u0026lt;para\u0026gt;\n/// The Engine Timer will stop its self when it is disposed of.\n/// \u0026lt;/para\u0026gt;\n/// \u0026lt;para\u0026gt;\n/// The Timer requires you to provide it an instance that will have an operation performed against it.\n/// The callback will be given the generic instance at each interval fired.\n/// \u0026lt;/para\u0026gt;\n/// \u0026lt;para\u0026gt;\n/// In the following example, the timer is given an instance of an IPlayer. \n/// It starts the timer off with a 30 second delay before firing the callback for the first time.\n/// It tells the timer to fire every 60 seconds with 0 as the number of times to fire. When 0 is provided, it will run infinitely.\n/// Lastly, it is given a callback, which will save the player every 60 seconds.\n/// @code\n/// var timer = new EngineTimer\u0026lt;IPlayer\u0026gt;(new DefaultPlayer());\n/// timer.StartAsync(30000, 6000, 0, (player, timer) =\u0026gt; player.Save());\n/// @endcode\n/// \u0026lt;/para\u0026gt;\n/// \u0026lt;/summary\u0026gt;\n/// \u0026lt;typeparam name=\"T\"\u0026gt;The type that will be provided when the timer callback is invoked.\u0026lt;/typeparam\u0026gt;\npublic sealed class EngineTimer\u0026lt;T\u0026gt; : CancellationTokenSource, IDisposable\n{\n /// \u0026lt;summary\u0026gt;\n /// The timer task\n /// \u0026lt;/summary\u0026gt;\n private Task timerTask;\n\n /// \u0026lt;summary\u0026gt;\n /// How many times we have fired the timer thus far.\n /// \u0026lt;/summary\u0026gt;\n private long fireCount = 0;\n\n /// \u0026lt;summary\u0026gt;\n /// Initializes a new instance of the \u0026lt;see cref=\"EngineTimer{T}\"/\u0026gt; class.\n /// \u0026lt;/summary\u0026gt;\n /// \u0026lt;param name=\"callback\"\u0026gt;The callback.\u0026lt;/param\u0026gt;\n /// \u0026lt;param name=\"state\"\u0026gt;The state.\u0026lt;/param\u0026gt;\n public EngineTimer(T state)\n {\n this.StateData = state;\n }\n\n /// \u0026lt;summary\u0026gt;\n /// Gets the object that was provided to the timer when it was instanced.\n /// This object will be provided to the callback at each interval when fired.\n /// \u0026lt;/summary\u0026gt;\n public T StateData { get; private set; }\n\n /// \u0026lt;summary\u0026gt;\n /// Gets a value indicating whether the engine timer is currently running.\n /// \u0026lt;/summary\u0026gt;\n public bool IsRunning { get; private set; }\n\n /// \u0026lt;summary\u0026gt;\n /// \u0026lt;para\u0026gt;\n /// Starts the timer, firing a synchronous callback at each interval specified until `numberOfFires` has been reached.\n /// If `numberOfFires` is 0, then the callback will be called indefinitely until the timer is manually stopped.\n /// \u0026lt;/para\u0026gt;\n /// \u0026lt;para\u0026gt;\n /// The following example shows how to start a timer, providing it a callback.\n /// \u0026lt;/para\u0026gt;\n /// @code\n /// var timer = new EngineTimer\u0026lt;IPlayer\u0026gt;(new DefaultPlayer());\n /// double startDelay = TimeSpan.FromSeconds(30).TotalMilliseconds;\n /// double interval = TimeSpan.FromMinutes(10).TotalMilliseconds;\n /// int numberOfFires = 0;\n /// \n /// timer.Start(\n /// startDelay, \n /// interval, \n /// numberOfFires, \n /// (player, timer) =\u0026gt; player.Save());\n /// @endcode\n /// \u0026lt;/summary\u0026gt;\n /// \u0026lt;param name=\"startDelay\"\u0026gt;\n /// \u0026lt;para\u0026gt;\n /// The `startDelay` is used to specify how much time must pass before the timer can invoke the callback for the first time.\n /// If 0 is provided, then the callback will be invoked immediately upon starting the timer.\n /// \u0026lt;/para\u0026gt;\n /// \u0026lt;para\u0026gt;\n /// The `startDelay` is measured in milliseconds.\n /// \u0026lt;/para\u0026gt;\n /// \u0026lt;/param\u0026gt;\n /// \u0026lt;param name=\"interval\"\u0026gt;The interval in milliseconds.\u0026lt;/param\u0026gt;\n /// \u0026lt;param name=\"numberOfFires\"\u0026gt;Specifies the number of times to invoke the timer callback when the interval is reached. Set to 0 for infinite.\u0026lt;/param\u0026gt;\n public void Start(double startDelay, double interval, int numberOfFires, Action\u0026lt;T, EngineTimer\u0026lt;T\u0026gt;\u0026gt; callback)\n {\n this.IsRunning = true;\n\n this.timerTask = Task\n .Delay(TimeSpan.FromMilliseconds(startDelay), this.Token)\n .ContinueWith(\n (task, state) =\u0026gt; RunTimer(task, (Tuple\u0026lt;Action\u0026lt;T, EngineTimer\u0026lt;T\u0026gt;\u0026gt;, T\u0026gt;)state, interval, numberOfFires),\n Tuple.Create(callback, this.StateData),\n CancellationToken.None,\n TaskContinuationOptions.ExecuteSynchronously | TaskContinuationOptions.OnlyOnRanToCompletion,\n TaskScheduler.Default);\n }\n\n /// \u0026lt;summary\u0026gt;\n /// Starts the specified start delay.\n /// \u0026lt;/summary\u0026gt;\n /// \u0026lt;param name=\"startDelay\"\u0026gt;The start delay in milliseconds.\u0026lt;/param\u0026gt;\n /// \u0026lt;param name=\"interval\"\u0026gt;The interval in milliseconds.\u0026lt;/param\u0026gt;\n /// \u0026lt;param name=\"numberOfFires\"\u0026gt;Specifies the number of times to invoke the timer callback when the interval is reached. Set to 0 for infinite.\u0026lt;/param\u0026gt;\n public void StartAsync(double startDelay, double interval, int numberOfFires, Func\u0026lt;T, EngineTimer\u0026lt;T\u0026gt;, Task\u0026gt; callback)\n {\n this.IsRunning = true;\n\n this.timerTask = Task\n .Delay(TimeSpan.FromMilliseconds(startDelay), this.Token)\n .ContinueWith(\n async (task, state) =\u0026gt; await RunTimerAsync(task, (Tuple\u0026lt;Func\u0026lt;T, EngineTimer\u0026lt;T\u0026gt;, Task\u0026gt;, T\u0026gt;)state, interval, numberOfFires),\n Tuple.Create(callback, this.StateData),\n CancellationToken.None,\n TaskContinuationOptions.ExecuteSynchronously | TaskContinuationOptions.OnlyOnRanToCompletion,\n TaskScheduler.Default);\n }\n\n /// \u0026lt;summary\u0026gt;\n /// Stops the timer for this instance.\n /// Stopping the timer will not dispose of the EngineTimer, allowing you to restart the timer if you need to.\n /// \u0026lt;/summary\u0026gt;\n public void Stop()\n {\n if (!this.IsCancellationRequested)\n {\n this.Cancel();\n } \n this.IsRunning = false;\n }\n\n /// \u0026lt;summary\u0026gt;\n /// Stops the timer and releases the unmanaged resources used by the \u0026lt;see cref=\"T:System.Threading.CancellationTokenSource\" /\u0026gt; class and optionally releases the managed resources.\n /// \u0026lt;/summary\u0026gt;\n /// \u0026lt;param name=\"disposing\"\u0026gt;true to release both managed and unmanaged resources; false to release only unmanaged resources.\u0026lt;/param\u0026gt;\n protected override void Dispose(bool disposing)\n {\n if (disposing)\n {\n this.IsRunning = false;\n this.Cancel();\n }\n\n base.Dispose(disposing);\n }\n\n private async Task RunTimer(Task task, Tuple\u0026lt;Action\u0026lt;T, EngineTimer\u0026lt;T\u0026gt;\u0026gt;, T\u0026gt; state, double interval, int numberOfFires)\n {\n while (!this.IsCancellationRequested)\n {\n // Only increment if we are supposed to.\n if (numberOfFires \u0026gt; 0)\n {\n this.fireCount++;\n }\n\n state.Item1(state.Item2, this);\n await PerformTimerCancellationCheck(interval, numberOfFires);\n }\n }\n\n private async Task RunTimerAsync(Task task, Tuple\u0026lt;Func\u0026lt;T, EngineTimer\u0026lt;T\u0026gt;, Task\u0026gt;, T\u0026gt; state, double interval, int numberOfFires)\n {\n while (!this.IsCancellationRequested)\n {\n // Only increment if we are supposed to.\n if (numberOfFires \u0026gt; 0)\n {\n this.fireCount++;\n }\n\n await state.Item1(state.Item2, this);\n await PerformTimerCancellationCheck(interval, numberOfFires);\n }\n }\n\n private async Task PerformTimerCancellationCheck(double interval, int numberOfFires)\n {\n // If we have reached our fire count, stop. If set to 0 then we fire until manually stopped.\n if (numberOfFires \u0026gt; 0 \u0026amp;\u0026amp; this.fireCount \u0026gt;= numberOfFires)\n {\n this.Stop();\n }\n\n await Task.Delay(TimeSpan.FromMilliseconds(interval), this.Token).ConfigureAwait(false);\n }\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eCan you move the documentation in to different files, leaving just the API usage XML documentation on the members, while more exhaustive documentation (with source examples) exist elsewhere. With the more exhaustive documentation being what is generated while maintaining its relationship to the class on the generated documentation?\u003c/p\u003e","answer_count":"0","comment_count":"3","creation_date":"2015-07-19 21:20:48.17 UTC","last_activity_date":"2015-07-19 21:20:48.17 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1815321","post_type_id":"1","score":"0","tags":"c#|xml|doxygen|documentation-generation","view_count":"42"} {"id":"38366822","title":"Regular expression for finding strings containing only white space","body":"\u003cp\u003eHi I have tried the following and it seems not working. Can you explain me why ?\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epublic class Solution {\npublic static void main(String[] args) {\n String abc =\" \";\n String regx = \".*[^\\\\s].*\";\n if (abc.matches(regx)) {\n System.out.println(\"true\");\n } else {\n System.out.println(\"false\");\n }\n\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e}\u003c/p\u003e\n\n\u003cblockquote\u003e\n \u003cp\u003eI have tried another case \u003c/p\u003e\n\u003c/blockquote\u003e\n\n\u003cpre\u003e\u003ccode\u003epublic class Solution {\npublic static void main(String[] args) {\n String abc =\" \";\n String regx = \".*[^\\\\s].*\";\n Pattern r = Pattern.compile(regx);\n Matcher m = r.matcher(abc);\n if (m.find()) {\n System.out.println(true);\n } else {\n System.out.println(false);\n }\n\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cblockquote\u003e\n \u003cp\u003eI have given abc = \" \",abc = \" \". in all the case i am getting false as output.I dont understand why ?\u003c/p\u003e\n\u003c/blockquote\u003e\n\n\u003cp\u003eThanks.\u003c/p\u003e","answer_count":"0","comment_count":"5","creation_date":"2016-07-14 06:19:02.067 UTC","last_activity_date":"2016-07-14 06:19:02.067 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"3843853","post_type_id":"1","score":"0","tags":"java|regex","view_count":"35"} {"id":"41759604","title":"Android wifimanager enable network seems to enable wrong network","body":"\u003cp\u003eI have made an android app which on startup gets the current wifi network and connects to a different one. At least that is what it is supposed to do:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ewifiInfo = wifiManager.getConnectionInfo();\nOldNetworkID = wifiInfo.getNetworkId(); //save current network\nWDTNetworkID = wifiManager.addNetwork(wificonfiguration); //add new network\nwifiManager.disconnect();\nwifiManager.enableNetwork(WDTNetworkID, true); //enable new network and disable all others\nwifiManager.reconnect();\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhen I debug I can see \u003ccode\u003ewificonfiguration\u003c/code\u003e contains the right SSID (the SSID of the new network).\u003c/p\u003e\n\n\u003cp\u003eAfter \u003ccode\u003eaddNetwork()\u003c/code\u003e I see that \u003ccode\u003ewifiManager.getConfiguredNetworks()\u003c/code\u003e contains this new network with the right SSID and the same networkID as \u003ccode\u003eWDTNetworkID\u003c/code\u003e. At this point the network is enabled.\u003c/p\u003e\n\n\u003cp\u003eBut after \u003ccode\u003eenableNetwork()\u003c/code\u003e instead of \u003ccode\u003eWDTNetworkID\u003c/code\u003e enabled and the rest disabled I see that \u003ccode\u003eOldNetworkID\u003c/code\u003e is enabled and the rest is disabled.\u003c/p\u003e\n\n\u003cp\u003eAm I doing something wrong?\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"https://i.stack.imgur.com/FioZC.png\" rel=\"nofollow noreferrer\"\u003e\u003cimg src=\"https://i.stack.imgur.com/FioZC.png\" alt=\"This is what it looks like\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eI have added a picture of a couple of watches while debugging.\nYou can see here that the old network is enabled and the rest is disabled.\u003c/p\u003e","accepted_answer_id":"41762741","answer_count":"1","comment_count":"0","creation_date":"2017-01-20 08:57:15.437 UTC","last_activity_date":"2017-01-20 11:35:18.94 UTC","last_edit_date":"2017-01-20 09:04:14.98 UTC","last_editor_display_name":"","last_editor_user_id":"7307021","owner_display_name":"","owner_user_id":"7307021","post_type_id":"1","score":"0","tags":"java|android|wifimanager","view_count":"175"} @@ -3287,7 +3287,7 @@ {"id":"23450664","title":"Comparing histograms without white color included OpenCV","body":"\u003cp\u003eIs there a way that compares histograms but for example white color to be excluded and so white color doesn't affect onto the comparison. \u003c/p\u003e","accepted_answer_id":"23453884","answer_count":"1","comment_count":"0","creation_date":"2014-05-03 22:54:17.09 UTC","last_activity_date":"2014-05-04 07:51:29.447 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"3577807","post_type_id":"1","score":"0","tags":"opencv|image-processing|filter|comparison|histogram","view_count":"516"} {"id":"25080057","title":"MongoDB extension is not working in Wamp","body":"\u003cp\u003eI want to use MongoDB in my Symfony2 project. I added in composer.json (required section)\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e \"doctrine/mongodb\": \"1.2.*@dev\",\n \"doctrine/mongodb-odm\": \"1.0.*@dev\",\n \"doctrine/mongodb-odm-bundle\": \"3.0.*@dev\"\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eBut when I updated composer, an error occurred\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eProblem 1\n- Installation request for doctrine/mongodb 1.2.*@dev -\u0026gt; satisfiable by doctrine/mongodb[1.2.x-dev].\n- doctrine/mongodb 1.2.x-dev requires ext-mongo \u0026gt;=1.2.12,\u0026lt;1.6-dev -\u0026gt; the requested PHP extension mongo is missing from your system.\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI am using Wamp and I added (as indicated in \u003ca href=\"https://stackoverflow.com/questions/13523109/php-startup-mongo-unable-to-initialize-module\"\u003ethis\u003c/a\u003e post) php_mongo.dll in the ext directory. phpinfo() function indicates that Mongo is available\nWhen I press the Wamp button, \"php_mongo\" extension appears.\nHowever, when I execute \u003ccode\u003ephp -m\u003c/code\u003e, mongo extension isn't listed.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eC:\\wamp\\www\u0026gt;php --ini\nConfiguration File (php.ini) Path: C:\\Windows\nLoaded Configuration File: C:\\wamp\\bin\\php\\php5.4.16\\php.ini\nScan for additional .ini files in: (none)\nAdditional .ini files parsed: (none)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI don't have any file like php.ini in the C:\\Windows directory.\u003c/p\u003e","accepted_answer_id":"25096499","answer_count":"1","comment_count":"1","creation_date":"2014-08-01 12:14:56.403 UTC","last_activity_date":"2014-08-02 15:17:26.42 UTC","last_edit_date":"2017-05-23 10:30:05.69 UTC","last_editor_display_name":"","last_editor_user_id":"-1","owner_display_name":"","owner_user_id":"1960671","post_type_id":"1","score":"0","tags":"php|mongodb|symfony|module|wamp","view_count":"459"} {"id":"3154284","title":"How often to call DataContext.SubmitChanges() for a large number of inserts?","body":"\u003cp\u003eHow many \u003ccode\u003eInsertOnSubmit\u003c/code\u003e should I call before calling \u003ccode\u003eSubmitChanges\u003c/code\u003e? I'm adding data from a web service that can return tens of thousands of records one record at a time. The wrapper class around the web service exposes the records a an \u003ccode\u003eIEnumberable\u003c/code\u003e collection to hide an elaborate chunking mechanism.\u003c/p\u003e\n\n\u003cp\u003eAre there guidelines on how many inserts I should accumulate before submitting them?\u003c/p\u003e","accepted_answer_id":"3156793","answer_count":"4","comment_count":"1","creation_date":"2010-07-01 00:00:53.233 UTC","last_activity_date":"2013-08-12 18:26:46.98 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"150058","post_type_id":"1","score":"0","tags":"c#|.net|linq-to-sql|submitchanges","view_count":"2456"} -{"id":"43222578","title":"How to turn on the visibility of a \u003ca\u003e which is on the master page from code behind file?","body":"\u003cp\u003eHere is the snippet of the code inside my master page.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;section id=\"login\"\u0026gt;\n \u0026lt;asp:LoginView runat=\"server\" ViewStateMode=\"Disabled\"\u0026gt;\n \u0026lt;AnonymousTemplate\u0026gt;\n \u0026lt;ul\u0026gt;\n \u0026lt;li\u0026gt;\u0026lt;a id=\"loginLink\" runat=\"server\" href=\"~/Login.aspx\"\u0026gt;Log in\u0026lt;/a\u0026gt;\u0026lt;/li\u0026gt;\n \u0026lt;li\u0026gt;\u0026lt;a id=\"logoutLink\" runat=\"server\" href=\"#\" visible=\"false\"\u0026gt;Logout\u0026lt;/a\u0026gt;\u0026lt;/li\u0026gt;\n \u0026lt;/ul\u0026gt;\n \u0026lt;/AnonymousTemplate\u0026gt;\n \u0026lt;/asp:LoginView\u0026gt;\n\u0026lt;/section\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI would like to turn on the visibility of hyperlink with the id of \u003ccode\u003e#logoutlink\u003c/code\u003e from one of my pages' code behind file. I tried this way but didn't work.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eprotected void Page_Load(object sender, EventArgs e)\n{\n HyperLink x = (HyperLink)Master.FindControl(\"logoutLink\");\n x.Visible = true;\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAny help would be appreciated.\u003c/p\u003e","accepted_answer_id":"43223131","answer_count":"1","comment_count":"3","creation_date":"2017-04-05 05:32:23.85 UTC","last_activity_date":"2017-04-05 06:10:31.657 UTC","last_edit_date":"2017-04-05 05:56:14.873 UTC","last_editor_display_name":"","last_editor_user_id":"107625","owner_display_name":"","owner_user_id":"4067954","post_type_id":"1","score":"0","tags":"asp.net|master-pages","view_count":"37"} +{"id":"43222578","title":"How to turn on the visibility of a \u003ca\u003e which is on the cluster manager page from code behind file?","body":"\u003cp\u003eHere is the snippet of the code inside my cluster manager page.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;section id=\"login\"\u0026gt;\n \u0026lt;asp:LoginView runat=\"server\" ViewStateMode=\"Disabled\"\u0026gt;\n \u0026lt;AnonymousTemplate\u0026gt;\n \u0026lt;ul\u0026gt;\n \u0026lt;li\u0026gt;\u0026lt;a id=\"loginLink\" runat=\"server\" href=\"~/Login.aspx\"\u0026gt;Log in\u0026lt;/a\u0026gt;\u0026lt;/li\u0026gt;\n \u0026lt;li\u0026gt;\u0026lt;a id=\"logoutLink\" runat=\"server\" href=\"#\" visible=\"false\"\u0026gt;Logout\u0026lt;/a\u0026gt;\u0026lt;/li\u0026gt;\n \u0026lt;/ul\u0026gt;\n \u0026lt;/AnonymousTemplate\u0026gt;\n \u0026lt;/asp:LoginView\u0026gt;\n\u0026lt;/section\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI would like to turn on the visibility of hyperlink with the id of \u003ccode\u003e#logoutlink\u003c/code\u003e from one of my pages' code behind file. I tried this way but didn't work.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eprotected void Page_Load(object sender, EventArgs e)\n{\n HyperLink x = (HyperLink)ClusterManager.FindControl(\"logoutLink\");\n x.Visible = true;\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAny help would be appreciated.\u003c/p\u003e","accepted_answer_id":"43223131","answer_count":"1","comment_count":"3","creation_date":"2017-04-05 05:32:23.85 UTC","last_activity_date":"2017-04-05 06:10:31.657 UTC","last_edit_date":"2017-04-05 05:56:14.873 UTC","last_editor_display_name":"","last_editor_user_id":"107625","owner_display_name":"","owner_user_id":"4067954","post_type_id":"1","score":"0","tags":"asp.net|cluster-manager-pages","view_count":"37"} {"id":"11364329","title":"How do I combine these two tables so I have one which displays both State and Zip code?","body":"\u003cp\u003eI have two queries that find both the Zip codes, and the States for all the respondents in our database. Here they are\u003c/p\u003e\n\n\u003cp\u003eFor ZIP code:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eselect top 100 S.ID as SurveyID, S.SID, S.SurveyNumber, S.ABCSurveyName, SE.RespondentID, Q.name as QuestionName, rp.Condition as ZipCode\nfrom Surveys S \n join Sessions SE \n on S.id = SE.SurveyID \n join RespondentProfiles rp\n on RP.RespondentID = SE.RespondentID\n join Questions Q \n on Q.ID = rp.QuestionID\nwhere q.name = 'ZIP'\n and S.ID = 13900\n and Q.LK_RecordStatusID = 1\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eFor state:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eselect VW.ID as SurveyID, VW.SID, SurveyNumber, ABCSurveyName, RespondentID, VW.Name as QuestionName, st.Code as State\nfrom (\n select top 100 S.ID, S.SID, S.SurveyNumber, S.ABCSurveyName, SE.RespondentID, Q.name, rp.Condition \n from Surveys S \n join Sessions SE \n on S.id = SE.SurveyID \n join RespondentProfiles rp\n on RP.RespondentID = SE.RespondentID\n join Questions Q \n on Q.ID = rp.QuestionID\n where S.ID = 13900\n and q.name = 'STATE'\n and Q.LK_RecordStatusID = 1\n\n) VW\n join LK_States st\n on st.ID = vw.Condition\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThis works, but I'd like to have them all in one table, i.e. Zip Code and State.\u003c/p\u003e\n\n\u003cp\u003eThanks!\u003c/p\u003e\n\n\u003cp\u003equestions schema:\u003c/p\u003e\n\n\u003cp\u003eColumn_name Type Computed Length Prec Scale Nullable \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eTrimTrailingBlanks FixedLenNullInSource Collation\nID int no 4 10 0 no (n/a) (n/a) NULL\nSID nvarchar no 128 yes (n/a) (n/a) SQL_Latin1_General_CP1_CI_AS\nName nvarchar no 64 yes (n/a) (n/a) SQL_Latin1_General_CP1_CI_AS\nQuestionIdentifier nvarchar no 128 yes (n/a) (n/a) SQL_Latin1_General_CP1_CI_AS\nParentID int no 4 10 0 yes (n/a) (n/a) NULL\nLK_QuestionTypeID int no 4 10 0 yes (n/a) (n/a) NULL\nLK_QuestionCategoryID int no 4 10 0 yes (n/a) (n/a) NULL\nLK_IndustryID int no 4 10 0 yes (n/a) (n/a) NULL\nOptionMask nvarchar no 512 yes (n/a) (n/a) SQL_Latin1_General_CP1_CI_AS\nMetaTags ntext no 16 yes (n/a) (n/a) SQL_Latin1_General_CP1_CI_AS\nOrder int no 4 10 0 yes (n/a) (n/a) NULL\nRows int no 4 10 0 yes (n/a) (n/a) NULL\nColumns int no 4 10 0 yes (n/a) (n/a) NULL\nIsDisplay bit no 1 yes (n/a) (n/a) NULL\nAnswerLifespan int no 4 10 0 yes (n/a) (n/a) NULL\nCreateUserID int no 4 10 0 yes (n/a) (n/a) NULL\nCreateDate datetime no 8 yes (n/a) (n/a) NULL\nUpdateUserID int no 4 10 0 yes (n/a) (n/a) NULL\nUpdateDate datetime no 8 yes (n/a) (n/a) NULL\nLK_RecordStatusID bit no 1 yes (n/a) (n/a) NULL\nLK_QuestionClassID int no 4 10 0 yes (n/a) (n/a) NULL\nLK_QuestionVisibilityID int no 4 10 0 yes (n/a) (n/a) NULL\nDisplayLK_QuestionTypeID int no 4 10 0 yes (n/a) (n/a) NULL\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"11364954","answer_count":"2","comment_count":"7","creation_date":"2012-07-06 14:37:43.897 UTC","last_activity_date":"2012-07-06 21:28:08.443 UTC","last_edit_date":"2012-07-06 21:28:08.443 UTC","last_editor_display_name":"","last_editor_user_id":"763029","owner_display_name":"","owner_user_id":"763029","post_type_id":"1","score":"0","tags":"sql|sql-server|query-optimization","view_count":"113"} {"id":"31174727","title":"I am writing a script to embed Youtube or vimeo videos into magento product page","body":"\u003cp\u003eYoutube embed code has letters and vimeo embed code has numbers example v?cVxmbd5 and Vimeo is like Vimeo.com/6847539 . I am writing a script to pull the end of embed strings with letters to match it with top iframe and pull end of embed strings with no letters to match with bottom iframe. \u003c/p\u003e\n\n\u003cp\u003eThis script is supposed to embed videos into a video tab on the product view page. \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;?php\n$_product = $this-\u0026gt;getProduct();\nif ($_product-\u0026gt;getVideo())\n$videos = explode(', ', $_product-\u0026gt;getVideo());\n\nforeach ($videos as $video) {\n\nif (ctype_digit($video)) {\necho \"\u0026lt;iframe width = '560' height = '315' style = 'max-width:100%;' src = 'https://player.vimeo.com/video/\" . $video . \"' frameborder = '0' allowfullscreen\u0026gt;\u0026lt;/iframe\u0026gt;\";\n} else {\n\n\n echo \"\u0026lt;iframe width = '560' height = '315' style = 'max-width:100%;' src = 'http://www.youtube.com/embed/\" . $video . \"' frameborder = '0' allowfullscreen\u0026gt;\u0026lt;/iframe\u0026gt;\";\n\n}\n}\n\n?\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"0","comment_count":"4","creation_date":"2015-07-02 02:33:07.253 UTC","favorite_count":"2","last_activity_date":"2015-07-03 14:44:33.65 UTC","last_edit_date":"2015-07-03 14:44:33.65 UTC","last_editor_display_name":"","last_editor_user_id":"4676766","owner_display_name":"","owner_user_id":"4676766","post_type_id":"1","score":"1","tags":"php|magento|if-statement","view_count":"260"} {"id":"32801188","title":"How do I show my database data into TableView?","body":"\u003cp\u003eI am trying to show my database data into TableView. I have a database named info and there is two columns '\u003cstrong\u003efname\u003c/strong\u003e' and '\u003cstrong\u003elname\u003c/strong\u003e' into the table '\u003cstrong\u003edata\u003c/strong\u003e'. I am trying to show the data into tableview format. I've tried the following code-\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epackage imran.jfx.application;\n\nimport java.net.URL;\nimport java.sql.Connection;\nimport java.sql.DriverManager;\nimport java.sql.PreparedStatement;\nimport java.sql.ResultSet;\nimport java.sql.SQLException;\nimport java.util.ResourceBundle;\n\nimport javafx.event.ActionEvent;\nimport javafx.fxml.FXML;\nimport javafx.fxml.Initializable;\nimport javafx.scene.control.TableColumn;\n\npublic class Controller implements Initializable {\n\n @FXML\n private TableView\u0026lt;?\u0026gt; dataView;\n\n @FXML\n private TableColumn\u0026lt;?, ?\u0026gt; english;\n\n @FXML\n private TableColumn\u0026lt;?, ?\u0026gt; bangla;\n\n @FXML\n private Button getData;\n\n ResultSet result;\n PreparedStatement doQuery;\n Connection conn;\n String query;\n\n @Override\n public void initialize(URL location, ResourceBundle resources) {\n try {\n Class.forName(\"org.sqlite.JDBC\");\n } catch (ClassNotFoundException e) {\n e.printStackTrace();\n }\n String url = \"jdbc:sqlite::resource:database/info.db\";\n try {\n conn = DriverManager.getConnection(url);\n } catch (SQLException e) {\n e.printStackTrace();\n }\n }\n\n @FXML\n void showData(ActionEvent event) throws SQLException {\n query=\"select fname,lname from data\";\n\n ResultSet result = conn.createStatement().executeQuery(query);\n\n while (result.next()) \n { \n //Can't understand how should I write here to show the data\n }\n }\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHow should I do it?\u003c/p\u003e","answer_count":"0","comment_count":"7","creation_date":"2015-09-26 19:36:45.357 UTC","last_activity_date":"2015-09-26 20:13:27.143 UTC","last_edit_date":"2015-09-26 20:13:27.143 UTC","last_editor_display_name":"","last_editor_user_id":"3989705","owner_display_name":"","owner_user_id":"3989705","post_type_id":"1","score":"0","tags":"java|javafx|javafx-2|javafx-8","view_count":"66"} @@ -3319,7 +3319,7 @@ {"id":"18364754","title":"Creating a normal class with injections from Spring","body":"\u003cp\u003eWell, I have a normal class (LovHelper) that is responsible for doing some utils tasks. When i say \u003cstrong\u003enormal class\u003c/strong\u003e is because LovHelper.java don't have @Component, @Service or @Repository annotation. \u003c/p\u003e\n\n\u003cp\u003eInside of this \"normal class\" i wanna inject a bean from spring, but the bean is always null. Look my Class LovHelper.java bellow:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epackage br.com.odontonew.helper; \n\nimport java.util.HashMap; \nimport java.util.List; \nimport java.util.Map; \n\nimport org.springframework.beans.factory.annotation.Autowired; \nimport org.springframework.stereotype.Component; \n\nimport br.com.odontonew.bean.Lov; \nimport br.com.odontonew.dao.BasicDAO; \n\npublic class LovHelper { \n\n @Autowired \n private BasicDAO dao; \n\n private static LovHelper instance; \n\n\n private LovHelper(){ \n\n } \n\n public static LovHelper getInstance(){ \n if (instance == null) \n instance = new LovHelper(); \n\n return instance; \n } \n\n\n public Lov getLovByCodigo(Class lovClass, String codigo){ \n Map\u0026lt;String,Object\u0026gt; map = new HashMap\u0026lt;String,Object\u0026gt;(); \n map.put(\"codigo\", codigo); \n List\u0026lt;Lov\u0026gt; lovs = (List\u0026lt;Lov\u0026gt;)dao.findByQuery(\"SELECT c FROM \"+lovClass.getName()+\" c WHERE c.codigo = :codigo\", map); \n if (lovs.size() == 1) \n return lovs.get(0); \n else \n return null; \n } \n\n\n /*Getters and Setters*/ \n public BasicDAO getDao() { \n return dao; \n } \n\n public void setDao(BasicDAO dao) { \n this.dao = dao; \n } \n\n} \n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eSo, in another class i just call: LovHelper.getInstance().getLovByCodigo(param1, param2). But i always get a NullPointerException because the bean \"dao\" within LovHelper is NULL. \u003c/p\u003e\n\n\u003cp\u003eAfter think a little i decided to change my LovHelper.java (using singleton pattern) to a Bean for Spring inject, then I put @Component annotation and remove all singleton pattern the was developed. \nAnd in another class i inject \"lovHelper\" and use like this: lovHelper.getLovByCodigo(param1, param2). This second solution works fine, but the first not.\u003c/p\u003e\n\n\u003cp\u003eFinally, my doubt is: Why the original code (as posted) don't works.\u003c/p\u003e","answer_count":"2","comment_count":"2","creation_date":"2013-08-21 18:10:13.343 UTC","favorite_count":"0","last_activity_date":"2016-09-13 21:22:25.803 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"2410547","post_type_id":"1","score":"1","tags":"java|spring","view_count":"2401"} {"id":"29959953","title":"This is googles standard code for getting current location of user on map but on some PC it shows incorrect results. what could be the reason?","body":"\u003cp\u003eThe code given below is the google's standard code for getting the current geolocation. This code works fine on my android mobile device but it shows my current location to Pune (841 kilometres from my current location), when I accessed the web page from my PC. On one of my friends pc it shows correct location while incorrect location on another friend's PC. Can any one tell why this code shows correct current location on some PC while incorrect on some other? \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;!DOCTYPE html\u0026gt;\n \u0026lt;html\u0026gt;\n \u0026lt;head\u0026gt;\n \u0026lt;title\u0026gt;Geolocation\u0026lt;/title\u0026gt;\n \u0026lt;meta name=\"viewport\" content=\"initial-scale=1.0, user-scalable=no\"\u0026gt;\n \u0026lt;meta charset=\"utf-8\"\u0026gt;\n \u0026lt;style\u0026gt;\n html, body, #map-canvas {\n height: 100%;\n margin: 0px;\n padding: 0px\n }\n \u0026lt;/style\u0026gt;\n \u0026lt;script src=\"https://maps.googleapis.com/maps/api/js?v=3.exp\u0026amp;signed_in=true\"\u0026gt;\u0026lt;/script\u0026gt;\n\n \u0026lt;script\u0026gt;\n // Note: This example requires that you consent to location sharing when\n // prompted by your browser. If you see a blank space instead of the map, this\n // is probably because you have denied permission for location sharing.\n\n var map;\n\n function initialize() {\n var mapOptions = {\n zoom: 6\n };\n map = new google.maps.Map(document.getElementById('map-canvas'),\n mapOptions);\n\n // Try HTML5 geolocation\n if(navigator.geolocation) {\n navigator.geolocation.getCurrentPosition(function(position) {\n var pos = new google.maps.LatLng(position.coords.latitude,\n position.coords.longitude);\n\n var infowindow = new google.maps.InfoWindow({\n map: map,\n position: pos,\n content: 'Location found using HTML5.'\n });\n\n map.setCenter(pos);\n }, function() {\n handleNoGeolocation(true);\n });\n } else {\n // Browser doesn't support Geolocation\n handleNoGeolocation(false);\n }\n }\n\n function handleNoGeolocation(errorFlag) {\n if (errorFlag) {\n var content = 'Error: The Geolocation service failed.';\n } else {\n var content = 'Error: Your browser doesn\\'t support geolocation.';\n }\n\n var options = {\n map: map,\n position: new google.maps.LatLng(60, 105),\n content: content\n };\n\n var infowindow = new google.maps.InfoWindow(options);\n map.setCenter(options.position);\n }\n\n google.maps.event.addDomListener(window, 'load', initialize);\n\n \u0026lt;/script\u0026gt;\n \u0026lt;/head\u0026gt;\n \u0026lt;body\u0026gt;\n \u0026lt;div id=\"map-canvas\"\u0026gt;\u0026lt;/div\u0026gt;\n \u0026lt;/body\u0026gt;\n \u0026lt;/html\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"29960123","answer_count":"2","comment_count":"2","creation_date":"2015-04-30 05:48:58.253 UTC","last_activity_date":"2015-04-30 06:40:04.21 UTC","last_edit_date":"2015-04-30 06:40:04.21 UTC","last_editor_display_name":"","last_editor_user_id":"4831567","owner_display_name":"","owner_user_id":"4847173","post_type_id":"1","score":"-1","tags":"javascript|html5|google-maps|geolocation","view_count":"96"} {"id":"45176315","title":"WordPress query posts on scroll laggy/skips","body":"\u003cp\u003eI have a website that on the homepage contains images/sliders standard page content etc. Once the page loads, it scrolls nice and smoothly. But I have a section about half way down that queries and displays WordPress Posts (see code below). When I view it in Google Chrome, while scrolling in that section, the website becomes laggy/skips and doesn't smoothy scroll like the rest of the home page. \u003c/p\u003e\n\n\u003cp\u003eIs there a way or something to include that will have WordPress query the posts faster or better or is there another reason as to why scrolling in that section becomes laggy? \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;?php\n $temp = $wp_query; \n $wp_query= null;\n $wp_query = new WP_Query(); \n $wp_query-\u0026gt;query('no_found_rows=true\u0026amp;showposts=6\u0026amp;post_status=publish' . '\u0026amp;paged='.$paged);\n while ($wp_query-\u0026gt;have_posts()) : $wp_query-\u0026gt;the_post(); ?\u0026gt;\n \u0026lt;div class=\"newspagearticle full\"\u0026gt;\n \u0026lt;div class=\"newsthumb\"\u0026gt;\n \u0026lt;?php the_post_thumbnail( 'category-thumb' ); ?\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;div class=\"homenewsheader\"\u0026gt;\n \u0026lt;div class=\"newsdate\"\u0026gt;\n \u0026lt;div\u0026gt;\u0026lt;?php the_time('M') ?\u0026gt;\u0026lt;/div\u0026gt;\n \u0026lt;?php the_time('d'); ?\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;h2\u0026gt;\n \u0026lt;a class=\"readmore\" href=\"\u0026lt;?php the_permalink() ?\u0026gt;\"\u0026gt;\n \u0026lt;?php\n $thetitle = $post-\u0026gt;post_title; /* or you can use get_the_title() */\n $getlength = strlen($thetitle);\n $thelength = 200;\n echo substr($thetitle, 0, $thelength);\n if ($getlength \u0026gt; $thelength) echo \"...\";\n ?\u0026gt;\n \u0026lt;/a\u0026gt;\n \u0026lt;/h2\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;div style=\"clear:both;\"\u0026gt;\u0026lt;/div\u0026gt;\n \u0026lt;?php the_excerpt(); ?\u0026gt;\n \u0026lt;/div\u0026gt;\u0026lt;!-- /newspagearticle --\u0026gt;\n \u0026lt;?php endwhile; ?\u0026gt;\n \u0026lt;?php wp_reset_postdata(); ?\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"0","comment_count":"3","creation_date":"2017-07-18 20:18:14.81 UTC","last_activity_date":"2017-07-18 20:18:14.81 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"5623324","post_type_id":"1","score":"0","tags":"php|jquery|wordpress|performance","view_count":"25"} -{"id":"21685537","title":"codeigniter tank_auth unable to view default forms","body":"\u003cp\u003eFirst time posting here love the site.\u003c/p\u003e\n\n\u003cp\u003eSo I started using CodeIgniter and wanted to add acl to my site. \nsearched and read a lot and decide to go with tank auth.\u003c/p\u003e\n\n\u003cp\u003eusing:\ncodeigniter 2.1.4\u003c/p\u003e\n\n\u003cp\u003etank auth master\u003c/p\u003e\n\n\u003cp\u003eIIS\u003c/p\u003e\n\n\u003cp\u003eDownload everything ran the scripts connected to the db and nothing...\u003c/p\u003e\n\n\u003cp\u003eI can't view the \u003ccode\u003eregister_form.php\u003c/code\u003e in the view/auth folder or any view for that matter, all i get is a blank page no errors or anything. i assume its a problem with the routing i tried a 100 different stuff and was unable to get any thing beside a blank page.\u003c/p\u003e\n\n\u003cp\u003eany ideas how to solve this? \u003c/p\u003e\n\n\u003cp\u003eyour help would be most appreciated.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e$route['default_controller'] = 'auth/view';\n$route['404_override'] = '';\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eedit:\nwhat have i dont so far....\u003c/p\u003e\n\n\u003col\u003e\n\u003cli\u003e\u003cp\u003eso i change the route to this:\n$route['default_controller'] = 'auth/login';\n$route['404_override'] = '';\u003c/p\u003e\u003c/li\u003e\n\u003cli\u003e\u003cp\u003eenable all logging nothing shows there\u003c/p\u003e\u003c/li\u003e\n\u003cli\u003e\u003cp\u003emade sure im in develoment mode\nstill nothing blank page\u003c/p\u003e\u003c/li\u003e\n\u003c/ol\u003e\n\n\u003cp\u003e\u003cem\u003e\u003cstrong\u003eedit:\u003c/em\u003e\u003c/strong\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eso sloved the problem it was with the database load ($this-\u0026gt;ci-\u0026gt;load-\u0026gt;database();)\nno error were showen only thing in log of CI was (Database Driver Class Initialized)\nproblem was that php 5.5 doesnt come enable , need to enable it.\nlocate the php.ini (cmd-\u0026gt;run c:\\php\\php.exe --ini for location)\nedit the next stuff in file:\nextension=php_mysql.dll\nextension=php_mysqli.dll\nextension_dir = \"C:\\PHP\\ext\"\n\nthen make sure that in apachee httd.conf u have it ponted to the location of the right php.ini\nPHPIniDir \"C:\\php\\PHP.ini\"\n\nhopes this help some one in the future :)\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"22258900","answer_count":"3","comment_count":"2","creation_date":"2014-02-10 18:54:42.527 UTC","favorite_count":"1","last_activity_date":"2014-03-07 19:21:50.35 UTC","last_edit_date":"2014-03-07 19:20:22.39 UTC","last_editor_display_name":"","last_editor_user_id":"3294177","owner_display_name":"","owner_user_id":"3294177","post_type_id":"1","score":"0","tags":"php|codeigniter|tankauth","view_count":"92"} +{"id":"21685537","title":"codeigniter tank_auth unable to view default forms","body":"\u003cp\u003eFirst time posting here love the site.\u003c/p\u003e\n\n\u003cp\u003eSo I started using CodeIgniter and wanted to add acl to my site. \nsearched and read a lot and decide to go with tank auth.\u003c/p\u003e\n\n\u003cp\u003eusing:\ncodeigniter 2.1.4\u003c/p\u003e\n\n\u003cp\u003etank auth cluster manager\u003c/p\u003e\n\n\u003cp\u003eIIS\u003c/p\u003e\n\n\u003cp\u003eDownload everything ran the scripts connected to the db and nothing...\u003c/p\u003e\n\n\u003cp\u003eI can't view the \u003ccode\u003eregister_form.php\u003c/code\u003e in the view/auth folder or any view for that matter, all i get is a blank page no errors or anything. i assume its a problem with the routing i tried a 100 different stuff and was unable to get any thing beside a blank page.\u003c/p\u003e\n\n\u003cp\u003eany ideas how to solve this? \u003c/p\u003e\n\n\u003cp\u003eyour help would be most appreciated.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e$route['default_controller'] = 'auth/view';\n$route['404_override'] = '';\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eedit:\nwhat have i dont so far....\u003c/p\u003e\n\n\u003col\u003e\n\u003cli\u003e\u003cp\u003eso i change the route to this:\n$route['default_controller'] = 'auth/login';\n$route['404_override'] = '';\u003c/p\u003e\u003c/li\u003e\n\u003cli\u003e\u003cp\u003eenable all logging nothing shows there\u003c/p\u003e\u003c/li\u003e\n\u003cli\u003e\u003cp\u003emade sure im in develoment mode\nstill nothing blank page\u003c/p\u003e\u003c/li\u003e\n\u003c/ol\u003e\n\n\u003cp\u003e\u003cem\u003e\u003cstrong\u003eedit:\u003c/em\u003e\u003c/strong\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eso sloved the problem it was with the database load ($this-\u0026gt;ci-\u0026gt;load-\u0026gt;database();)\nno error were showen only thing in log of CI was (Database Driver Class Initialized)\nproblem was that php 5.5 doesnt come enable , need to enable it.\nlocate the php.ini (cmd-\u0026gt;run c:\\php\\php.exe --ini for location)\nedit the next stuff in file:\nextension=php_mysql.dll\nextension=php_mysqli.dll\nextension_dir = \"C:\\PHP\\ext\"\n\nthen make sure that in apachee httd.conf u have it ponted to the location of the right php.ini\nPHPIniDir \"C:\\php\\PHP.ini\"\n\nhopes this help some one in the future :)\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"22258900","answer_count":"3","comment_count":"2","creation_date":"2014-02-10 18:54:42.527 UTC","favorite_count":"1","last_activity_date":"2014-03-07 19:21:50.35 UTC","last_edit_date":"2014-03-07 19:20:22.39 UTC","last_editor_display_name":"","last_editor_user_id":"3294177","owner_display_name":"","owner_user_id":"3294177","post_type_id":"1","score":"0","tags":"php|codeigniter|tankauth","view_count":"92"} {"id":"14868874","title":"Achieving rotation of logs based on size and time for the same log file using log4j.xml","body":"\u003cp\u003eTried following to achieve rotation based on size as well as time within the same configuration applicable to a single log file\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"http://www.mailinglistarchive.com/html/log4j-user@logging.apache.org/2008-07/msg00355.html\" rel=\"nofollow\"\u003ehttp://www.mailinglistarchive.com/html/log4j-user@logging.apache.org/2008-07/msg00355.html\u003c/a\u003e\n but the rotation based on size is not happening.Tried setting the size to 3KB. Could you please let me know if i have to correct anything.\u003c/p\u003e","answer_count":"0","comment_count":"2","creation_date":"2013-02-14 06:19:19.253 UTC","last_activity_date":"2013-02-14 06:19:19.253 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1935991","post_type_id":"1","score":"0","tags":"log4j","view_count":"228"} {"id":"3881557","title":"Inserting JSON in DataTable in Google Visualisation","body":"\u003cp\u003eI read that JSON can be inserted into a datatable. However, its done \nin JS on the HTML page (if memory serves right). I am using the GWT- \nvisualisation driver as given \u003ca href=\"http://code.google.com/p/gwt-google-apis/wiki/VisualizationGettingStarted\" rel=\"nofollow\"\u003ehere\u003c/a\u003e, and the only methods to add a row are not \ndesigned with JSON in mind. Is there any work-able solution? I am \ntrying to make a Stacked Column Chart. \nThanks.\u003c/p\u003e","answer_count":"2","comment_count":"0","creation_date":"2010-10-07 12:22:06.513 UTC","favorite_count":"2","last_activity_date":"2011-08-13 05:08:54.62 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"174936","post_type_id":"1","score":"0","tags":"gwt|google-visualization","view_count":"862"} {"id":"27913545","title":"Matlab: Indexing multidimensional array with a matrix","body":"\u003cp\u003eI have a three dimensional matrix named \u003ci\u003eSpr\u003c/i\u003e of size \u003ci\u003e5x5x500\u003c/i\u003e. The last dimension represents individuals while the first two dimensions refer to states. Hence, for each individual, I am storing a 5x5 matrix of transition probabilities from state i to state j. For instance, the last individual's transition probabilities are:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eSpr( : , : , 500)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eans =\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e0.1386 0.3768 0.2286 0.1871 0.0688\n0.1456 0.3959 0.2401 0.1966 0.0218\n0.1475 0.4011 0.2433 0.1992 0.0090\n0.1486 0.4039 0.2450 0.2006 0.0020\n 0 1.0000 0 0 0\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI would like to access the three dimensional matrix Spr with the first index being provided by a 500x1 matrix S which stores in which state the specific individual is currently in. Hence, my final result would be a 1x5x500 matrix. For instance, if the 500th individual is currently in state S(i)=2 the corresponding row for this individual would correspond to:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eSpr(S(i),:,i)\n\n0.1456 0.3959 0.2401 0.1966 0.0218 \n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHow can I do that without using loops?\u003c/p\u003e\n\n\u003cp\u003eI've tried using the \u003ci\u003esub2ind\u003c/i\u003e function in Matlab but it doesn't work as it requires all the indexes be integers and essentially my second index is the character \u003ci\u003e\":\" \u003c/i\u003e.\u003c/p\u003e","accepted_answer_id":"27913772","answer_count":"1","comment_count":"0","creation_date":"2015-01-13 01:16:11.793 UTC","last_activity_date":"2016-03-07 13:25:27.887 UTC","last_edit_date":"2016-03-07 13:25:27.887 UTC","last_editor_display_name":"","last_editor_user_id":"2732801","owner_display_name":"","owner_user_id":"1179242","post_type_id":"1","score":"0","tags":"arrays|matlab|multidimensional-array|indexing|vectorization","view_count":"85"} @@ -3479,7 +3479,7 @@ {"id":"36981089","title":"Users cannot update/install my app from Google Play(error -505)!","body":"\u003cp\u003eI uploaded an update to Google Play and it seems many people cannot update or reinstall. When they try to update, they get error something with number \u003ccode\u003e4\u003c/code\u003e, if they try to clean install it, they get error \u003ccode\u003e-505\u003c/code\u003e. I just tried it on emulator and it worked fine, what the heck? Many people report an error. What is wrong?\u003c/p\u003e","answer_count":"2","comment_count":"3","creation_date":"2016-05-02 11:13:54.287 UTC","last_activity_date":"2016-05-02 11:35:46.973 UTC","last_edit_date":"2016-05-02 11:17:04.197 UTC","last_editor_display_name":"","last_editor_user_id":"1711809","owner_display_name":"","owner_user_id":"1711809","post_type_id":"1","score":"0","tags":"android|google-play|apk|updates","view_count":"533"} {"id":"39377809","title":"How to integrate Mustache template engine into Phalcon PHP application?","body":"\u003cp\u003eHow to integrate Mustache template engine into Phalcon PHP 3 application to use it instead of built-in volt?\u003c/p\u003e","accepted_answer_id":"39383644","answer_count":"2","comment_count":"0","creation_date":"2016-09-07 19:37:58.727 UTC","last_activity_date":"2016-09-08 08:05:09.193 UTC","last_edit_date":"2016-09-08 08:05:09.193 UTC","last_editor_display_name":"","last_editor_user_id":"905439","owner_display_name":"","owner_user_id":"905439","post_type_id":"1","score":"0","tags":"mustache|phalcon","view_count":"67"} {"id":"8439438","title":"TTURLNavigation: Is it efficient?","body":"\u003cp\u003eSo I'm having a hard time wrapping my head around TTURLNavigation from the three20 framework. \u003c/p\u003e\n\n\u003cp\u003eAre the views being pushed onto a stack? I don't understand how one could just jump around an application without pushing and poping. I feel like if i just keep jumping to urls I am constantly pushing views onto my stack. \u003c/p\u003e\n\n\u003cp\u003eHow exactly does TTURLNavigation accomplish this. \u003c/p\u003e","answer_count":"0","comment_count":"0","creation_date":"2011-12-09 00:04:04.507 UTC","last_activity_date":"2011-12-09 00:04:04.507 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"373722","post_type_id":"1","score":"1","tags":"iphone|ios|three20","view_count":"34"} -{"id":"32017321","title":"My mail server using IRedMail (postfix, dovecot, etc.) is only sending and receiving local emails?","body":"\u003cp\u003eI recently set up a mail server using IRedMail on a home server running Debian 8, using OpenLDAP, nginx in the installer. We got everything set up and configured to where we can access our mail server with roundcube (which I can access through mail.sterango.com) and Thunderbird and login to accounts just fine. We can send emails to and from accounts that are on the domain (seb@sterango.com can send and receive from postmaster@smail.sterango.com), but I am not able to send or recieve email with either of these accounts from outside sources such as my gmail account.\nHere is my main.cf\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e# See /usr/share/postfix/main.cf.dist for a commented, more complete version\n\n\n# Debian specific: Specifying a file name will cause the first\n# line of that file to be used as the name. The Debian default\n# is /etc/mailname.\n#myorigin = /etc/mailname\n\nsmtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)\nbiff = no\n\n# appending .domain is the MUA's job.\nappend_dot_mydomain = no\n\n# Uncomment the next line to generate \"delayed mail\" warnings\n#delay_warning_time = 4h\n\nreadme_directory = no\n\n# TLS parameters\nsmtpd_tls_cert_file = /etc/ssl/certs/iRedMail.crt\nsmtpd_tls_key_file = /etc/ssl/private/iRedMail.key\nsmtpd_use_tls=yes\nsmtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache\nsmtp_tls_session_cache_database = btree:${data_directory}/smtp_scache\n\n# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for\n# information on enabling SSL in the smtp client.\n\nsmtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination\nmyhostname = mail.sterango.com\nalias_maps = hash:/etc/postfix/aliases\nalias_database = hash:/etc/postfix/aliases\nmyorigin = mail.sterango.com\nmydestination = \nrelayhost = \nmynetworks = 127.0.0.1\nmailbox_command = /usr/lib/dovecot/deliver\nmailbox_size_limit = 0\nrecipient_delimiter = +\ninet_interfaces = loopback-only\ntransport_maps = proxy:mysql:/etc/postfix/mysql/transport_maps_user.cf, proxy:mysql:/etc/postfix/mysql/transport_maps_domain.cf\ninet_protocols = ipv4\nvirtual_alias_domains = \nmydomain = mail.sterango.com\nallow_percent_hack = no\nswap_bangpath = no\nmynetworks_style = host\nsmtpd_data_restrictions = reject_unauth_pipelining\nsmtpd_reject_unlisted_recipient = yes\nsmtpd_reject_unlisted_sender = yes\nsmtpd_tls_protocols = !SSLv2 !SSLv3\nsmtp_tls_protocols = !SSLv2 !SSLv3\nlmtp_tls_protocols = !SSLv2 !SSLv3\nsmtpd_tls_mandatory_protocols = !SSLv2 !SSLv3\nsmtp_tls_mandatory_protocols = !SSLv2 !SSLv3\nlmtp_tls_mandatory_protocols = !SSLv2 !SSLv3\nsmtpd_tls_mandatory_exclude_ciphers = aNULL, eNULL, EXPORT, DES, RC4, MD5, PSK, aECDH, EDH-DSS-DES-CBC3-SHA, EDH-RSA-DES-CDC3-SHA, KRB5-DE5, CBC3-SHA\nsmtpd_tls_dh1024_param_file = /etc/ssl/dhparams.pem\nsmtp_tls_security_level = may\nsmtp_tls_CAfile = $smtpd_tls_CAfile\nsmtp_tls_loglevel = 0\nsmtp_tls_note_starttls_offer = yes\nsmtpd_sender_restrictions = reject_unknown_sender_domain, reject_non_fqdn_sender, reject_unlisted_sender, permit_mynetworks, reject_sender_login_mismatch, permit_sasl_authenticated\ndelay_warning_time = 0h\nmaximal_queue_lifetime = 4h\nbounce_queue_lifetime = 4h\nproxy_read_maps = $canonical_maps $lmtp_generic_maps $local_recipient_maps $mydestination $mynetworks $recipient_bcc_maps $recipient_canonical_maps $relay_domains $relay_recipient_maps $relocated_maps $sender_bcc_maps $sender_canonical_maps $smtp_generic_maps $smtpd_sender_login_maps $transport_maps $virtual_alias_domains $virtual_alias_maps $virtual_mailbox_domains $virtual_mailbox_maps $smtpd_sender_restrictions\nsmtp_data_init_timeout = 240s\nsmtp_data_xfer_timeout = 600s\nsmtpd_helo_required = yes\nsmtpd_helo_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_non_fqdn_helo_hostname, reject_invalid_helo_hostname, check_helo_access pcre:/etc/postfix/helo_access.pcre\nqueue_run_delay = 300s\nminimal_backoff_time = 300s\nmaximal_backoff_time = 4000s\nenable_original_recipient = no\ndisable_vrfy_command = yes\nhome_mailbox = Maildir/\nallow_min_user = no\nmessage_size_limit = 15728640\nvirtual_minimum_uid = 2000\nvirtual_uid_maps = static:2000\nvirtual_gid_maps = static:2000\nvirtual_mailbox_base = /var/vmail\nvirtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql/virtual_mailbox_domains.cf\nvirtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql/virtual_mailbox_maps.cf\nvirtual_alias_maps = proxy:mysql:/etc/postfix/mysql/virtual_alias_maps.cf, proxy:mysql:/etc/postfix/mysql/domain_alias_maps.cf, proxy:mysql:/etc/postfix/mysql/catchall_maps.cf, proxy:mysql:/etc/postfix/mysql/domain_alias_catchall_maps.cf\nsender_bcc_maps = proxy:mysql:/etc/postfix/mysql/sender_bcc_maps_user.cf, proxy:mysql:/etc/postfix/mysql/sender_bcc_maps_domain.cf\nrecipient_bcc_maps = proxy:mysql:/etc/postfix/mysql/recipient_bcc_maps_user.cf, proxy:mysql:/etc/postfix/mysql/recipient_bcc_maps_domain.cf\nrelay_domains = $mydestination, proxy:mysql:/etc/postfix/mysql/relay_domains.cf\nsmtpd_sender_login_maps = proxy:mysql:/etc/postfix/mysql/sender_login_maps.cf\nsmtpd_sasl_auth_enable = yes\nsmtpd_sasl_local_domain = \nbroken_sasl_auth_clients = yes\nsmtpd_sasl_security_options = noanonymous\nsmtpd_tls_auth_only = yes\nsmtpd_recipient_restrictions = reject_unknown_recipient_domain, reject_non_fqdn_recipient, reject_unlisted_recipient, check_policy_service inet:127.0.0.1:7777, permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination\nsmtpd_tls_security_level = may\nsmtpd_tls_loglevel = 0\nsmtpd_tls_CAfile = /etc/ssl/certs/iRedMail.crt\ntls_random_source = dev:/dev/urandom\nvirtual_transport = dovecot\ndovecot_destination_recipient_limit = 1\nsmtpd_sasl_type = dovecot\nsmtpd_sasl_path = private/dovecot-auth\ncontent_filter = smtp-amavis:[127.0.0.1]:10024\nsmtp-amavis_destination_recipient_limit = 1\ndefault_transport = smtp\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAlso here are my DNS records: \u003ca href=\"http://i.imgur.com/gR2LAIZ.png\" rel=\"nofollow\"\u003ehttp://i.imgur.com/gR2LAIZ.png\u003c/a\u003e\nShould the A one point to a local IP like that? \nI will also gladly post any logs or files. Thanks!\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2015-08-14 19:20:15.813 UTC","last_activity_date":"2016-10-06 14:39:10.17 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"5113523","post_type_id":"1","score":"-1","tags":"email|nginx|dns|debian|postfix-mta","view_count":"1287"} +{"id":"32017321","title":"My mail server using IRedMail (postfix, dovecot, etc.) is only sending and receiving local emails?","body":"\u003cp\u003eI recently set up a mail server using IRedMail on a home server running Debian 8, using OpenLDAP, nginx in the installer. We got everything set up and configured to where we can access our mail server with roundcube (which I can access through mail.sterango.com) and Thunderbird and login to accounts just fine. We can send emails to and from accounts that are on the domain (seb@sterango.com can send and receive from postclustermanager@smail.sterango.com), but I am not able to send or recieve email with either of these accounts from outside sources such as my gmail account.\nHere is my main.cf\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e# See /usr/share/postfix/main.cf.dist for a commented, more complete version\n\n\n# Debian specific: Specifying a file name will cause the first\n# line of that file to be used as the name. The Debian default\n# is /etc/mailname.\n#myorigin = /etc/mailname\n\nsmtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)\nbiff = no\n\n# appending .domain is the MUA's job.\nappend_dot_mydomain = no\n\n# Uncomment the next line to generate \"delayed mail\" warnings\n#delay_warning_time = 4h\n\nreadme_directory = no\n\n# TLS parameters\nsmtpd_tls_cert_file = /etc/ssl/certs/iRedMail.crt\nsmtpd_tls_key_file = /etc/ssl/private/iRedMail.key\nsmtpd_use_tls=yes\nsmtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache\nsmtp_tls_session_cache_database = btree:${data_directory}/smtp_scache\n\n# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for\n# information on enabling SSL in the smtp client.\n\nsmtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination\nmyhostname = mail.sterango.com\nalias_maps = hash:/etc/postfix/aliases\nalias_database = hash:/etc/postfix/aliases\nmyorigin = mail.sterango.com\nmydestination = \nrelayhost = \nmynetworks = 127.0.0.1\nmailbox_command = /usr/lib/dovecot/deliver\nmailbox_size_limit = 0\nrecipient_delimiter = +\ninet_interfaces = loopback-only\ntransport_maps = proxy:mysql:/etc/postfix/mysql/transport_maps_user.cf, proxy:mysql:/etc/postfix/mysql/transport_maps_domain.cf\ninet_protocols = ipv4\nvirtual_alias_domains = \nmydomain = mail.sterango.com\nallow_percent_hack = no\nswap_bangpath = no\nmynetworks_style = host\nsmtpd_data_restrictions = reject_unauth_pipelining\nsmtpd_reject_unlisted_recipient = yes\nsmtpd_reject_unlisted_sender = yes\nsmtpd_tls_protocols = !SSLv2 !SSLv3\nsmtp_tls_protocols = !SSLv2 !SSLv3\nlmtp_tls_protocols = !SSLv2 !SSLv3\nsmtpd_tls_mandatory_protocols = !SSLv2 !SSLv3\nsmtp_tls_mandatory_protocols = !SSLv2 !SSLv3\nlmtp_tls_mandatory_protocols = !SSLv2 !SSLv3\nsmtpd_tls_mandatory_exclude_ciphers = aNULL, eNULL, EXPORT, DES, RC4, MD5, PSK, aECDH, EDH-DSS-DES-CBC3-SHA, EDH-RSA-DES-CDC3-SHA, KRB5-DE5, CBC3-SHA\nsmtpd_tls_dh1024_param_file = /etc/ssl/dhparams.pem\nsmtp_tls_security_level = may\nsmtp_tls_CAfile = $smtpd_tls_CAfile\nsmtp_tls_loglevel = 0\nsmtp_tls_note_starttls_offer = yes\nsmtpd_sender_restrictions = reject_unknown_sender_domain, reject_non_fqdn_sender, reject_unlisted_sender, permit_mynetworks, reject_sender_login_mismatch, permit_sasl_authenticated\ndelay_warning_time = 0h\nmaximal_queue_lifetime = 4h\nbounce_queue_lifetime = 4h\nproxy_read_maps = $canonical_maps $lmtp_generic_maps $local_recipient_maps $mydestination $mynetworks $recipient_bcc_maps $recipient_canonical_maps $relay_domains $relay_recipient_maps $relocated_maps $sender_bcc_maps $sender_canonical_maps $smtp_generic_maps $smtpd_sender_login_maps $transport_maps $virtual_alias_domains $virtual_alias_maps $virtual_mailbox_domains $virtual_mailbox_maps $smtpd_sender_restrictions\nsmtp_data_init_timeout = 240s\nsmtp_data_xfer_timeout = 600s\nsmtpd_helo_required = yes\nsmtpd_helo_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_non_fqdn_helo_hostname, reject_invalid_helo_hostname, check_helo_access pcre:/etc/postfix/helo_access.pcre\nqueue_run_delay = 300s\nminimal_backoff_time = 300s\nmaximal_backoff_time = 4000s\nenable_original_recipient = no\ndisable_vrfy_command = yes\nhome_mailbox = Maildir/\nallow_min_user = no\nmessage_size_limit = 15728640\nvirtual_minimum_uid = 2000\nvirtual_uid_maps = static:2000\nvirtual_gid_maps = static:2000\nvirtual_mailbox_base = /var/vmail\nvirtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql/virtual_mailbox_domains.cf\nvirtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql/virtual_mailbox_maps.cf\nvirtual_alias_maps = proxy:mysql:/etc/postfix/mysql/virtual_alias_maps.cf, proxy:mysql:/etc/postfix/mysql/domain_alias_maps.cf, proxy:mysql:/etc/postfix/mysql/catchall_maps.cf, proxy:mysql:/etc/postfix/mysql/domain_alias_catchall_maps.cf\nsender_bcc_maps = proxy:mysql:/etc/postfix/mysql/sender_bcc_maps_user.cf, proxy:mysql:/etc/postfix/mysql/sender_bcc_maps_domain.cf\nrecipient_bcc_maps = proxy:mysql:/etc/postfix/mysql/recipient_bcc_maps_user.cf, proxy:mysql:/etc/postfix/mysql/recipient_bcc_maps_domain.cf\nrelay_domains = $mydestination, proxy:mysql:/etc/postfix/mysql/relay_domains.cf\nsmtpd_sender_login_maps = proxy:mysql:/etc/postfix/mysql/sender_login_maps.cf\nsmtpd_sasl_auth_enable = yes\nsmtpd_sasl_local_domain = \nbroken_sasl_auth_clients = yes\nsmtpd_sasl_security_options = noanonymous\nsmtpd_tls_auth_only = yes\nsmtpd_recipient_restrictions = reject_unknown_recipient_domain, reject_non_fqdn_recipient, reject_unlisted_recipient, check_policy_service inet:127.0.0.1:7777, permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination\nsmtpd_tls_security_level = may\nsmtpd_tls_loglevel = 0\nsmtpd_tls_CAfile = /etc/ssl/certs/iRedMail.crt\ntls_random_source = dev:/dev/urandom\nvirtual_transport = dovecot\ndovecot_destination_recipient_limit = 1\nsmtpd_sasl_type = dovecot\nsmtpd_sasl_path = private/dovecot-auth\ncontent_filter = smtp-amavis:[127.0.0.1]:10024\nsmtp-amavis_destination_recipient_limit = 1\ndefault_transport = smtp\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAlso here are my DNS records: \u003ca href=\"http://i.imgur.com/gR2LAIZ.png\" rel=\"nofollow\"\u003ehttp://i.imgur.com/gR2LAIZ.png\u003c/a\u003e\nShould the A one point to a local IP like that? \nI will also gladly post any logs or files. Thanks!\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2015-08-14 19:20:15.813 UTC","last_activity_date":"2016-10-06 14:39:10.17 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"5113523","post_type_id":"1","score":"-1","tags":"email|nginx|dns|debian|postfix-mta","view_count":"1287"} {"id":"20824901","title":"GridView: getCheckedItemPositions() return no values or wrong values","body":"\u003cp\u003eI implemented a gallery with a Grid View that includes check boxes but i have problems with getCheckedItemPositions() method. \u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003e(1)\u003c/strong\u003e If i launch the Activity with GridView, select some items and ask which items have been selected, the method getCheckedItemPositions() doesn't return any value. \u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003e(2)\u003c/strong\u003e If i launch another Activity, i return to Activity with the GridView and ask what items have been selected, the method getCheckedItemPositions() returns wrong values .\u003c/p\u003e\n\n\u003cp\u003eI think first of all that the implementation of getView() is wrong, for (1) probably the GridView doesn't know which items are selected. I have no ideas for the (2) instead. \u003c/p\u003e\n\n\u003cp\u003eHere the code:\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eGalleryFragment getCheckedItemOnGridView()\u003c/strong\u003e: \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eprivate void getCheckedItemOnGridView() {\n if(D) Log.d(TAG, \"getCheckedItemOnGridView(): called\");\n SparseBooleanArray checkedItemPositions = mGalleryGridView.getCheckedItemPositions();\n for (int i=0 ; i\u0026lt;checkedItemPositions.size() ; i++) {\n if(D) Log.d(TAG, \"checkedItemPositions : \" + checkedItemPositions.valueAt(i) + \" index \" + checkedItemPositions.keyAt(i));\n }\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003cstrong\u003eAdapter extends BaseAdapter getView():\u003c/strong\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eprivate SparseBooleanArray checked;\n\npublic View getView(final int position, View convertView, ViewGroup parent) {\n if(D) Log.d(TAG, \"Called: getView\");\n ViewHolder holder;\n\n if (convertView == null) {\n convertView = mLayoutInflater.inflate(R.layout.listitem_gallery, null);\n\n holder = new ViewHolder();\n holder.thumbnailView = (ImageView) convertView.findViewById(R.id.imageview_thumbnail);\n holder.checkBoxView = (CheckBox) convertView.findViewById(R.id.checkbox);\n\n holder.checkBoxView.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View view) {\n if (((CheckBox) view).isChecked()) {\n checked.put((Integer) view.getTag(), true);\n\n } else {\n checked.put((Integer) view.getTag(), false);\n }\n }\n });\n\n convertView.setTag(holder);\n } else {\n holder = (ViewHolder) convertView.getTag();\n }\n\n BitmapFileImageLoader bitmapLoader = new BitmapFileImageLoader();\n bitmapLoader.loadBitmap(getItem(position), holder.thumbnailView);\n\n holder.checkBoxView.setTag(position);\n holder.checkBoxView.setChecked(checked.get(position));\n\n return convertView;\n}\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"20829571","answer_count":"2","comment_count":"1","creation_date":"2013-12-29 11:54:58.817 UTC","favorite_count":"1","last_activity_date":"2013-12-29 20:12:08.897 UTC","last_editor_display_name":"","owner_display_name":"user2523485","post_type_id":"1","score":"1","tags":"android|gridview|checkbox","view_count":"974"} {"id":"3354626","title":"Metal shading (like silver) on iphone opengl?","body":"\u003cp\u003eDoes anyone know a tutorial hat explains how to shade an object to look like \nsilver metal? (on iphone)?\nMaybe starting with a spere like in this:\n\u003ca href=\"http://iphonedevelopment.blogspot.com/2009/05/opengl-opensearch-from-ground-up-part-5-living.html\" rel=\"nofollow noreferrer\"\u003ehttp://iphonedevelopment.blogspot.com/2009/05/opengl-opensearch-from-ground-up-part-5-living.html\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eOr can this not be accomplished without the new shaders in 2.0?\u003c/p\u003e\n\n\u003cp\u003eThanks\nSebastian \u003c/p\u003e","accepted_answer_id":"3403856","answer_count":"2","comment_count":"0","creation_date":"2010-07-28 15:41:21.453 UTC","last_activity_date":"2010-08-04 08:35:38.66 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"134213","post_type_id":"1","score":"0","tags":"iphone|opengl-opensearch","view_count":"909"} {"id":"1185117","title":"Should I use thread local storage for variables that only exist in a {class,method}?","body":"\u003cp\u003eI am implementing a relatively simple thread pool with Python's \u003ccode\u003eQueue.Queue\u003c/code\u003e class. I have one producer class that contains the \u003ccode\u003eQueue\u003c/code\u003e instance along with some convenience methods, along with a consumer class that subclasses \u003ccode\u003ethreading.Thread\u003c/code\u003e. I instantiate that object for every thread I want in my pool (\"worker threads,\" I think they're called) based on an integer.\u003c/p\u003e\n\n\u003cp\u003eEach worker thread takes \u003ccode\u003eflag, data\u003c/code\u003e off the queue, processes it using its own database connection, and places the GUID of the row onto a list so that the producer class knows when a job is done.\u003c/p\u003e\n\n\u003cp\u003eWhile I'm aware that other modules implement the functionality I'm coding, the reason I'm coding this is to gain a better understanding of how Python threading works. This brings me to my question.\u003c/p\u003e\n\n\u003cp\u003eIf I store anything in a function's namespace or in the class's \u003ccode\u003e__dict__\u003c/code\u003e object, will it be thread safe?\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eclass Consumer(threading.Thread):\n def __init__(self, producer, db_filename):\n self.producer = producer\n self.conn = sqlite3.connect(db_filename) # Is this var thread safe?\n def run(self):\n flag, data = self.producer.queue.get()\n\n while flag != 'stop':\n # Do stuff with data; Is `data` thread safe?\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI am thinking that both would be thread safe, here's my rationale:\u003c/p\u003e\n\n\u003cul\u003e\n\u003cli\u003eEach time a class is instantiated, a new \u003ccode\u003e__dict__\u003c/code\u003e gets created. Under the scenario I outline above, I don't think any other object would have a reference to this object. (Now, perhaps the situation might get more complicated if I used \u003ccode\u003ejoin()\u003c/code\u003e functionality, but I'm not...)\u003c/li\u003e\n\u003cli\u003eEach time a function gets called, it creates its own name space which exists for the lifetime of the function. I'm not making any of my variables \u003ccode\u003eglobal\u003c/code\u003e, so I don't understand how any other object would have a reference to a function variable.\u003c/li\u003e\n\u003c/ul\u003e\n\n\u003cp\u003e\u003ca href=\"https://stackoverflow.com/questions/104983/please-explain-thread-local-storage-for-python\"\u003eThis post\u003c/a\u003e addresses my question somewhat, but is still a little abstract for me.\u003c/p\u003e\n\n\u003cp\u003eThanks in advance for clearing this up for me.\u003c/p\u003e","answer_count":"3","comment_count":"0","creation_date":"2009-07-26 17:53:08.107 UTC","favorite_count":"1","last_activity_date":"2013-02-19 23:27:37.597 UTC","last_edit_date":"2017-05-23 12:14:20.03 UTC","last_editor_display_name":"","last_editor_user_id":"-1","owner_display_name":"","owner_user_id":"145350","post_type_id":"1","score":"4","tags":"python|concurrency|namespaces|multithreading","view_count":"1449"} @@ -3536,7 +3536,7 @@ {"id":"41816831","title":"WTForms Select Field Throws a 400 error when submitted","body":"\u003cp\u003eI'm using a WTForm \u003ca href=\"http://wtforms.simplecodes.com/docs/0.6.1/fields.html#wtforms.fields.SelectField\" rel=\"nofollow noreferrer\"\u003eSelectField\u003c/a\u003e to send data via a post request. \u003c/p\u003e\n\n\u003cp\u003eHowever, whenever I attempt to submit the form I receive a 400 error (\"Bad Request, The browser (or proxy) sent a request that this server could not understand.\"). I have a text field form that is built roughly the same way and works perfectly fine so I'm not sure why this form isn't working. I have read through the docs and searched for an answer but cannot seem to crack this one. Here's the structure:\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eforms.py\u003c/strong\u003e\u003c/p\u003e\n\n\u003cp\u003eNote: \u003ccode\u003eCATEGORIES\u003c/code\u003e is a dict that holds the key, value pairs that will be used in the select field. I order them first to ensure they are passed in the same way every time\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003efrom config import CATEGORIES\n\ncategories = { v:k for k,v in CATEGORIES.items()}\nordered_categories = collections.OrderedDict(sorted(categories.items())).items()\n\nCHOICES = [x for x in ordered_categories]\n\n\nclass SearchForm(FlaskForm):\n choices = CHOICES\n input_category = SelectField('input_category', choices=choices)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003cstrong\u003eviews.py\u003c/strong\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003efrom .forms import CHOICES, SearchForm\n\n@app.route('/index', methods=['GET', 'POST'])\ndef index():\n category_search_form = SearchForm()\n\n if category_search_form.validate_on_submit():\n # The code doesn't make it here due to the 400 error\n selection = dict(CHOICES).get(category_search_form.input_category.data)\n return render_template(\u0026lt;template args are here based on selection\u0026gt;)\n\n return render_template(\n 'index.html',\n title='Home',\n category_search_form=category_search_form,\n ua_id=UA_TRACKING_ID,\n contact_us_form=contact_us_form)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003cstrong\u003eindex.html w/ Jinja2 template\u003c/strong\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;form action=\"\" method=\"post\" name=\"category\"\u0026gt;\n {{ category_search_form.hidden_tag() }}\n \u0026lt;div class=\"select-form\"\u0026gt;\n {{ category_search_form.input_category() }}\n {% for error in category_search_form.input_category.errors %}\n \u0026lt;span class=\"form-error\"\u0026gt;* {{ error }}\u0026lt;/span\u0026gt;\n {% endfor %}\n \u0026lt;/div\u0026gt;\n \u0026lt;ul class=\"actions\"\u0026gt;\n \u0026lt;li class=\"form-search-button\"\u0026gt;\n \u0026lt;input type=\"submit\" value=\"Search\" name=\"category-search-button\" class=\"special\" /\u0026gt;\n \u0026lt;/li\u0026gt;\n \u0026lt;li class=\"form-search-button\"\u0026gt;\n \u0026lt;input type=\"submit\" value=\"Random Search\" name=\"category-search-button\" class=\"special\" /\u0026gt;\n \u0026lt;/li\u0026gt;\n \u0026lt;/ul\u0026gt;\n\u0026lt;/form\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAny help would be much appreciated.\u003c/p\u003e","answer_count":"0","comment_count":"1","creation_date":"2017-01-23 22:29:54.617 UTC","last_activity_date":"2017-01-23 22:29:54.617 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"4942372","post_type_id":"1","score":"0","tags":"python|flask|jinja2|wtforms|flask-wtforms","view_count":"59"} {"id":"26561957","title":"Get mysql value into php variable","body":"\u003cp\u003eI have a site set up with a mysql DB that stores user data. The database structure looks like this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003etable = users\n\ncolumns = Id : username : email : password : active \n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eUnder the column \u003ccode\u003eactive\u003c/code\u003e the value is 1 for active and 0 for deactive \u003c/p\u003e\n\n\u003cp\u003eWhen a user pays for my site, the \u003ccode\u003eactive\u003c/code\u003e value changes from 0 to 1. \u003c/p\u003e\n\n\u003cp\u003eI want to show now if a user has paid or not at the user profile.\u003c/p\u003e\n\n\u003cp\u003eHow can I query the database to get the value of the \u003ccode\u003eactive\u003c/code\u003e column based on the \u003ccode\u003eusername\u003c/code\u003e and save it as a variable to use later in the script? \u003c/p\u003e","accepted_answer_id":"26562006","answer_count":"1","comment_count":"0","creation_date":"2014-10-25 11:40:33.637 UTC","last_activity_date":"2014-10-28 15:07:53.41 UTC","last_edit_date":"2014-10-28 15:07:53.41 UTC","last_editor_display_name":"","last_editor_user_id":"2025928","owner_display_name":"","owner_user_id":"3902783","post_type_id":"1","score":"0","tags":"php|mysql|usersession","view_count":"1610"} {"id":"29002654","title":"Oracle ADF: How to enable a user to Stay Logged In","body":"\u003cp\u003eI am developing a web application using Oracle ADF. In my web application user has to log in to access web application. Application is working fine. Now I need to enable a feature like once a user has logged In and due to some reasons he closed a tab not the browser. So whenever he try to access the same application he do not need to login again. Since browser has not closed the user has to be automatically logged in.\u003c/p\u003e\n\n\u003cp\u003eFor this I googled a lot and got information that we can achieve this using browser cache and servlet filters. I got information from \u003ca href=\"https://stackoverflow.com/questions/5082846/java-ee-6-how-to-implement-stay-logged-in-when-user-login-in-to-the-web-appli\"\u003eThis Stackoverflow question\u003c/a\u003e. But I don't know how to implement Filters and all in Oracle ADF web application. Please help on this.\u003c/p\u003e\n\n\u003cp\u003eThanks in advance.\u003c/p\u003e","accepted_answer_id":"29004226","answer_count":"1","comment_count":"0","creation_date":"2015-03-12 05:43:11.233 UTC","last_activity_date":"2015-03-12 07:39:46.467 UTC","last_edit_date":"2017-05-23 11:43:22.443 UTC","last_editor_display_name":"","last_editor_user_id":"-1","owner_display_name":"","owner_user_id":"2771888","post_type_id":"1","score":"0","tags":"java|java-ee|jsf-2.2|oracle-adf","view_count":"330"} -{"id":"38535702","title":"onEdit() stopped working?","body":"\u003cp\u003eSo I have a Google sheet where, when a user enters a number of an item, it will output a description and price. I actually have 50 sheets (one for each state in the US) that are all almost exactly the same, but put out slightly different prices because state taxes vary from state to state.\u003c/p\u003e\n\n\u003cp\u003eI used onEdit() to have my sheet work and it was working fine until I changed where the source for information came from. Originally in my sheet, I had another page with all the item information so that a simple Vlookup could do most of the work except calculate the item's price (this is what my code was doing, using the info page that was in the sheet to calculate a price). \u003c/p\u003e\n\n\u003cp\u003eHowever, when an edit needs to be made to an item, I want to make it so that we only have to update one \"master\" sheet, and make a call by openByUrl(...) instead of going to all 50 sheets and copy pasting the information. I tried implementing this in a sheet, and now it doesn't work when I edit, but it does work when I manually go into script editor and press run. What gives?\u003c/p\u003e\n\n\u003cp\u003eEDIT: Here's the code requested.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003efunction onEdit(d) {\n itemPriceSetup();\n}\n\n// Runs the actual program.\nfunction itemPriceSetup() {\n\n // Grabs and stores the sheet where a customer places an item number and where the code will output the price to.\n var orderSheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(\"Item Sale Doc\");\n var orderSheetArray = orderSheet.getSheetValues(1, 1, 34, 8);\n\n // Grabs and stores the sheet that has the information on the item.\n //***var infoSheet = SpreadsheetApp.openByUrl('link to info');\n var infoSheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(\"sheet with info\");\n var infoSheetArray = infoSheet.getSheetValues(1, 1, infoSheet.getLastRow(), 10);\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eSo the code with the three asterisks is what I want to use, but causes my the program to not work - that is, it onEdit() won't run (I have it commented out so the code will run - the line below it is the one I'm trying to replace). If I were to go through the debugger with the line un-commented, it actually works.\u003c/p\u003e","answer_count":"1","comment_count":"3","creation_date":"2016-07-22 21:46:22.883 UTC","favorite_count":"1","last_activity_date":"2016-07-28 01:24:49.643 UTC","last_edit_date":"2016-07-28 01:24:49.643 UTC","last_editor_display_name":"","last_editor_user_id":"1595451","owner_display_name":"","owner_user_id":"4339558","post_type_id":"1","score":"1","tags":"google-apps-script|google-spreadsheet|user-input","view_count":"768"} +{"id":"38535702","title":"onEdit() stopped working?","body":"\u003cp\u003eSo I have a Google sheet where, when a user enters a number of an item, it will output a description and price. I actually have 50 sheets (one for each state in the US) that are all almost exactly the same, but put out slightly different prices because state taxes vary from state to state.\u003c/p\u003e\n\n\u003cp\u003eI used onEdit() to have my sheet work and it was working fine until I changed where the source for information came from. Originally in my sheet, I had another page with all the item information so that a simple Vlookup could do most of the work except calculate the item's price (this is what my code was doing, using the info page that was in the sheet to calculate a price). \u003c/p\u003e\n\n\u003cp\u003eHowever, when an edit needs to be made to an item, I want to make it so that we only have to update one \"main\" sheet, and make a call by openByUrl(...) instead of going to all 50 sheets and copy pasting the information. I tried implementing this in a sheet, and now it doesn't work when I edit, but it does work when I manually go into script editor and press run. What gives?\u003c/p\u003e\n\n\u003cp\u003eEDIT: Here's the code requested.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003efunction onEdit(d) {\n itemPriceSetup();\n}\n\n// Runs the actual program.\nfunction itemPriceSetup() {\n\n // Grabs and stores the sheet where a customer places an item number and where the code will output the price to.\n var orderSheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(\"Item Sale Doc\");\n var orderSheetArray = orderSheet.getSheetValues(1, 1, 34, 8);\n\n // Grabs and stores the sheet that has the information on the item.\n //***var infoSheet = SpreadsheetApp.openByUrl('link to info');\n var infoSheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(\"sheet with info\");\n var infoSheetArray = infoSheet.getSheetValues(1, 1, infoSheet.getLastRow(), 10);\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eSo the code with the three asterisks is what I want to use, but causes my the program to not work - that is, it onEdit() won't run (I have it commented out so the code will run - the line below it is the one I'm trying to replace). If I were to go through the debugger with the line un-commented, it actually works.\u003c/p\u003e","answer_count":"1","comment_count":"3","creation_date":"2016-07-22 21:46:22.883 UTC","favorite_count":"1","last_activity_date":"2016-07-28 01:24:49.643 UTC","last_edit_date":"2016-07-28 01:24:49.643 UTC","last_editor_display_name":"","last_editor_user_id":"1595451","owner_display_name":"","owner_user_id":"4339558","post_type_id":"1","score":"1","tags":"google-apps-script|google-spreadsheet|user-input","view_count":"768"} {"id":"24854600","title":"Android AsyncTask Hangs using Parse SDK","body":"\u003cp\u003eHere is a video of the problem\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"http://www.youtube.com/watch?v=GsTVruQaxqs\u0026amp;feature=youtu.be\" rel=\"nofollow\"\u003ehttp://www.youtube.com/watch?v=GsTVruQaxqs\u0026amp;feature=youtu.be\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eParse.com is our backend and when the user goes to the search activity, I use an asyncTask to download the data from parse.\u003c/p\u003e\n\n\u003cp\u003eIf the user hits the right combination of buttons, in this case the back button at the right time, then the next time the user goes to the search activity the async tasks will either enter the doInbackground method and hang, or they will not enter at all and the spinner shows indefinitely. Caching does not fix the problem, neither does Pinning the query. If I hit back at the wrong time and try to reload, eventually ill get this behavior.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003efinal ParseQuery\u0026lt;ParseObject\u0026gt; query = new ParseQuery\u0026lt;ParseObject\u0026gt;(\n \"UploadedGear\");\n\n final ParseQuery\u0026lt;ParseObject\u0026gt; query2 = new ParseQuery\u0026lt;ParseObject\u0026gt;(\n \"Experiences\");\n\n query.whereEqualTo(\"status\", \"active\")\n .whereEqualTo(\"searchCities\", mCity.trim())\n .setLimit(2)\n .setSkip(gearSkip);\n\n query2.whereEqualTo(\"status\", \"active\")\n .whereEqualTo(\"searchCities\", mCity.trim())\n .setLimit(2)\n .setSkip(expSkip);\n\n Log.e(\"query task \", \"executing\");\n\n ((DiscoverActivity) getActivity()).addDownloadTask(downloadAction);\n ((DiscoverActivity) getActivity()).addQuery(query);\n ((DiscoverActivity) getActivity()).addQuery(query2);\n\n\n\n\n query.findInBackground(new FindCallback\u0026lt;ParseObject\u0026gt;() {\n @Override\n public void done(final List\u0026lt;ParseObject\u0026gt; objs, ParseException e) {\n\n\n if (e != null)\n query.cancel();\n\n\n ParseObject.unpinAllInBackground(\"GEAR_RESULTS\", objs, new DeleteCallback() {\n public void done(ParseException e) {\n if (e != null) {\n return;\n }\n\n ParseObject.pinAllInBackground(\"GEAR_RESULTS\", objs);\n }\n });\n\n\n for (ParseObject country : objs) {\n\n Log.e(\"gear size\", new Integer(objs.size()).toString());\n\n\n UploadedGear map = new UploadedGear();\n map.setPrice((String) country.get(\"Price\"));\n map.setTitle((String) country.get(\"title\"));\n map.setCity((String) country.get(\"City\"));\n map.setActivityType((String) country.get(\"activity\"));\n map.setDesc((String) country.get(\"description\"));\n map.setObjectId(country.getObjectId());\n ParseQuery\u0026lt;ParseUser\u0026gt; userQuery = ParseUser.getQuery();\n ParseUser pointer = (ParseUser) country.get(\"Owner\");\n map.setOwnerId(pointer.getObjectId());\n userQuery.whereEqualTo(\"objectId\", pointer.getObjectId());\n\n map.setOwnerDisplayName(\"\");\n map.setOwnerUrl(\"\");\n ParseFile bum = (ParseFile) country.get(\"icon\");\n map.setImage(bum.getUrl());\n results.add(map);\n }\n\n\n if (getActivity() != null) {\n //ela.setNotifyOnChange(true);\n\n EndlessListAdapter el = (EndlessListAdapter) stv.getAdapter();\n\n\n if (el != null) {\n\n for (UserContent item : results) {\n\n\n synchronized (el) {\n ((UserContent) item).getActivityType();\n if (!el.contains((UserContent) item) \u0026amp;\u0026amp; (((UserContent) item).getActivityType().equals(mActivity) || mActivity.equalsIgnoreCase(\"all\"))) {\n el.add(item);\n if ((UserContent) item instanceof Experience)\n expSkip += 1;\n else\n gearSkip += 1;\n el.notifyDataSetChanged();\n }\n }\n }\n isLoading = false;\n\n\n ((DiscoverActivity) getActivity()).setInitializing(false);\n\n\n if (mFooter == null) {\n mFooter = new ListViewFooter(getActivity());\n }\n\n\n if (results.isEmpty()) {\n\n //set Empty View\n if (noGearAvailable == true) {\n hideFooter();\n hideBar();\n }\n loadingComplete = true;\n hideFooter();\n } else {\n\n }\n\n\n\n }\n }\n }\n });\n\n //query2.setCachePolicy(ParseQuery.CachePolicy.NETWORK_ELSE_CACHE);\n\n query2.findInBackground(new FindCallback\u0026lt;ParseObject\u0026gt;() {\n\n\n @Override\n public void done(final List\u0026lt;ParseObject\u0026gt; exps, ParseException e) {\n\n\n ParseObject.unpinAllInBackground(\"EXPERIENCES_RESULTS\", exps, new DeleteCallback() {\n public void done(ParseException e) {\n if (e != null) {\n return;\n }\n\n // Add the latest results for this query to the cache.\n ParseObject.pinAllInBackground(\"EXPERIENCES_RESULTS\", exps);\n }\n });\n\n\n hideBar();\n\n Log.e(\"experience size\", new Integer(exps.size()).toString());\n\n for (ParseObject experience : exps) {\n Experience exp = new Experience();\n\n\n exp.setImage((String) experience.get(\"mainImg\"));\n exp.setActivityType((String) experience.get(\"activity\"));\n exp.setObjectId(experience.getObjectId());\n ArrayList\u0026lt;String\u0026gt; stringValues = (ArrayList\u0026lt;String\u0026gt;) experience.get(\"searchCities\");\n exp.setCity(new String(stringValues.get(0)));\n exp.setTitle((String) experience.get(\"title\"));\n exp.setDesc((String) experience.get(\"about\"));\n exp.setPrice(\"10\");\n\n\n ParseUser pointer = (ParseUser) experience.get(\"Guide\");\n exp.setOwnerId(pointer.getObjectId());\n\n\n exp.setOwnerUrl(\"\");\n exp.setOwnerDisplayName(\"\");\n results.add(exp);\n }\n\n if (getActivity() != null) {\n //ela.setNotifyOnChange(true);\n\n EndlessListAdapter el = (EndlessListAdapter) stv.getAdapter();\n\n\n if (el != null) {\n\n for (UserContent item : results) {\n\n synchronized (el) {\n ((UserContent) item).getActivityType();\n if (!el.contains((UserContent) item) \u0026amp;\u0026amp; (((UserContent) item).getActivityType().equals(mActivity) || mActivity.equalsIgnoreCase(\"all\"))) {\n el.add(item);\n if ((UserContent) item instanceof Experience)\n expSkip += 1;\n else\n gearSkip += 1;\n el.notifyDataSetChanged();\n }\n }\n }\n // flag the loading is finished\n isLoading = false;\n\n\n ((DiscoverActivity) getActivity()).setInitializing(false);\n\n\n if (mFooter == null) {\n mFooter = new ListViewFooter(getActivity());\n }\n\n\n if (results.isEmpty()) {\n\n //set Empty View\n if (noGearAvailable == true) {\n hideFooter();\n hideBar();\n }\n loadingComplete = true;\n hideFooter();\n } else {\n\n }\n\n }\n }\n\n\n }\n });\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"0","comment_count":"2","creation_date":"2014-07-20 20:27:49.53 UTC","favorite_count":"2","last_activity_date":"2015-06-30 11:16:20.207 UTC","last_edit_date":"2014-07-20 21:40:40.043 UTC","last_editor_display_name":"","last_editor_user_id":"1166449","owner_display_name":"","owner_user_id":"1166449","post_type_id":"1","score":"3","tags":"android|android-asynctask|parse.com","view_count":"417"} {"id":"27305433","title":"XML Parse Error - Extra Content at end of document","body":"\u003cp\u003eI've been following a tutorial to create an XML Page using PHP. Below is the code.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;?\nheader('Content-type: text/xml');\n\nmysql_connect('localhost','root','admin');\nmysql_select_db('test');\n\n$sql = \"Select * from `books`\";\n$q = mysql_query($sql) or die(mysql_error());\n\n\n$dom = new DOMDocument();\n\n$datas = $dom-\u0026gt;createElement('datas');\n$dom-\u0026gt;appendChild($datas);\n\nwhile($r = mysql_fetch_array($q)){\n $id = $dom-\u0026gt;createElement('id');\n $idText = $dom-\u0026gt;createTextNode($r['id']);\n $id-\u0026gt;appendChild($idText);\n\n $title = $dom-\u0026gt;createElement('title');\n $titleText = $dom-\u0026gt;createTextNode($r['title']);\n $title-\u0026gt;appendChild($titleText);\n\n $author = $dom-\u0026gt;createElement('author');\n $authorText = $dom-\u0026gt;createTextNode($r['author']);\n $author-\u0026gt;appendChild($authorText);\n\n $book = $dom-\u0026gt;createElement('book');\n $book-\u0026gt;appendChild($id);\n $book-\u0026gt;appendChild($title);\n $book-\u0026gt;appendChild($author);\n\n $datas-\u0026gt;appendChild($book);\n\n}\n\n\n$xmlString = $dom-\u0026gt;saveXML();\necho $xmlString;\n\n?\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eBut for some reason when I run this I get an error which is - \"error on line 5 at column 1: Extra content at the end of the document\"\u003c/p\u003e","answer_count":"0","comment_count":"2","creation_date":"2014-12-04 22:30:47.57 UTC","last_activity_date":"2014-12-04 22:30:47.57 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1849663","post_type_id":"1","score":"0","tags":"php|xml","view_count":"407"} {"id":"25893938","title":"Cell References in Cube Formula - Excel PowerPivot","body":"\u003cp\u003eI'm looking to run a \u003ccode\u003eCUBEVALUE\u003c/code\u003e formula with member expressions based on the contents of multiple different cells. For this example i have 2 cells with a value for REGION in:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eI15: Border\nI16: Midlands\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI can reference one cell successfully using a cube value formula:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e=CUBEVALUE(\"PowerPivot Data\",\"[Measures].[Sum of WEIGHTED_IMPRESSIONS]\",\"[pvtBASE].[REGION].\u0026amp;[\"\u0026amp;I$15\u0026amp;\"]\")\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eCouldn't find a way within \u003ccode\u003eCUBEVALUE\u003c/code\u003e alone to replicate this result to reference both \u003ccode\u003eI15\u003c/code\u003e and \u003ccode\u003eI16\u003c/code\u003e so tried with a \u003ccode\u003eCUBESET\u003c/code\u003e then referencing the \u003ccode\u003eCUBESET\u003c/code\u003e in a later \u003ccode\u003eCUBEVALUE\u003c/code\u003e formula:\u003c/p\u003e\n\n\u003cp\u003eFor the \u003ccode\u003eCUBESET\u003c/code\u003e, this formula works:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e=CUBESET(\"PowerPivot Data\",{\"[pvtBASE].[REGION].\u0026amp;[Midlands]\",\"[pvtBASE].[REGION].\u0026amp;[Border]\"})\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThis formula works:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e=CUBESET(\"PowerPivot Data\",\"[pvtBASE].[REGION].\u0026amp;[\"\u0026amp;I15\u0026amp;\"]\")\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eBut for some reason this doesn't:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e=CUBESET(\"PowerPivot Data\",{\"[pvtBASE].[REGION].\u0026amp;[\"\u0026amp;I15\u0026amp;\"]\",\"[pvtBASE].[REGION].\u0026amp;[\"\u0026amp;I16\u0026amp;\"]\"})\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eDoes anyone know how to fix the final \u003ccode\u003eCUBESET\u003c/code\u003e formula or if perhaps there is another way of fitting multiple members and cell references into a \u003ccode\u003eCUBEVALUE\u003c/code\u003e formula. \u003c/p\u003e\n\n\u003cp\u003eFeels like i'm close but then again I might not be!\u003c/p\u003e\n\n\u003cp\u003eCheers\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2014-09-17 14:55:42.357 UTC","last_activity_date":"2014-09-19 20:00:52.87 UTC","last_edit_date":"2014-09-17 15:27:52.067 UTC","last_editor_display_name":"","last_editor_user_id":"3975214","owner_display_name":"","owner_user_id":"4050943","post_type_id":"1","score":"2","tags":"cube|powerpivot","view_count":"2489"} @@ -3560,7 +3560,7 @@ {"id":"254047","title":"How to create HTTP 301 redirect from Stellent (Oracle UCM) script","body":"\u003cp\u003eIs it possible to send a HTTP response with a permanent redirect from a Stellent (now called Oracle UCM) website? We're using version 7.5.2 with iDoc script.\u003c/p\u003e\n\n\u003cp\u003eWe can use the iDoc function setHttpHeader() to send the Location HTTP header, but how to send the HTTP response code 301, to signal the permanent redirect to the browser?\u003c/p\u003e","accepted_answer_id":"3232309","answer_count":"4","comment_count":"0","creation_date":"2008-10-31 16:09:38.833 UTC","last_activity_date":"2016-01-04 14:50:31.91 UTC","last_edit_date":"2009-05-01 06:22:26.573 UTC","last_editor_display_name":"","last_editor_user_id":"70157","owner_display_name":"Kwebble","owner_user_id":"4167","post_type_id":"1","score":"1","tags":"http-headers|oracle-ucm|idoc|stellent","view_count":"1326"} {"id":"19265541","title":"How to apply css with jquery outside from iframe","body":"\u003cp\u003eI am using iframe popup and i want to change something outside of iframe with jquery from iframe ?\u003c/p\u003e\n\n\u003cp\u003ethis need to be done with jquery.\u003c/p\u003e\n\n\u003cp\u003ecode like this \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;iframe\u0026gt; \u0026lt;div id=\"change\"\u0026gt;Change css\u0026lt;/div\u0026gt; \u0026lt;/iframe\u0026gt;\n\u0026lt;div class=\"outer-div\"\u0026gt; Text goes here \u0026lt;/div\u0026gt;\n\n\u0026lt;script\u0026gt;\n$(\"#change\").live('click', function(){\n $('#outer-div').css('display','none');\n});\n\u0026lt;script\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ei want to hide of outer div click on iframe inner div\u003c/p\u003e\n\n\u003cp\u003ethanks\nSimranjeet singh\u003c/p\u003e","answer_count":"1","comment_count":"4","creation_date":"2013-10-09 07:19:20.073 UTC","last_activity_date":"2013-10-09 08:33:33.337 UTC","last_edit_date":"2013-10-09 08:33:33.337 UTC","last_editor_display_name":"","last_editor_user_id":"2772774","owner_display_name":"","owner_user_id":"2772774","post_type_id":"1","score":"0","tags":"javascript|jquery|css|iframe|popup","view_count":"906"} {"id":"20005358","title":"what is android /dev/input/eventX file used for?","body":"\u003cp\u003eDo these file represent all the sensors in a device ? I have a rot access on my android device but when I try to open these files I see that they are empty, my filer browser tells that these files have been modified a few seconds before I browse this directory\u003c/p\u003e","accepted_answer_id":"20005849","answer_count":"1","comment_count":"0","creation_date":"2013-11-15 16:06:15.597 UTC","favorite_count":"0","last_activity_date":"2013-11-15 18:17:28.677 UTC","last_edit_date":"2013-11-15 16:11:53.423 UTC","last_editor_display_name":"","last_editor_user_id":"1227842","owner_display_name":"","owner_user_id":"1227842","post_type_id":"1","score":"1","tags":"android|android-sensors","view_count":"1189"} -{"id":"5680693","title":"Duplicate Data invalid identifier","body":"\u003cp\u003eMy query is showing all possible combinations of results for this query when i use query builder. \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eselect \n \"PURCHASEDETAIL\".\"PMID\" as \"PMID\",\n \"PURCHASEDETAIL\".\"CUSTOMER_ID\" as \"CUSTOMERID\",\n \"PRODUCT\".\"DESCRIPTION\" as \"DESCRIPTION\",\n \"PRODUCT\".\"PRICE\" as \"PRICE\",\n \"PURCHASEDETAIL\".\"QUANTITY\" as \"QUANTITY\",\n \"SUPPLIER\".\"SUPPLIER_NAME\" as \"SUPPLIER_NAME\",\n \"PURCHASEMASTER\".\"PURCHASE_DATE_TIME\" as \"PURCHASE_DATE_TIME\" \n from \n \"SUPPLIER\"\n left join product\n ON supplier.supplierid = product.supplierid\n left join purchasemaster\n on purchasemaster.customerid = purchasedetail.customerid\n left join purchasedetail\n on purchasedetail.pmid = purchasemaster.pmid\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhen I enter the above info to pull info from 4 table I get the below error. \u003c/p\u003e\n\n\u003cp\u003eORA-00904: \"PURCHASEDETAIL\".\"CUSTOMER_ID\": invalid identifier\u003c/p\u003e\n\n\u003cp\u003eAny ideas why? \u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2011-04-15 18:10:28.27 UTC","last_activity_date":"2011-04-15 19:02:45.2 UTC","last_edit_date":"2011-04-15 18:18:32.567 UTC","last_editor_display_name":"","last_editor_user_id":"649922","owner_display_name":"","owner_user_id":"710272","post_type_id":"1","score":"2","tags":"sql|identifier","view_count":"472"} +{"id":"5680693","title":"Duplicate Data invalid identifier","body":"\u003cp\u003eMy query is showing all possible combinations of results for this query when i use query builder. \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eselect \n \"PURCHASEDETAIL\".\"PMID\" as \"PMID\",\n \"PURCHASEDETAIL\".\"CUSTOMER_ID\" as \"CUSTOMERID\",\n \"PRODUCT\".\"DESCRIPTION\" as \"DESCRIPTION\",\n \"PRODUCT\".\"PRICE\" as \"PRICE\",\n \"PURCHASEDETAIL\".\"QUANTITY\" as \"QUANTITY\",\n \"SUPPLIER\".\"SUPPLIER_NAME\" as \"SUPPLIER_NAME\",\n \"PURCHASECLUSTERMANAGER\".\"PURCHASE_DATE_TIME\" as \"PURCHASE_DATE_TIME\" \n from \n \"SUPPLIER\"\n left join product\n ON supplier.supplierid = product.supplierid\n left join purchaseclustermanager\n on purchaseclustermanager.customerid = purchasedetail.customerid\n left join purchasedetail\n on purchasedetail.pmid = purchaseclustermanager.pmid\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhen I enter the above info to pull info from 4 table I get the below error. \u003c/p\u003e\n\n\u003cp\u003eORA-00904: \"PURCHASEDETAIL\".\"CUSTOMER_ID\": invalid identifier\u003c/p\u003e\n\n\u003cp\u003eAny ideas why? \u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2011-04-15 18:10:28.27 UTC","last_activity_date":"2011-04-15 19:02:45.2 UTC","last_edit_date":"2011-04-15 18:18:32.567 UTC","last_editor_display_name":"","last_editor_user_id":"649922","owner_display_name":"","owner_user_id":"710272","post_type_id":"1","score":"2","tags":"sql|identifier","view_count":"472"} {"id":"38355305","title":"UWP buttons inside Listview items","body":"\u003cp\u003eI'm working on my first UWP app and I want create a UI like this \u003cimg src=\"https://i.stack.imgur.com/24q7g.png\" alt=\"\"\u003e. For each list item (project) there'll be a set of buttons. For certain list items(projects) some of these buttons will be disabled some times. So I need to disable and change the image for such button in those list items(projects).\u003c/p\u003e\n\n\u003cp\u003eI tried to implement it using a list view like this. But I am not sure how I can enable/disable some of those buttons depending on the condition.\u003c/p\u003e\n\n\u003cp\u003eTried adding a DataContextChanged event and trying to access the buttons there. But not sure how I can access those buttons.\u003c/p\u003e\n\n\u003cp\u003ePlease let me know whether the following approach is correct or is there a better way to do what I am trying to achieve in the above image.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e \u0026lt;ListView x:Name=\"stepsListView\" Margin=\"10,0,0,0\" RequestedTheme=\"Dark\" FontSize=\"24\" Background=\"{StaticResource procedure_app_white}\" Foreground=\"Black\" BorderThickness=\"1.5\" BorderBrush=\"Transparent\" ItemsSource=\"{Binding projectList}\" HorizontalAlignment=\"Left\"\u0026gt;\n \u0026lt;ListView.ItemContainerStyle\u0026gt;\n \u0026lt;Style TargetType=\"ListViewItem\"\u0026gt;\n \u0026lt;Setter Property=\"HorizontalContentAlignment\" Value=\"Stretch\"/\u0026gt;\n \u0026lt;/Style\u0026gt;\n \u0026lt;/ListView.ItemContainerStyle\u0026gt;\n\n \u0026lt;!-- Item --\u0026gt;\n \u0026lt;ListView.ItemTemplate\u0026gt;\n \u0026lt;DataTemplate\u0026gt;\n \u0026lt;Border BorderThickness=\"0,0,0,1\" BorderBrush=\"#c0c0c0\"\u0026gt;\n \u0026lt;Grid Width=\"auto\" HorizontalAlignment=\"Stretch\" DataContextChanged=\"Grid_DataContextChanged\" \u0026gt;\n \u0026lt;Grid.RowDefinitions\u0026gt;\n \u0026lt;RowDefinition Height=\"*\"/\u0026gt;\n \u0026lt;RowDefinition Height=\"50\"/\u0026gt;\n \u0026lt;/Grid.RowDefinitions\u0026gt;\n \u0026lt;Grid.ColumnDefinitions\u0026gt;\n \u0026lt;ColumnDefinition Width=\"*\"/\u0026gt;\n \u0026lt;ColumnDefinition Width=\"100\"/\u0026gt;\n \u0026lt;ColumnDefinition Width=\"100\"/\u0026gt;\n \u0026lt;ColumnDefinition Width=\"100\"/\u0026gt;\n \u0026lt;ColumnDefinition Width=\"100\"/\u0026gt;\n \u0026lt;ColumnDefinition Width=\"100\"/\u0026gt;\n \u0026lt;ColumnDefinition Width=\"100\"/\u0026gt;\n \u0026lt;/Grid.ColumnDefinitions\u0026gt;\n \u0026lt;TextBlock VerticalAlignment=\"Center\" FontSize=\"30\" Grid.Row=\"0\" Grid.ColumnSpan=\"7\" Text=\"{Binding projectName}\" Foreground=\"{StaticResource procedure_app_orange_text }\" /\u0026gt;\n\n \u0026lt;Button x:Name=\"warningButton\" Width=\"40\" Height=\"40\" Grid.Column=\"1\" Grid.Row=\"1\" Tag=\"{Binding projectId}\" Click=\"warningButtonClick\" Foreground=\"{StaticResource procedure_app_orange_text }\"\u0026gt;\n \u0026lt;Button.Background\u0026gt;\n \u0026lt;ImageBrush ImageSource=\"Asset/step_ncwr.png\"\u0026gt;\n \u0026lt;/ImageBrush\u0026gt;\n \u0026lt;/Button.Background\u0026gt;\n \u0026lt;/Button\u0026gt;\n \u0026lt;Button x:Name=\"commentButton\" Width=\"40\" Height=\"40\" Grid.Column=\"2\" Grid.Row=\"1\" Tag=\"{Binding projectId}\" Click=\"CommentButtonClick\" Foreground=\"{StaticResource procedure_app_orange_text }\" IsTapEnabled=\"True\"\u0026gt;\n \u0026lt;Button.Background\u0026gt;\n \u0026lt;ImageBrush ImageSource=\"Asset/step_comment.png\"\u0026gt;\n \u0026lt;/ImageBrush\u0026gt;\n \u0026lt;/Button.Background\u0026gt;\n \u0026lt;/Button\u0026gt;\n \u0026lt;Button x:Name=\"imageButton\" Width=\"40\" Height=\"40\" Grid.Column=\"3\" Grid.Row=\"1\" Tag=\"{Binding projectId}\" Click=\"ImageButtonClick\" Foreground=\"{StaticResource procedure_app_orange_text }\"\u0026gt;\n \u0026lt;Button.Background\u0026gt;\n \u0026lt;ImageBrush ImageSource=\"Asset/step_image.png\"\u0026gt;\n \u0026lt;/ImageBrush\u0026gt;\n \u0026lt;/Button.Background\u0026gt;\n \u0026lt;/Button\u0026gt;\n \u0026lt;/Grid\u0026gt;\n \u0026lt;/Border\u0026gt;\n \u0026lt;/DataTemplate\u0026gt;\n \u0026lt;/ListView.ItemTemplate\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"38355645","answer_count":"1","comment_count":"0","creation_date":"2016-07-13 15:00:41.6 UTC","last_activity_date":"2016-12-30 20:29:42.457 UTC","last_edit_date":"2016-12-30 20:29:42.457 UTC","last_editor_display_name":"","last_editor_user_id":"4906107","owner_display_name":"","owner_user_id":"1692096","post_type_id":"1","score":"2","tags":"c#|xaml|listview|uwp|uwp-xaml","view_count":"2294"} {"id":"39974193","title":"Template Parse Error ngFor, FormArray","body":"\u003cp\u003eI am building dynamic objects using ReactiveFormsModule. My main module is \u003cstrong\u003eapp\u003c/strong\u003e. Then I have a sub-module \u003cstrong\u003econfig\u003c/strong\u003e. this component has \u003cstrong\u003eObjectConfigComponent\u003c/strong\u003e and \u003cstrong\u003eFieldConfigComponent\u003c/strong\u003e.\u003c/p\u003e\n\n\u003cp\u003eI built using reference \u003ca href=\"https://scotch.io/tutorials/how-to-build-nested-model-driven-forms-in-angular-2\" rel=\"nofollow\"\u003ehere\u003c/a\u003e\nThe plunker mentioned in the article seems to work. I haven't been able to run mine. \u003c/p\u003e\n\n\u003cp\u003eHere is my code.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eexport class CompositeObject {\n public fields: Field[];\n}\n\nexport class Field {\n public name: string;\n public datatype: DataType;\n}\n\nexport enum DataType {\n string = 1,\n number,\n date\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003cstrong\u003eObjectConfigComponent\u003c/strong\u003e:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eimport { Component, OnInit } from '@angular/core';\nimport { CompositeObject } from './../../models/compositeobject';\nimport { Validators, FormGroup, FormArray, FormBuilder } from '@angular/forms';\n\n@Component({\n selector: 'objectconfig',\n templateUrl: 'objectconfig.component.html'\n})\nexport class ObjectConfigComponent implements OnInit {\n public myForm: FormGroup;\n constructor(private _formbuilder: FormBuilder) { }\n\n public ngOnInit() {\n this.myForm = this._formbuilder.group({\n fields: this._formbuilder.array([\n this.initField(),\n ])\n });\n }\n\n public save(model: CompositeObject ) {\n console.log(model);\n }\n\n private initField() {\n // initialize our address\n return this._formbuilder.group({\n name: ['', Validators.required],\n datatype: ['string', Validators.required]\n });\n }\n\n private addField() {\n // add address to the list\n const control = \u0026lt;FormArray\u0026gt;this.myForm.controls['fields'];\n control.push(this.initField());\n }\n\n private removeField(i: number) {\n // remove address from the list\n const control = \u0026lt;FormArray\u0026gt;this.myForm.controls['fields'];\n control.removeAt(i);\n }\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003cstrong\u003eHTML\u003c/strong\u003e:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;div class=\"row\"\u0026gt;\n \u0026lt;div class=\"well bs-component\"\u0026gt;\n \u0026lt;form [formGroup]=\"myForm\" novalidate (ngSubmit)=\"save(myForm)\"\u0026gt;\n \u0026lt;!--fields--\u0026gt;\n \u0026lt;div formArrayName=\"fields\"\u0026gt;\n \u0026lt;div *ngFor=\"let field of myForm.controls.fields.controls; let i=index\"\u0026gt;\n \u0026lt;div [formGroupName]=\"i\"\u0026gt;\n \u0026lt;fieldform [group]=\"myForm.controls.fields.controls[i]\"\u0026gt;\u0026lt;/fieldform\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;div class=\"form-group\"\u0026gt;\n \u0026lt;div class=\"col-lg-10 col-lg-offset-2\"\u0026gt;\n \u0026lt;button class=\"btn btn-link\" (click)=\"addField()\"\u0026gt;Add another attribute\u0026lt;/button\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;div class=\"form-group\"\u0026gt;\n \u0026lt;div class=\"col-lg-10 col-lg-offset-2\"\u0026gt;\n \u0026lt;button type=\"reset\" class=\"btn btn-default\"\u0026gt;Cancel\u0026lt;/button\u0026gt;\n \u0026lt;button type=\"submit\" class=\"btn btn-primary\"\u0026gt;Submit\u0026lt;/button\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;/form\u0026gt;\n \u0026lt;/div\u0026gt;\n\u0026lt;/div\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003cstrong\u003eFieldFormComponent\u003c/strong\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eimport { Component, OnInit, Input } from '@angular/core';\nimport { FormGroup } from '@angular/forms';\n@Component({\n selector: 'fieldform',\n templateUrl: 'fieldform.component.html'\n})\nexport class FieldFormComponent implements OnInit {\n @Input('group')\n public fieldForm: FormGroup;\n constructor() { }\n\n ngOnInit() { }\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003cstrong\u003eHTML\u003c/strong\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;div [formGroup]=\"fieldForm\"\u0026gt;\n \u0026lt;!-- Angular assigns array index as group name by default 0, 1, 2, ... --\u0026gt;\n \u0026lt;div class=\"form-group\"\u0026gt;\n \u0026lt;!--name--\u0026gt;\n \u0026lt;label class=\"col-lg-2 control-label\"\u0026gt;Attribute\u0026lt;/label\u0026gt;\n \u0026lt;div class=\"col-lg-4\"\u0026gt;\n \u0026lt;input class=\"form-control\" id=\"inputName-{{i}}\" type=\"text\" formControlName=\"name\"\u0026gt;\n \u0026lt;!--display error message if street is not valid--\u0026gt;\n \u0026lt;small [hidden]=\"fieldForm.controls.name.valid\"\u0026gt;\n name is required\n \u0026lt;/small\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;!--datatype--\u0026gt;\n \u0026lt;div class=\"col-lg-4\"\u0026gt;\n \u0026lt;select class=\"form-control\" formControlName=\"datatype\"\u0026gt;\n \u0026lt;option\u0026gt;string\u0026lt;/option\u0026gt;\n \u0026lt;option\u0026gt;number\u0026lt;/option\u0026gt;\n \u0026lt;option\u0026gt;date\u0026lt;/option\u0026gt;\n \u0026lt;/select\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;/div\u0026gt;\n\u0026lt;/div\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI am getting the following error:\u003c/p\u003e\n\n\u003cblockquote\u003e\n \u003cp\u003eError: Uncaught (in promise): Error: Template parse errors: Can't bind\n to 'ngForOf' since it isn't a known property of 'div'. (\"\n \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e \u0026lt;div formArrayName=\"fields\"\u0026gt;\n\n \u0026lt;div [ERROR -\u0026gt;]*ngFor=\"let field of myForm.controls.fields.controls; let i=index\"\u0026gt;\n\n \u0026lt;div [formGr\"): ObjectConfigComponent@5:21 Property binding ngForOf not used by any directive on an embedded\n\u003c/code\u003e\u003c/pre\u003e\n \n \u003cp\u003etemplate. Make sure that the property name is spelled correctly and\n all directives are listed in the \"directives\" section. (\"\n \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e \u0026lt;div formArrayName=\"fields\"\u0026gt;\n\n [ERROR -\u0026gt;]\u0026lt;div *ngFor=\"let field of myForm.controls.fields.controls; let i=index\"\u0026gt;\n\n \u0026lt;div [f\"): ObjectConfigComponent@5:16\n\u003c/code\u003e\u003c/pre\u003e\n\u003c/blockquote\u003e\n\n\u003cp\u003eWhat am I doing wrong. \u003c/p\u003e","accepted_answer_id":"39974240","answer_count":"1","comment_count":"0","creation_date":"2016-10-11 09:26:30.807 UTC","last_activity_date":"2017-08-25 09:11:40.14 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1124913","post_type_id":"1","score":"2","tags":"angular|webpack|ngfor","view_count":"985"} {"id":"9317345","title":"Proper GROUP BY syntax","body":"\u003cp\u003eI'm fairly proficient in mySQL and MSSQL, but I'm just getting started with postgres. I'm sure this is a simple issue, so to be brief:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eSQL error:\n\nERROR: column \"incidents.open_date\" must appear in the GROUP BY clause or be used in an aggregate function\n\nIn statement:\nSELECT date(open_date), COUNT(*)\nFROM incidents\nGROUP BY 1\nORDER BY open_date\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe type for \u003ccode\u003eopen_date\u003c/code\u003e is \u003ccode\u003etimestamp with time zone\u003c/code\u003e, and I get the same results if I use \u003ccode\u003eGROUP BY date(open_date)\u003c/code\u003e.\u003c/p\u003e\n\n\u003cp\u003eI've tried going over the postgres docs and some examples online, but everything seems to indicate that this should be valid.\u003c/p\u003e","accepted_answer_id":"9317381","answer_count":"2","comment_count":"0","creation_date":"2012-02-16 18:57:14.287 UTC","last_activity_date":"2012-02-16 19:03:27.137 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1064767","post_type_id":"1","score":"1","tags":"postgresql","view_count":"1948"} @@ -3688,7 +3688,7 @@ {"id":"187633","title":"What are the reasons for these 2 error messages?","body":"\u003cp\u003eFirst of all, I'd like to say that this site is great!\u003c/p\u003e\n\n\u003cp\u003eMy question is, what are the reasons for the following 2 error messages?\u003c/p\u003e\n\n\u003cp\u003e1) In VB.NET (I know this is a C# forum but my next question is from C# experience), property evaluation failed (I do this when putting a watch on an exception variable).\u003c/p\u003e\n\n\u003cp\u003e2) In C#, method or class (Can't remember which) does not have a constructor. I think I got this with HttpContext or HttpApplication, which is a class if I remember correctly? Pretty sure it is as it has its own properties and methods.\u003c/p\u003e\n\n\u003cp\u003eThanks\u003c/p\u003e","answer_count":"3","comment_count":"5","creation_date":"2008-10-09 14:57:56.56 UTC","last_activity_date":"2008-10-13 12:23:32.303 UTC","last_edit_date":"2008-10-09 15:01:01.05 UTC","last_editor_display_name":"Gamecat","last_editor_user_id":"18061","owner_display_name":"GSS","post_type_id":"1","score":"0","tags":"c#|vb.net","view_count":"558"} {"id":"10432641","title":"Browser detection using Zend Framework or Javascript","body":"\u003cp\u003eI am creating an application that requires the ability to upload large files. I have chosen to use the \u003ca href=\"https://developer.mozilla.org/en/XMLHttpRequest/FormData\" rel=\"nofollow\"\u003eFormData\u003c/a\u003e object as using this I can report back to the user the progress. \u003c/p\u003e\n\n\u003cp\u003eNot surprisingly IE doesn't support this so I am having to fall back to Flash. What is the best way of detecting for IE 7/8/9+ using Zend Framework? I am loading in the other assets as per needed via the indexAction method in each controller. For example:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epublic function indexAction()\n{\n $this-\u0026gt;view-\u0026gt;stepnumber = 1;\n $this-\u0026gt;view-\u0026gt;stepintro = 'Upload your photo.';\n $this-\u0026gt;view-\u0026gt;headScript()-\u0026gt;appendFile($this-\u0026gt;view-\u0026gt;baseUrl().'/assets/js/fileuploader.js');\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eNow, in one of my pages I have already done some form of browser detection (for some \u003ccode\u003ecanvas\u003c/code\u003e work):\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epublic function indexAction()\n{\n\n $u_agent = $_SERVER['HTTP_USER_AGENT'];\n\n $this-\u0026gt;view-\u0026gt;stepnumber = 5;\n $this-\u0026gt;view-\u0026gt;stepintro = 'Select your cut out detail.';\n\n if(preg_match('/MSIE/i', $u_agent)) {\n $this-\u0026gt;view-\u0026gt;headScript()-\u0026gt;appendFile($this-\u0026gt;view-\u0026gt;baseUrl().'/assets/js/excanvas.js');\n } else {\n $this-\u0026gt;view-\u0026gt;headScript()-\u0026gt;appendFile($this-\u0026gt;view-\u0026gt;baseUrl().'/assets/js/mootools/mootools-canvas-lib/mcl-min.js');\n } \n\n $this-\u0026gt;view-\u0026gt;headScript()-\u0026gt;appendFile($this-\u0026gt;view-\u0026gt;baseUrl().'/assets/js/frank/pentool.js');\n\n $image = $this-\u0026gt;uploadsDb-\u0026gt;getImage(); \n\n $data = $this-\u0026gt;nodedataDb-\u0026gt;getNodedata($image-\u0026gt;id);\n\n $this-\u0026gt;view-\u0026gt;image = $image;\n $this-\u0026gt;view-\u0026gt;nodeData = $data;\n\n\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI am not too sold on this method though, I would rather check using Javascript as this would be more futureproof (I think). But how would I go about using Javasript within my ZF layout.phtml so I'm only loading the Javascript that I require? Cutting down on calls to the server.\u003c/p\u003e\n\n\u003cp\u003eAny help is much appreciated.\u003c/p\u003e\n\n\u003cp\u003eSOLUTION:\u003c/p\u003e\n\n\u003cp\u003eI have decided to use YepNope:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eyepnope({ \n test : \"FormData\" in window,\n yep : 'normal.js', \n nope : 'flashupload.js' \n}); \n\u003c/code\u003e\u003c/pre\u003e","answer_count":"2","comment_count":"6","creation_date":"2012-05-03 13:41:29.033 UTC","last_activity_date":"2015-01-27 14:11:24.443 UTC","last_edit_date":"2012-05-03 15:45:01.19 UTC","last_editor_display_name":"","last_editor_user_id":"387761","owner_display_name":"","owner_user_id":"387761","post_type_id":"1","score":"2","tags":"php|javascript|zend-framework|mootools|cross-browser","view_count":"1219"} {"id":"11811485","title":"as3 removeChild method in game giving problems","body":"\u003cp\u003eI have seen many questions on removeChild.\u003c/p\u003e\n\n\u003cp\u003eI've got an invaders type game, where bricks are falling from top, and you have to destroy them with a ball that keeps bouncing around.\u003c/p\u003e\n\n\u003cp\u003eWhen I want to remove the brick (referencing it with an array in a for loop), I randomly get the exception error (like many others) that the object must be a child of the caller.\u003c/p\u003e\n\n\u003cp\u003eThis was a solution:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eif (this.parent != null)\n{\nthis.parent.removeChild(this);\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e-- that is in my case, called from within the class of the target object (the brick).\u003c/p\u003e\n\n\u003cp\u003eBUT the thing is.. if this.parent really IS null\nthe brick just stays there! (when it should have been removed)\u003c/p\u003e","answer_count":"1","comment_count":"6","creation_date":"2012-08-04 19:40:43.31 UTC","last_activity_date":"2012-08-09 14:25:36.463 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1576523","post_type_id":"1","score":"0","tags":"actionscript-3|actionscript|removechild","view_count":"434"} -{"id":"46494950","title":"How to set up Accept-Encoding to gzip in Python client?","body":"\u003cp\u003eThis is probably a very newbie question, but I'm reading \u003ca href=\"http://docs.python-requests.org/en/master/user/quickstart/\" rel=\"nofollow noreferrer\"\u003eHTTP Request\u003c/a\u003e library and I need to write a code that will make a request to a server and asks for gzip compression (since the server supports gzip compression). \u003c/p\u003e\n\n\u003cp\u003eFor instance, I have:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eimport requests\n\nr = requests.get('some_url')\nr.json()\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI know it has something to do with sending \u003ccode\u003eAccept-Encoding: gzip\u003c/code\u003e in the header of the HTTP request, but I'm not sure how to do that. \u003c/p\u003e","answer_count":"1","comment_count":"1","creation_date":"2017-09-29 18:29:08.253 UTC","last_activity_date":"2017-09-29 18:34:20.197 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"5963271","post_type_id":"1","score":"0","tags":"python|http|gzip","view_count":"57"} +{"id":"46494950","title":"How to set up Accept-Encoding to gzip in Python client?","body":"\u003cp\u003eThis is probably a very newbie question, but I'm reading \u003ca href=\"http://docs.python-requests.org/en/main/user/quickstart/\" rel=\"nofollow noreferrer\"\u003eHTTP Request\u003c/a\u003e library and I need to write a code that will make a request to a server and asks for gzip compression (since the server supports gzip compression). \u003c/p\u003e\n\n\u003cp\u003eFor instance, I have:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eimport requests\n\nr = requests.get('some_url')\nr.json()\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI know it has something to do with sending \u003ccode\u003eAccept-Encoding: gzip\u003c/code\u003e in the header of the HTTP request, but I'm not sure how to do that. \u003c/p\u003e","answer_count":"1","comment_count":"1","creation_date":"2017-09-29 18:29:08.253 UTC","last_activity_date":"2017-09-29 18:34:20.197 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"5963271","post_type_id":"1","score":"0","tags":"python|http|gzip","view_count":"57"} {"id":"40425113","title":"Multiples of a number using Haskell","body":"\u003cp\u003eI have wrote the following function for finding the multiples of an input number.\nWhen I try to give negative numbers the output is only positive list.How can I modify my code to allow negative numbers to be listed in the output?\u003c/p\u003e\n\n\u003cp\u003eMy Try :\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003emultiples n = if n\u0026lt;0 then result1 else result2\nwhere\n result1 = [x | x \u0026lt;- [0..], x `mod` (-n) == 0] \n result2 = [x | x \u0026lt;- [0..], x `mod` n == 0]\n\n Input : take 5 $ multiples (-3)\n Output: [0,3,6,9,12]\n Expected Output: [0,-3,-6,-9,-12]\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"40425399","answer_count":"2","comment_count":"2","creation_date":"2016-11-04 14:25:39.62 UTC","last_activity_date":"2016-11-08 20:14:01.677 UTC","last_edit_date":"2016-11-08 20:14:01.677 UTC","last_editor_display_name":"","last_editor_user_id":"371753","owner_display_name":"","owner_user_id":"7115486","post_type_id":"1","score":"0","tags":"haskell|functional-programming","view_count":"68"} {"id":"32992774","title":"iOS simulaotr version","body":"\u003cp\u003eI tried Appium iOS tutorial (\u003ca href=\"http://appium.io/slate/en/tutorial/ios.html?java#\" rel=\"nofollow\"\u003ehttp://appium.io/slate/en/tutorial/ios.html?java#\u003c/a\u003e) and ran the example successfully. I noticed the UICatalog6.1.app runs on iOS simulator with title \"iPhone 6/iOS 8.2\" on the top of the simulator. However the title is \"iPhone 6/iOS 9.0\" when I run the app developed by myself from Xcode. I am wondering which part controls to use different version of iOS simulator?\u003c/p\u003e\n\n\u003cp\u003eThanks!\u003c/p\u003e","accepted_answer_id":"32992923","answer_count":"1","comment_count":"0","creation_date":"2015-10-07 12:54:18.88 UTC","last_activity_date":"2015-10-07 13:00:47.467 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1443721","post_type_id":"1","score":"0","tags":"ios|iphone|xcode|ios-simulator","view_count":"51"} {"id":"13354899","title":"Require.js and Zend Framework","body":"\u003cp\u003eWhat is best way for including Require.js in Zend Framework? My current way of calling js files in zend framework are as follow :\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;?php echo $this-\u0026gt;jQuery()-\u0026gt;setLocalPath($this-\u0026gt;path('js/jquery/jquery-1.7.1.min.js'))\n -\u0026gt;enable()\n -\u0026gt;setUiLocalPath($this-\u0026gt;path('js/jquery/jquery-ui-1.8.16.custom.min.js'))\n -\u0026gt;uiEnable()\n -\u0026gt;addStylesheet($this-\u0026gt;path('css/jquery/jquery-ui-1.8.16.custom.css'));\n\n echo $this-\u0026gt;headScript()-\u0026gt;appendFile($this-\u0026gt;path('js/jquery.tipTip.js'))\n\n -\u0026gt;appendFile($this-\u0026gt;path('js/customScripts/facebook.js'))\n -\u0026gt;appendFile($this-\u0026gt;path('js/facebook/jquery.facebook.multifriend.select.js'))\n -\u0026gt;appendFile($this-\u0026gt;path('js/customScripts/logindialog.js'))\n -\u0026gt;appendFile($this-\u0026gt;path('js/customScripts/globalFunctions.js'))\n -\u0026gt;appendFile($this-\u0026gt;path('js/kendo.web.min.js'))\n -\u0026gt;appendFile($this-\u0026gt;path('js/customScripts/fancyAlert.js'))\n -\u0026gt;appendFile($this-\u0026gt;path('js/inc/jquery.mousewheel.min.js'))\n -\u0026gt;appendFile($this-\u0026gt;path('js/pagination-jq.js'))\n\n\n -\u0026gt;appendFile($this-\u0026gt;path('js/jquery.tools.min.js'))\n -\u0026gt;appendFile($this-\u0026gt;path('js/fancybox/jquery.fancybox-1.3.4.pack.js'))\n -\u0026gt;appendFile($this-\u0026gt;path('js/jq-history/scripts/jquery.history.min.js'));\n\n ?\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"2","comment_count":"1","creation_date":"2012-11-13 02:45:33.973 UTC","favorite_count":"1","last_activity_date":"2015-01-30 11:48:20.847 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1471938","post_type_id":"1","score":"1","tags":"php|jquery|zend-framework|requirejs","view_count":"1030"} @@ -3704,7 +3704,7 @@ {"id":"33426405","title":"Unfortunately app has stopped After adding an image on the splash.xml","body":"\u003cp\u003eI've edited the splash.xml file I get the \"Unfortunately app has stopped\" error when i try to run the app.\u003c/p\u003e\n\n\u003cp\u003eThere was 2 images on this splash.xml file before I've edit it (when the app was working) \u003c/p\u003e\n\n\u003cul\u003e\n\u003cli\u003eFirstly I've added my new image to the drawable folder (where the first 2 image are) \u003c/li\u003e\n\u003cli\u003eand then I've used the Eclipse graphical layout to delete the 2 images and to add my new image \u003c/li\u003e\n\u003cli\u003ethen I've saved the file and I had cleaned the project then I've run it and I've get the error\u003c/li\u003e\n\u003c/ul\u003e\n\n\u003cp\u003eI've tried to re-run Eclipse and the emulator but the same problem \u003c/p\u003e\n\n\u003cp\u003eHere is the original splash.xml file:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;?xml version=\"1.0\" encoding=\"utf-8\"?\u0026gt;\n\u0026lt;RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\nxmlns:ads=\"http://schemas.android.com/apk/res-auto\"\nandroid:layout_width=\"fill_parent\"\nandroid:layout_height=\"fill_parent\"\nandroid:background=\"@color/main_bg\"\nandroid:gravity=\"center\" \u0026gt;\n\n\u0026lt;ImageView\n android:id=\"@+id/imageView1\"\n android:layout_width=\"180.0dip\"\n android:layout_height=\"180.0dip\"\n android:layout_below=\"@+id/imageView2\"\n android:layout_centerHorizontal=\"true\"\n android:src=\"@drawable/iconmain\" \n android:contentDescription=\"@string/app_name\"/\u0026gt;\n\n\u0026lt;ImageView\n android:id=\"@+id/imageView2\"\n android:layout_width=\"180.0dip\"\n android:layout_height=\"105.0dip\"\n android:layout_alignLeft=\"@+id/imageView1\"\n android:layout_alignParentTop=\"true\"\n android:layout_marginTop=\"14.0dip\"\n android:src=\"@drawable/title\" \n android:contentDescription=\"@string/app_name\"/\u0026gt;\n\n\u0026lt;/RelativeLayout\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAnd here's the modified version:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;?xml version=\"1.0\" encoding=\"utf-8\"?\u0026gt;\n\u0026lt;RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\nxmlns:ads=\"http://schemas.android.com/apk/res-auto\"\nandroid:layout_width=\"fill_parent\"\nandroid:layout_height=\"fill_parent\"\nandroid:background=\"@color/main_bg\"\nandroid:gravity=\"center\" \u0026gt;\n\n\u0026lt;ImageView\n android:id=\"@+id/imageView1\"\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"\n android:layout_centerHorizontal=\"true\"\n android:layout_centerVertical=\"true\"\n android:src=\"@drawable/applogofull\"/\u0026gt;\n\n\u0026lt;/RelativeLayout\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAnd here is the LogCat:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e 10-30 06:11:11.840: I/art(1961): Debugger is active\n10-30 06:11:11.999: I/System.out(1961): Debugger has connected\n10-30 06:11:11.999: I/System.out(1961): waiting for debugger to settle...\n10-30 06:11:12.203: I/System.out(1961): waiting for debugger to settle...\n10-30 06:11:12.403: I/System.out(1961): waiting for debugger to settle...\n10-30 06:11:12.603: I/System.out(1961): waiting for debugger to settle...\n10-30 06:11:12.803: I/System.out(1961): waiting for debugger to settle...\n10-30 06:11:13.004: I/System.out(1961): waiting for debugger to settle...\n10-30 06:11:13.204: I/System.out(1961): waiting for debugger to settle...\n10-30 06:11:13.404: I/System.out(1961): waiting for debugger to settle...\n10-30 06:11:13.605: I/System.out(1961): waiting for debugger to settle...\n10-30 06:11:13.805: I/System.out(1961): waiting for debugger to settle...\n10-30 06:11:14.006: I/System.out(1961): debugger has settled (1485)\n10-30 06:11:14.554: I/art(1961): Alloc sticky concurrent mark sweep GC freed 1724(90KB) AllocSpace objects, 0(0B) LOS objects, 26% free, 22MB/30MB, paused 289us total 37.744ms\n10-30 06:11:14.560: I/art(1961): Alloc partial concurrent mark sweep GC freed 65(15KB) AllocSpace objects, 0(0B) LOS objects, 40% free, 22MB/36MB, paused 491us total 5.432ms\n10-30 06:11:14.569: I/art(1961): Alloc concurrent mark sweep GC freed 17(12KB) AllocSpace objects, 0(0B) LOS objects, 39% free, 22MB/36MB, paused 402us total 9.377ms\n10-30 06:11:14.570: I/art(1961): Forcing collection of SoftReferences for 462MB allocation\n10-30 06:11:14.582: I/art(1961): Alloc concurrent mark sweep GC freed 11(344B) AllocSpace objects, 0(0B) LOS objects, 39% free, 22MB/36MB, paused 2.325ms total 12.381ms\n10-30 06:11:14.582: E/art(1961): Throwing OutOfMemoryError \"Failed to allocate a 485258948 byte allocation with 15447336 free bytes and 73MB until OOM\"\n10-30 06:11:14.600: I/art(1961): Alloc concurrent mark sweep GC freed 3(96B) AllocSpace objects, 0(0B) LOS objects, 39% free, 22MB/36MB, paused 1.374ms total 10.202ms\n10-30 06:11:14.600: I/art(1961): Forcing collection of SoftReferences for 462MB allocation\n10-30 06:11:14.609: I/art(1961): Alloc concurrent mark sweep GC freed 3(96B) AllocSpace objects, 0(0B) LOS objects, 39% free, 22MB/36MB, paused 788us total 8.989ms\n10-30 06:11:14.610: E/art(1961): Throwing OutOfMemoryError \"Failed to allocate a 485258948 byte allocation with 15447336 free bytes and 73MB until OOM\"\n10-30 06:11:14.610: D/skia(1961): --- allocation failed for scaled bitmap\n10-30 06:11:14.613: D/AndroidRuntime(1961): Shutting down VM\n10-30 06:11:14.619: E/AndroidRuntime(1961): FATAL EXCEPTION: main\n10-30 06:11:14.619: E/AndroidRuntime(1961): Process: com.AbdellahASKI.SoundQuiz, PID: 1961\n10-30 06:11:14.619: E/AndroidRuntime(1961): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.AbdellahASKI.SoundQuiz/com.AbdellahASKI.SoundQuiz.SplashActivity}: android.view.InflateException: Binary XML file line #9: Error inflating class android.widget.ImageView\n10-30 06:11:14.619: E/AndroidRuntime(1961): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2325)\n10-30 06:11:14.619: E/AndroidRuntime(1961): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)\n10-30 06:11:14.619: E/AndroidRuntime(1961): at android.app.ActivityThread.access$800(ActivityThread.java:151)\n10-30 06:11:14.619: E/AndroidRuntime(1961): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)\n10-30 06:11:14.619: E/AndroidRuntime(1961): at android.os.Handler.dispatchMessage(Handler.java:102)\n10-30 06:11:14.619: E/AndroidRuntime(1961): at android.os.Looper.loop(Looper.java:135)\n10-30 06:11:14.619: E/AndroidRuntime(1961): at android.app.ActivityThread.main(ActivityThread.java:5254)\n10-30 06:11:14.619: E/AndroidRuntime(1961): at java.lang.reflect.Method.invoke(Native Method)\n10-30 06:11:14.619: E/AndroidRuntime(1961): at java.lang.reflect.Method.invoke(Method.java:372)\n10-30 06:11:14.619: E/AndroidRuntime(1961): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)\n10-30 06:11:14.619: E/AndroidRuntime(1961): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)\n10-30 06:11:14.619: E/AndroidRuntime(1961): Caused by: android.view.InflateException: Binary XML file line #9: Error inflating class android.widget.ImageView\n10-30 06:11:14.619: E/AndroidRuntime(1961): at android.view.LayoutInflater.createView(LayoutInflater.java:633)\n10-30 06:11:14.619: E/AndroidRuntime(1961): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:55)\n10-30 06:11:14.619: E/AndroidRuntime(1961): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:682)\n10-30 06:11:14.619: E/AndroidRuntime(1961): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:741)\n10-30 06:11:14.619: E/AndroidRuntime(1961): at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)\n10-30 06:11:14.619: E/AndroidRuntime(1961): at android.view.LayoutInflater.inflate(LayoutInflater.java:504)\n10-30 06:11:14.619: E/AndroidRuntime(1961): at android.view.LayoutInflater.inflate(LayoutInflater.java:414)\n10-30 06:11:14.619: E/AndroidRuntime(1961): at android.view.LayoutInflater.inflate(LayoutInflater.java:365)\n10-30 06:11:14.619: E/AndroidRuntime(1961): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:378)\n10-30 06:11:14.619: E/AndroidRuntime(1961): at android.app.Activity.setContentView(Activity.java:2145)\n10-30 06:11:14.619: E/AndroidRuntime(1961): at com.AbdellahASKI.SoundQuiz.SplashActivity.onCreate(SplashActivity.java:20)\n10-30 06:11:14.619: E/AndroidRuntime(1961): at android.app.Activity.performCreate(Activity.java:5990)\n10-30 06:11:14.619: E/AndroidRuntime(1961): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)\n10-30 06:11:14.619: E/AndroidRuntime(1961): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)\n10-30 06:11:14.619: E/AndroidRuntime(1961): ... 10 more\n10-30 06:11:14.619: E/AndroidRuntime(1961): Caused by: java.lang.reflect.InvocationTargetException\n10-30 06:11:14.619: E/AndroidRuntime(1961): at java.lang.reflect.Constructor.newInstance(Native Method)\n10-30 06:11:14.619: E/AndroidRuntime(1961): at java.lang.reflect.Constructor.newInstance(Constructor.java:288)\n10-30 06:11:14.619: E/AndroidRuntime(1961): at android.view.LayoutInflater.createView(LayoutInflater.java:607)\n10-30 06:11:14.619: E/AndroidRuntime(1961): ... 23 more\n10-30 06:11:14.619: E/AndroidRuntime(1961): Caused by: java.lang.OutOfMemoryError: Failed to allocate a 485258948 byte allocation with 15447336 free bytes and 73MB until OOM\n10-30 06:11:14.619: E/AndroidRuntime(1961): at dalvik.system.VMRuntime.newNonMovableArray(Native Method)\n10-30 06:11:14.619: E/AndroidRuntime(1961): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)\n10-30 06:11:14.619: E/AndroidRuntime(1961): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:609)\n10-30 06:11:14.619: E/AndroidRuntime(1961): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:444)\n10-30 06:11:14.619: E/AndroidRuntime(1961): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:988)\n10-30 06:11:14.619: E/AndroidRuntime(1961): at android.content.res.Resources.loadDrawableForCookie(Resources.java:2474)\n10-30 06:11:14.619: E/AndroidRuntime(1961): at android.content.res.Resources.loadDrawable(Resources.java:2381)\n10-30 06:11:14.619: E/AndroidRuntime(1961): at android.content.res.TypedArray.getDrawable(TypedArray.java:749)\n10-30 06:11:14.619: E/AndroidRuntime(1961): at android.widget.ImageView.\u0026lt;init\u0026gt;(ImageView.java:146)\n10-30 06:11:14.619: E/AndroidRuntime(1961): at android.widget.ImageView.\u0026lt;init\u0026gt;(ImageView.java:135)\n10-30 06:11:14.619: E/AndroidRuntime(1961): at android.widget.ImageView.\u0026lt;init\u0026gt;(ImageView.java:131)\n10-30 06:11:14.619: E/AndroidRuntime(1961): ... 26 more\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThanks guys for the help but when i optimized the Image and I tried to run the app I get another error on the console (the last line is red):\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e[2015-10-30 13:50:45 - SoundQuiz] Dx Uncaught translation error: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: GC overhead limit exceeded \n[2015-10-30 13:50:45 - SoundQuiz] Dx 1 error; aborting \n[2015-10-30 13:50:45 - SoundQuiz] Conversion to Dalvik format failed with error 1\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"2","comment_count":"6","creation_date":"2015-10-29 23:27:23.5 UTC","favorite_count":"1","last_activity_date":"2015-10-30 20:20:54.213 UTC","last_edit_date":"2015-10-30 20:20:54.213 UTC","last_editor_display_name":"","last_editor_user_id":"5063276","owner_display_name":"","owner_user_id":"5063276","post_type_id":"1","score":"0","tags":"java|android|xml|eclipse","view_count":"697"} {"id":"42142610","title":"How to save mongoose data after PATCH?","body":"\u003cp\u003eMy Feathers.js app has a questionnaire and I'm trying to save the results for each input. Here is my client-side code:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e$.ajax({\n url: \"/answer\",\n type: \"PATCH\",\n data: newAnswer,\n success: function () {\n console.log(\"Answer submitted!\");\n },\n error: function () {\n console.log(\"Error submitting answer.\");\n }\n});\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAnd here is my server-side code:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eapp.patch(\"/answer\", (req, res) =\u0026gt; {\n users.patch(user[0]._id, req.body);\n});\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eCurrently, only the last input is saved. What am I doing wrong?\u003c/p\u003e\n\n\u003cp\u003eEDIT: Here is my schema\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eanswers: {\n yourOrganization: {\n page1: {\n idOfParameterInClient: response\n }\n }\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe \u003ccode\u003eidOfParameterInClient\u003c/code\u003e and the \u003ccode\u003eresponse\u003c/code\u003e are dynamic. In \u003ccode\u003epage1\u003c/code\u003e, there are a number of key/value pairs. How do I keep them?\u003c/p\u003e","accepted_answer_id":"42146550","answer_count":"2","comment_count":"2","creation_date":"2017-02-09 17:01:41.893 UTC","last_activity_date":"2017-02-09 22:38:08.15 UTC","last_edit_date":"2017-02-09 17:53:45.1 UTC","last_editor_display_name":"","last_editor_user_id":"1167646","owner_display_name":"","owner_user_id":"1167646","post_type_id":"1","score":"0","tags":"mongodb|express|mongoose|feathersjs","view_count":"95"} {"id":"26166349","title":"Implementing Swift's NSObjectProtocol's hash generates warnings in Objective-C","body":"\u003cp\u003eThe Swift protocol \u003ccode\u003eNSObjectProtocol\u003c/code\u003e defines \u003ccode\u003ehash\u003c/code\u003e as a property returning an \u003ccode\u003eInt\u003c/code\u003e. The Objective-C protocol \u003ccode\u003eNSObject\u003c/code\u003e defines \u003ccode\u003ehash\u003c/code\u003e as a property of type \u003ccode\u003eNSUInteger\u003c/code\u003e.\u003c/p\u003e\n\n\u003cp\u003eSince \u003ccode\u003eNSUInteger\u003c/code\u003e is an unsigned integer, and \u003ccode\u003eInt\u003c/code\u003e is a signed integer, these types are not compatible. As a result, the generated Objective-C header for any Swift object conforming to \u003ccode\u003eNSObjectProtocol\u003c/code\u003e generates warnings of the form: \u003c/p\u003e\n\n\u003cblockquote\u003e\n \u003cp\u003e\"Property type 'NSInteger\" (aka 'int') is incompatible with type 'NSUInteger' (aka 'unsigned int') inherited from 'NSObject'.\u003c/p\u003e\n\u003c/blockquote\u003e\n\n\u003cp\u003eIs there a way to define a Swift object so that it does not produce these warnings? (As goes without saying, I do not want to manually tweak the generated headers with pragmas.)\u003c/p\u003e\n\n\u003cp\u003eSeparately, is hash even required? API documentation says it's available up to iOS7.1, but it's not marked as optional, so I'm confused.\u003c/p\u003e","answer_count":"0","comment_count":"2","creation_date":"2014-10-02 17:37:30.303 UTC","last_activity_date":"2014-10-02 20:38:25.25 UTC","last_edit_date":"2014-10-02 20:38:25.25 UTC","last_editor_display_name":"","last_editor_user_id":"577888","owner_display_name":"","owner_user_id":"577888","post_type_id":"1","score":"1","tags":"objective-c|swift","view_count":"185"} -{"id":"41274757","title":"Why is my Git pre-commit hook not running in GitKraken","body":"\u003cp\u003eI'm trying to enforce Git Flow on a Git repository. I used the following hook to try to prevent commits to the \u003ccode\u003emaster\u003c/code\u003e and \u003ccode\u003edevelop\u003c/code\u003e branches. Contents of \u003ccode\u003e.git/hooks/pre-commit\u003c/code\u003e:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e#!/bin/bash\nif test $(git rev-parse --abbrev-ref HEAD) = \"master\" ; then \n echo \"Cannot commit on master\"\n exit 1\nfi\nif test $(git rev-parse --abbrev-ref HEAD) = \"develop\" ; then \n echo \"Cannot commit on develop\"\n exit 1\nfi\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhen I test commits to these branches in GitKraken the commits are allowed. I made the Git was on the path and that the file showed as executable.\u003c/p\u003e","accepted_answer_id":"41274792","answer_count":"2","comment_count":"0","creation_date":"2016-12-22 02:04:24.45 UTC","favorite_count":"1","last_activity_date":"2017-04-05 00:07:35.907 UTC","last_edit_date":"2016-12-22 02:11:05.833 UTC","last_editor_display_name":"","last_editor_user_id":"7328235","owner_display_name":"","owner_user_id":"7328235","post_type_id":"1","score":"3","tags":"git|gitkraken","view_count":"1003"} +{"id":"41274757","title":"Why is my Git pre-commit hook not running in GitKraken","body":"\u003cp\u003eI'm trying to enforce Git Flow on a Git repository. I used the following hook to try to prevent commits to the \u003ccode\u003emaster\u003c/code\u003e and \u003ccode\u003edevelop\u003c/code\u003e branches. Contents of \u003ccode\u003e.git/hooks/pre-commit\u003c/code\u003e:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e#!/bin/bash\nif test $(git rev-parse --abbrev-ref HEAD) = \"main\" ; then \n echo \"Cannot commit on main\"\n exit 1\nfi\nif test $(git rev-parse --abbrev-ref HEAD) = \"develop\" ; then \n echo \"Cannot commit on develop\"\n exit 1\nfi\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhen I test commits to these branches in GitKraken the commits are allowed. I made the Git was on the path and that the file showed as executable.\u003c/p\u003e","accepted_answer_id":"41274792","answer_count":"2","comment_count":"0","creation_date":"2016-12-22 02:04:24.45 UTC","favorite_count":"1","last_activity_date":"2017-04-05 00:07:35.907 UTC","last_edit_date":"2016-12-22 02:11:05.833 UTC","last_editor_display_name":"","last_editor_user_id":"7328235","owner_display_name":"","owner_user_id":"7328235","post_type_id":"1","score":"3","tags":"git|gitkraken","view_count":"1003"} {"id":"38022254","title":"Webpack modulesDirectories config","body":"\u003cp\u003eI am trying to configure modulesDirectories so that \u003c/p\u003e\n\n\u003cp\u003e\u003ccode\u003e@import \"~react-toolbox/lib/commons\";\u003c/code\u003e\u003c/p\u003e\n\n\u003cp\u003eworks.\u003c/p\u003e\n\n\u003cp\u003eThis is what I have right no for resolve.modulesDirectories:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e resolve: {\n extensions: ['', '.css', '.scss', '.js', '.json'],\n modulesDirectories: [\n 'node_modules'\n ]\n },\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI am presently getting this error:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eERROR in ./~/css-loader!./~/sass-loader!./src/components/course/style.scss\nModule build failed: File to import not found or unreadable: ~react-toolbox/lib/commons\nParent style sheet: stdin (1:1)\n @ ./src/components/course/style.scss 4:14-128 13:2-17:4 14:20-134\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhat am I doing wrong?\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2016-06-24 21:18:01.623 UTC","last_activity_date":"2016-06-25 04:47:31.417 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"5252715","post_type_id":"1","score":"0","tags":"webpack","view_count":"452"} {"id":"17048017","title":"StorageFile WriteAsync opperation is too slow on large files (WinRT)","body":"\u003cp\u003eI've found a strange behaviour of a StorageFile WriteAsync opperation. When I create large file (aprox 4gb) and then try to write at the end of this file Write Async operation takes very long time. Looks like it fills the gap between begin and write positions. Anyway Proccess Manager shows high disk usage. Is it WinRT problem or am I doing something wrong? How to fix it? \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e const long FILE_SIZE = 4294967296;\n var folderPicker = new FolderPicker();\n folderPicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;\n folderPicker.FileTypeFilter.Add(\"*\");\n var folder = await folderPicker.PickSingleFolderAsync();\n\n var file = await folder.CreateFileAsync(\"1.iso\", CreationCollisionOption.ReplaceExisting);\n using (var stream = await file.OpenAsync(FileAccessMode.ReadWrite))\n {\n stream.Size = FILE_SIZE; // size 4 Gb\n\n var buffer = new byte[1]; // create one byte buffer\n buffer[0] = 0xFF;\n\n stream.Seek(FILE_SIZE - 10); // seek almost at the and position\n await stream.WriteAsync(buffer.AsBuffer()).AsTask(); // write operation takes a lot of time\n\n await stream.FlushAsync();\n }\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"0","comment_count":"4","creation_date":"2013-06-11 15:29:07.16 UTC","last_activity_date":"2013-06-11 15:29:07.16 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"986772","post_type_id":"1","score":"0","tags":"windows-runtime|winrt-async","view_count":"391"} {"id":"2954922","title":"Binding DataTable To GridView, But No Rows In GridViewRowCollection Despite GridView Population?","body":"\u003cp\u003eProblem: I've coded a GridView in the markup in a page. I have coded a DataTable in the code-behind that takes data from a collection of custom objects. I then bind that DataTable to the GridView. (Specific problem mentioned a couple code-snippets below.)\u003c/p\u003e\n\n\u003cp\u003eGridView Markup:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;asp:GridView ID=\"gvCart\" runat=\"server\" CssClass=\"pList\" AutoGenerateColumns=\"false\" DataKeyNames=\"ProductID\"\u0026gt;\n \u0026lt;Columns\u0026gt;\n \u0026lt;asp:BoundField DataField=\"ProductID\" HeaderText=\"ProductID\" /\u0026gt;\n \u0026lt;asp:BoundField DataField=\"Name\" HeaderText=\"ProductName\" /\u0026gt;\n \u0026lt;asp:ImageField DataImageUrlField=\"Thumbnail\" HeaderText=\"Thumbnail\"\u0026gt;\u0026lt;/asp:ImageField\u0026gt;\n \u0026lt;asp:BoundField DataField=\"Unit Price\" HeaderText=\"Unit Price\" /\u0026gt;\n \u0026lt;asp:TemplateField HeaderText=\"Quantity\"\u0026gt;\n \u0026lt;ItemTemplate\u0026gt;\n \u0026lt;asp:TextBox ID=\"Quantity\" runat=\"server\" Text=\"\u0026lt;%# Bind('Quantity') %\u0026gt;\" Width=\"25px\"\u0026gt;\u0026lt;/asp:TextBox\u0026gt;\n \u0026lt;/ItemTemplate\u0026gt;\n \u0026lt;/asp:TemplateField\u0026gt;\n \u0026lt;asp:BoundField DataField=\"Total Price\" HeaderText=\"Total Price\" /\u0026gt;\n \u0026lt;/Columns\u0026gt;\n \u0026lt;/asp:GridView\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eDataTable Code-Behind:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eprivate void View(List\u0026lt;OrderItem\u0026gt; cart)\n {\n DataSet ds = new DataSet();\n DataTable dt = ds.Tables.Add(\"Cart\");\n\n if (cart != null)\n {\n dt.Columns.Add(\"ProductID\");\n dt.Columns.Add(\"Name\");\n dt.Columns.Add(\"Thumbnail\");\n dt.Columns.Add(\"Unit Price\");\n dt.Columns.Add(\"Quantity\");\n dt.Columns.Add(\"Total Price\");\n\n foreach (OrderItem item in cart)\n {\n DataRow dr = dt.NewRow();\n\n dr[\"ProductID\"] = item.productId.ToString();\n dr[\"Name\"] = item.productName;\n dr[\"Thumbnail\"] = ResolveUrl(item.productThumbnail);\n dr[\"Unit Price\"] = \"$\" + item.productPrice.ToString();\n dr[\"Quantity\"] = item.productQuantity.ToString();\n dr[\"Total Price\"] = \"$\" + (item.productPrice * item.productQuantity).ToString();\n\n dt.Rows.Add(dr);\n }\n\n gvCart.DataSource = dt;\n gvCart.DataBind();\n gvCart.Width = 500;\n\n for (int counter = 0; counter \u0026lt; gvCart.Rows.Count; counter++)\n {\n gvCart.Rows[counter].Cells.Add(Common.createCell(\"\u0026lt;a href='cart.aspx?action=update\u0026amp;prodId=\" +\n gvCart.Rows[counter].Cells[0].Text + \"'\u0026gt;Update\u0026lt;/a\u0026gt;\u0026lt;br /\u0026gt;\u0026lt;a href='cart.aspx?action='action=remove\u0026amp;prodId=\" +\n gvCart.Rows[counter].Cells[0].Text + \"/\u0026gt;Remove\u0026lt;/a\u0026gt;\"));\n }\n }\n }\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eError occurs below in the foreach - \u003cstrong\u003ethe GridViewRowCollection is empty!\u003c/strong\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eprivate void Update(string prodId)\n {\n List\u0026lt;OrderItem\u0026gt; cart = (List\u0026lt;OrderItem\u0026gt;)Session[\"cart\"];\n int uQty = 0;\n\n foreach (GridViewRow gvr in gvCart.Rows)\n {\n if (gvr.RowType == DataControlRowType.DataRow)\n {\n if (gvr.Cells[0].Text == prodId)\n {\n uQty = int.Parse(((TextBox)gvr.Cells[4].FindControl(\"Quantity\")).Text);\n }\n }\n }\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eGoal: I'm basically trying to find a way to update the data in my GridView (and more importantly my cart Session object) without having to do everything else I've seen online such as utilizing OnRowUpdate, etc. Could someone please tell me why gvCart.Rows is empty and/or how I could accomplish my goal without utilizing OnRowUpdate, etc.? When I execute this code, the GridView gets populated but for some reason I can't access any of its rows in the code-behind.\u003c/p\u003e","accepted_answer_id":"2968107","answer_count":"4","comment_count":"0","creation_date":"2010-06-02 04:00:04.497 UTC","favorite_count":"2","last_activity_date":"2012-11-17 16:13:03.76 UTC","last_edit_date":"2010-06-02 04:46:13.153 UTC","last_editor_display_name":"","last_editor_user_id":"319470","owner_display_name":"","owner_user_id":"319470","post_type_id":"1","score":"1","tags":"c#|asp.net|gridview|datatable","view_count":"25110"} @@ -3713,10 +3713,10 @@ {"id":"3046797","title":"Using EclipseLink","body":"\u003cp\u003eI am still new to Java and Eclipse and I'm trying to get my application to connect to a database. I think I want to use EclipseLink, but all of the documentation on the matter assumes you already know everything there is to know about everything.\u003c/p\u003e\n\n\u003cp\u003eI keep getting linked back to this tutorial: \u003ca href=\"http://www.vogella.de/articles/JavaPersistenceAPI/article.html\" rel=\"noreferrer\"\u003ehttp://www.vogella.de/articles/JavaPersistenceAPI/article.html\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eBut it's basically useless because it doesn't tell you HOW to do anything. For the Installation section, it tells you to download EclipseLink and gives you a link to the download page, but doesn't tell you what to do with it after you download. The download page doesn't either. I used the \"Install new software\" option in Eclipse to install EclipseLink into Eclipse, but it gave me like 4 different options, none of which are explained anywhere. It gave me options JPA, MOXy, SDO, etc, but I don't know which one I need. I just installed them all. Everything on the web assumes you are already a Java guru and things that are second nature to Java devs are never explained, so it's very frustrating for someone trying to learn.\u003c/p\u003e\n\n\u003cp\u003eSo how do I install and USE EclipseLink in my project and what do I need to do to connect it to a Microsoft SQL server? Again, I am new to all of this so I have no clue what to do. Thanks for the help.\u003c/p\u003e","accepted_answer_id":"3046986","answer_count":"3","comment_count":"0","creation_date":"2010-06-15 15:49:39.887 UTC","favorite_count":"4","last_activity_date":"2014-02-02 18:17:31.097 UTC","last_edit_date":"2010-06-16 09:48:48.217 UTC","last_editor_display_name":"","last_editor_user_id":"70604","owner_display_name":"","owner_user_id":"156588","post_type_id":"1","score":"11","tags":"java|jpa|eclipselink","view_count":"18116"} {"id":"37809594","title":"ASP.NET MVC - Html.Action returns List\u003cstring\u003e, how to show the list correctly in view?","body":"\u003cp\u003eThe view has already other ActionResult and a model, but in one part of the view I need some results and I use Html.Action which returns List.\u003c/p\u003e\n\n\u003cp\u003eIt can be compiled and the outputs are like:\u003c/p\u003e\n\n\u003cp\u003eSystem.Collections.Generic.List`1[System.String];\u003c/p\u003e\n\n\u003cp\u003eHow can I show correctly the value of the strings?\u003c/p\u003e","answer_count":"1","comment_count":"1","creation_date":"2016-06-14 10:36:35.66 UTC","last_activity_date":"2016-06-14 11:44:43.743 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"5618385","post_type_id":"1","score":"-3","tags":"asp.net|asp.net-mvc","view_count":"125"} {"id":"23749226","title":"NoneType Error: Python Doubly Linked List","body":"\u003cp\u003eGetting caught up in a solution to NoneType errors stemming from using my functions add and append in the below code to an empty Double_list class object. Best way to avoid?\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eclass Dbl_Node:\n\n def __init__(self, data):\n self.data = data\n self.next = None\n self.prev = None\n\nclass Double_list:\n\n def __init__(self): # Creates initial list w/ head and tail as None\n self.head = None\n self.tail = None\n\n def add(self, item): # adds node to beginning/head of list\n temp = self.head\n self.head = Dbl_Node(item)\n temp.prev = self.head\n self.head.next = temp\n\n def append(self, item): # adds node to end/tail of list\n temp = self.tail\n self.tail = Dbl_Node(item)\n self.tail.prev = temp\n temp.next = self.tail\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"2","comment_count":"3","creation_date":"2014-05-20 00:31:07.55 UTC","last_activity_date":"2014-05-20 02:38:36.887 UTC","last_edit_date":"2014-05-20 00:50:07.25 UTC","last_editor_display_name":"user849425","owner_display_name":"","owner_user_id":"3290553","post_type_id":"1","score":"0","tags":"python|linked-list|nonetype","view_count":"310"} -{"id":"21430559","title":"Confirm multiple emails with devise","body":"\u003cp\u003eI am using rails+devise. I want the user to be able to confirm multiple e-mails (the app would send for each address a mail with a \"confirm\" link, and then the user have one or many confirmed mails). It is possible to confirm one with :confirmable (doc :\n\u003ca href=\"http://rubydoc.info/github/plataformatec/devise/master/Devise/Models/Confirmable\" rel=\"nofollow\"\u003ehttp://rubydoc.info/github/plataformatec/devise/master/Devise/Models/Confirmable\u003c/a\u003e )\u003c/p\u003e\n\n\u003cp\u003eI thought that i could play with\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e- (Object) resend_confirmation_instructions\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eby changing the address but this is not the best solution.\nIs there a solution with devise or do i have to implement this specific functionnality?\u003c/p\u003e","accepted_answer_id":"21430729","answer_count":"1","comment_count":"0","creation_date":"2014-01-29 12:02:37.193 UTC","last_activity_date":"2014-01-29 12:10:15.697 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1348593","post_type_id":"1","score":"0","tags":"ruby-on-rails|devise|confirmation-email","view_count":"233"} +{"id":"21430559","title":"Confirm multiple emails with devise","body":"\u003cp\u003eI am using rails+devise. I want the user to be able to confirm multiple e-mails (the app would send for each address a mail with a \"confirm\" link, and then the user have one or many confirmed mails). It is possible to confirm one with :confirmable (doc :\n\u003ca href=\"http://rubydoc.info/github/plataformatec/devise/main/Devise/Models/Confirmable\" rel=\"nofollow\"\u003ehttp://rubydoc.info/github/plataformatec/devise/main/Devise/Models/Confirmable\u003c/a\u003e )\u003c/p\u003e\n\n\u003cp\u003eI thought that i could play with\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e- (Object) resend_confirmation_instructions\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eby changing the address but this is not the best solution.\nIs there a solution with devise or do i have to implement this specific functionnality?\u003c/p\u003e","accepted_answer_id":"21430729","answer_count":"1","comment_count":"0","creation_date":"2014-01-29 12:02:37.193 UTC","last_activity_date":"2014-01-29 12:10:15.697 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1348593","post_type_id":"1","score":"0","tags":"ruby-on-rails|devise|confirmation-email","view_count":"233"} {"id":"44676279","title":"Spring oauth2 only GET works","body":"\u003cp\u003eI have a working Spring oauth2 authorization server and resource server and they work great when it comes down to downloading information. For example a list of users. When I do a POST or a PUT request I get the following message:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eFull authentication is required to access this resource\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThis is my configuration:\u003c/p\u003e\n\n\u003cp\u003eMy authorization server has this configuration:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e@Override\npublic void configure(ClientDetailsServiceConfigurer clients) throws Exception {\n clients.inMemory().withClient(\"myClient\")\n .secret(\"mySecret\")\n .accessTokenValiditySeconds(expiration)\n .scopes(\"read\", \"write\")\n .authorizedGrantTypes(\"authorization_code\", \"refresh_token\", \"password\")\n .resourceIds(OAuth2ResourceServerConfig.RESOURCE_ID);\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eMy controller has this above each method:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e@PreAuthorize(\"isAuthenticated()\")\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eIt works with GET methods however none of the POST or PUT requests are authorized even though the configuration is the same for all methods.\u003c/p\u003e","answer_count":"0","comment_count":"0","creation_date":"2017-06-21 12:34:17.753 UTC","last_activity_date":"2017-06-21 12:34:17.753 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"4614579","post_type_id":"1","score":"0","tags":"spring|spring-security-oauth2","view_count":"9"} {"id":"5406507","title":"How to add a large file to a resource in c# project?","body":"\u003cp\u003eI was making a program that compiles a c# script to create an EXE application using Microsoft.CSharp.CSharpCodeProvider. In the process of making the EXE, it embeds a file programatically and the EXE reads that resource when it's executed on a later process. When I'm trying to add a large file and compiles it, the compiler throws an error like \"Unable to add resource. Insufficient memory\" or something like that. Is there any way to add a large file in a c# project resource?\u003c/p\u003e","answer_count":"1","comment_count":"1","creation_date":"2011-03-23 14:10:18.027 UTC","last_activity_date":"2011-03-23 14:49:20.843 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"673117","post_type_id":"1","score":"2","tags":"c#|embedded-resource","view_count":"851"} -{"id":"40303944","title":"Storm can't find jar class path in my own jar","body":"\u003cp\u003eWhile trying to learn how to use storm. I decided to compile my own instance of the well known WordCount Topology to see how it is done. The code is 100% identical to the example's one. (\u003ca href=\"https://github.com/apache/storm/blob/master/examples/storm-starter/src/jvm/org/apache/storm/starter/WordCountTopology.java\" rel=\"nofollow\"\u003ehttps://github.com/apache/storm/blob/master/examples/storm-starter/src/jvm/org/apache/storm/starter/WordCountTopology.java\u003c/a\u003e)\u003c/p\u003e\n\n\u003cp\u003eHowever whenever I try to run the jar I get the error saying I could not find or load the main class. I can run the default example jar that comes bundled with storm with no problems (like in bellow), so it shouldn't be a calling syntax problem. \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ebin/storm jar lib/\"name\".jar \"classpath\"\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eMaven creates the jar with no problem, initially I assumed I wasn't excluding the storm dependency properly in the pom file but It should be like this, right?\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;dependencies\u0026gt;\n \u0026lt;dependency\u0026gt;\n \u0026lt;groupId\u0026gt;org.apache.storm\u0026lt;/groupId\u0026gt;\n \u0026lt;artifactId\u0026gt;storm-core\u0026lt;/artifactId\u0026gt;\n \u0026lt;version\u0026gt;1.0.2\u0026lt;/version\u0026gt;\n \u0026lt;scope\u0026gt;provided\u0026lt;/scope\u0026gt;\n \u0026lt;/dependency\u0026gt;\n\u0026lt;/dependencies\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThis is perhaps is a vague question, but to be honest not sure where to tackle it since the code is the same, so generating a successful jar shouldn't be an issue, right?\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2016-10-28 11:18:41.787 UTC","last_activity_date":"2016-10-28 16:13:44.08 UTC","last_edit_date":"2016-10-28 11:32:52.33 UTC","last_editor_display_name":"","last_editor_user_id":"697110","owner_display_name":"","owner_user_id":"697110","post_type_id":"1","score":"0","tags":"maven|jar|apache-storm","view_count":"81"} +{"id":"40303944","title":"Storm can't find jar class path in my own jar","body":"\u003cp\u003eWhile trying to learn how to use storm. I decided to compile my own instance of the well known WordCount Topology to see how it is done. The code is 100% identical to the example's one. (\u003ca href=\"https://github.com/apache/storm/blob/main/examples/storm-starter/src/jvm/org/apache/storm/starter/WordCountTopology.java\" rel=\"nofollow\"\u003ehttps://github.com/apache/storm/blob/main/examples/storm-starter/src/jvm/org/apache/storm/starter/WordCountTopology.java\u003c/a\u003e)\u003c/p\u003e\n\n\u003cp\u003eHowever whenever I try to run the jar I get the error saying I could not find or load the main class. I can run the default example jar that comes bundled with storm with no problems (like in bellow), so it shouldn't be a calling syntax problem. \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ebin/storm jar lib/\"name\".jar \"classpath\"\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eMaven creates the jar with no problem, initially I assumed I wasn't excluding the storm dependency properly in the pom file but It should be like this, right?\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;dependencies\u0026gt;\n \u0026lt;dependency\u0026gt;\n \u0026lt;groupId\u0026gt;org.apache.storm\u0026lt;/groupId\u0026gt;\n \u0026lt;artifactId\u0026gt;storm-core\u0026lt;/artifactId\u0026gt;\n \u0026lt;version\u0026gt;1.0.2\u0026lt;/version\u0026gt;\n \u0026lt;scope\u0026gt;provided\u0026lt;/scope\u0026gt;\n \u0026lt;/dependency\u0026gt;\n\u0026lt;/dependencies\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThis is perhaps is a vague question, but to be honest not sure where to tackle it since the code is the same, so generating a successful jar shouldn't be an issue, right?\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2016-10-28 11:18:41.787 UTC","last_activity_date":"2016-10-28 16:13:44.08 UTC","last_edit_date":"2016-10-28 11:32:52.33 UTC","last_editor_display_name":"","last_editor_user_id":"697110","owner_display_name":"","owner_user_id":"697110","post_type_id":"1","score":"0","tags":"maven|jar|apache-storm","view_count":"81"} {"id":"1415356","title":"Flex spacing inside vbox, hbox","body":"\u003cp\u003echildren inside hbox and vbox have spacing between them,\u003c/p\u003e\n\n\u003cp\u003ehow do you remove this empty space?\u003c/p\u003e\n\n\u003cp\u003eI need to have 0 space between child elements of a hbox or vbox\u003c/p\u003e","accepted_answer_id":"1415371","answer_count":"2","comment_count":"0","creation_date":"2009-09-12 15:19:32.13 UTC","favorite_count":"1","last_activity_date":"2015-12-02 19:13:16.88 UTC","last_edit_date":"2015-12-02 19:13:16.88 UTC","last_editor_display_name":"","last_editor_user_id":"2577734","owner_display_name":"","owner_user_id":"112100","post_type_id":"1","score":"5","tags":"flex|layout|containers","view_count":"8788"} {"id":"43101808","title":"C# xml file creation adding same attribute both of child and parent nodes","body":"\u003cp\u003eI am using c# to create a xml file, however I got some problem.\nI would like to have both of parent and child nodes with a same attribute. But only one of those nodes has the attribute, even though I appended both of those.\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003ewhat I expected:\u003c/strong\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;request\u0026gt;\n \u0026lt;transaction transactionId:\"123\"\u0026gt;\n \u0026lt;transactionDetail transactionId:\"123\"\u0026gt;\u0026lt;/transactionDetail\u0026gt;\n \u0026lt;/transaction\u0026gt;\n\u0026lt;/request\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003cstrong\u003ewhat I got:\u003c/strong\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;request\u0026gt;\n \u0026lt;transaction\u0026gt;\n \u0026lt;transactionDetail transactionId:\"123\"\u0026gt;\u0026lt;/transactionDetail\u0026gt;\n \u0026lt;/transaction\u0026gt;\n\u0026lt;/request\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eor \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;request\u0026gt;\n \u0026lt;transaction transactionId:\"123\"\u0026gt;\n \u0026lt;transactionDetail\u0026gt;\u0026lt;/transactionDetail\u0026gt;\n \u0026lt;/transaction\u0026gt;\n\u0026lt;/request\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThis is depends on the order that I write code (The node I append later has attribute). Could you please help me out to find what's causing this problem?\u003c/p\u003e\n\n\u003cp\u003eAlso, I just wonder:\u003c/p\u003e\n\n\u003cp\u003eDoes the order of appending (both of .AppendChild() \u0026amp; .Append() ) matter?\u003c/p\u003e\n\n\u003cp\u003eCan't I reuse attributes which are already appended in other nodes?\u003c/p\u003e\n\n\u003cp\u003eThe following is the function to create xml file:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epublic ActionResult createXMLFile() {\n\n XmlDocument xmlFile = new XmlDocument();\n\n XmlNode request = xmlFile.CreateElement(\"request\");\n XmlNode transaction= xmlFile.CreateElement(\"transaction\");\n XmlNode transactionDetail= xmlFile.CreateElement(\"transactionDetail\");\n\n\n XmlAttribute transactionId= xmlFile.CreateAttribute(\"transactionId\");\n transactionId.Value = \"123\";\n\n transaction.Attributes.Append(transactionId);\n transactionDetail.Attributes.Append(transactionId);\n\n xmlFile.AppendChild(request);\n request.AppendChild(transaction);\n transaction.AppendChild(transactionDetail);\n\n string path =\"somepath\";\n\n xmlFile.Save(path);\n\n }\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThank you for reading my question. :)\u003c/p\u003e","accepted_answer_id":"43110864","answer_count":"1","comment_count":"3","creation_date":"2017-03-29 18:51:05.28 UTC","last_activity_date":"2017-03-30 07:09:23.037 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"7565718","post_type_id":"1","score":"0","tags":"c#|xml","view_count":"34"} {"id":"20460967","title":"ERROR: Schema \"x\" does not exist","body":"\u003cp\u003eI'm attempting to select the users from a 'users' table that have the most occurrences of their 'order_id' property in the 'shipments' table. This is what I've tried:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eSELECT users.first_name, users.email, shipments.count(order_id) \n FROM users, shipments\n WHERE shipments.order_id = users.current_order_id\n GROUP by shipments.order_id\n ORDER by shipments.count(order_id) DESC\n LIMIT 25\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eBut I'm getting an error of:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eERROR: schema \"shipments\" does not exist\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAny ideas?\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2013-12-09 00:11:34.4 UTC","last_activity_date":"2013-12-09 00:13:59.673 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"296435","post_type_id":"1","score":"2","tags":"sql|postgresql","view_count":"2996"} @@ -3831,7 +3831,7 @@ {"id":"37787749","title":"How to retrieve Date and Time from SOAP Response?","body":"\u003cp\u003eI am getting proper SOAP response from the endpoint, but how can I get the date and time from SOAP Response by when the service was hit?\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003esoapRequest = createSoapMessage(wsRequestString);\nsoapConnFactory = SOAPConnectionFactory.newInstance();\nsoapConnection = soapConnFactory.createConnection();\nURL endPoint = new URL(URL);\nsoapResponse = soapConnection.call(soapRequest, endPoint);\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"2","comment_count":"0","creation_date":"2016-06-13 10:46:36.637 UTC","last_activity_date":"2016-06-13 14:37:06.45 UTC","last_edit_date":"2016-06-13 10:48:18.037 UTC","last_editor_display_name":"","last_editor_user_id":"982149","owner_display_name":"","owner_user_id":"5972267","post_type_id":"1","score":"1","tags":"java|soap","view_count":"71"} {"id":"29364250","title":"angularJS: how to specify DOM elements (selectors)?","body":"\u003cp\u003eGenerally, the question is: \u003cstrong\u003ehow to use DOM selectors in AngularJS\u003c/strong\u003e?\u003c/p\u003e\n\n\u003cp\u003eMore deeply: what is the recommended way to specify a DOM element, where some action should be done? Let's say, I've got a plugin or a component that does some magical stuff (animations, executes a flow, embeds something, etc.) and \u003cstrong\u003eI need to decide where it will happen in the runtime\u003c/strong\u003e?\u003c/p\u003e\n\n\u003cp\u003eI'll compare it with Backbone. Angular is more declarative, whereas Backbone is imperative. In Backbone there is jQuery (or sth alternative), each Backbone.View has \u003ccode\u003eel.$\u003c/code\u003e, which is a jQuery selector engine that is bound not to global DOM, but to the View's sub-DOM tree. This is faster (no need to search elements globally), easier to maintain (won't find any DOM element outside the View) and convenient. I can pass the selector, such as \u003ccode\u003e#id\u003c/code\u003e or \u003ccode\u003e.class\u003c/code\u003e during runtime. And execute or open something manually, because \u003cstrong\u003eBackbone is imperative\u003c/strong\u003e.\u003c/p\u003e\n\n\u003cp\u003eNow how about angular? Let's say I want to start a big and complex user-interface process: it consists of few forms and few views, navigated forward step by step, and eventually finished with ending view (job successful or sth alike). When one view is finished, it is reloaded (overlay/spinner) and another is loaded. I want to embed it into a specified DOM element, but I would like to define it during runtime, not to embed it as angular attribute. How does that conform to \u003cem\u003eangular philosophy\u003c/em\u003e?\u003c/p\u003e","answer_count":"0","comment_count":"2","creation_date":"2015-03-31 08:42:46.623 UTC","last_activity_date":"2015-03-31 08:42:46.623 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"769384","post_type_id":"1","score":"0","tags":"javascript|angularjs|dom|jquery-selectors","view_count":"111"} {"id":"41755622","title":"Google Sheets / Count instances in only odd rows of an array","body":"\u003cp\u003eI've been going around and around on this one.\u003c/p\u003e\n\n\u003cp\u003eI have an array that consists of one type of thing (like a header) on the odd rows and then the data on the even rows. Here's a 4x4 cell example (which really contains 8 headers and 8 data elements):\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e A B C D\n +---------------------------------------------------\n1| *Red *Blue Blue Blue\n2| Robin Sparrow Oriole Blue Jay\n3| *Blue Blue-xx *Red Red\n4| Thrush Barred Owl Red Hawk Eagle \n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI'm looking for a way to count only the \u003c/p\u003e\n\n\u003cul\u003e\n\u003cli\u003eodd-row \"blues\" and \"reds\" (in two separate formulae)\u003c/li\u003e\n\u003cli\u003ethat do NOT have as asterisk\u003c/li\u003e\n\u003c/ul\u003e\n\n\u003cp\u003eIt needs to be NOT tripped up by:\u003c/p\u003e\n\n\u003cul\u003e\n\u003cli\u003eThe additional \"-xx\" in B3.\u003c/li\u003e\n\u003cli\u003eThe presence of the strings \"blue\" or \"red\" in non-header even cells (D2=\"BLUE jay\"; B4=\"barRED owl\"; C4=\"RED hawk\")\u003c/li\u003e\n\u003c/ul\u003e\n\n\u003cp\u003eAssume I already know through other methods that there were 5 blue and 3 red header values to begin with, all of which started with an asterisk. I would prefer for the solution to involve counting only those cells that have no asterisk, but because of the assumption I stated, it's ok for the solution to count only those that DO have an asterisk and then subtract.\u003c/p\u003e\n\n\u003cp\u003eThus the \"blue\" formula should report that there are 3 odd-row \"blues\" without asterisks (C1, D1, B3).\u003c/p\u003e\n\n\u003cp\u003eThe \"red\" formula should report that there are 2 odd-row \"reds\" without an asterisk (A1, C3).\u003c/p\u003e\n\n\u003cp\u003eCurrently, I have in place this ugly thing:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e=if({Five original blues})-(COUNTIF($A$1:$B$1,\"blue\")+countif($A$3:$B$3,\"blue\"))\u0026gt;0,{Five original blues}-(countif($A$1:$B$1,\"blue\")+countif($A$3:$B$3,\"blue\")),\"Zero\")\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eOr, parsing it out, if (5 - ((blues on line 1)+(blues on line 3)) is positive, then display that number. If it's not positive, write out the word zero.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e=if(\n {Five original blues}) - \n (COUNTIF($A$1:$B$1,\"blue\")+COUNTIF($A$3:$B$3,\"blue\"))\n \u0026gt;0\n ,\n {Five original blues} -\n (COUNTIF($A$1:$B$1,\"blue\")+COUNTIF($A$3:$B$3,\"blue\"))\n ,\n \"Zero\"\n )\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eOutput with this is three, as expected.\u003c/p\u003e\n\n\u003cp\u003eThis isn't a terrible solution for my 8 data points with two header rows, but I expect to have at least ten header rows and this does not scale very well.\u003c/p\u003e\n\n\u003cp\u003eI keep trying various things like\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e - (if(isodd(row(A1:B4)) . . . \n - countif(A1:B4,and(isodd(row(A1:B4)),find(\"blue\",A1:B4) ...\n - arrayformula ...?\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eBut haven't figured it out yet.\u003c/p\u003e\n\n\u003cp\u003eThanks in advance!\u003c/p\u003e","accepted_answer_id":"41816491","answer_count":"2","comment_count":"0","creation_date":"2017-01-20 03:30:21.503 UTC","last_activity_date":"2017-01-23 22:02:00.923 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"3040148","post_type_id":"1","score":"0","tags":"arrays|count|google-spreadsheet|row|instances","view_count":"50"} -{"id":"45878045","title":"Excel VBA set variable over multiple workbooks","body":"\u003cp\u003eI am working on a standard \"book 1, sheet1\" workbook, will rename when I am done.\u003c/p\u003e\n\n\u003cp\u003eI have a master workbook, the sheet in this workbook will have information typed up by the user. The information is 3 parts: a user ID, location of a picture, save location.\u003c/p\u003e\n\n\u003cp\u003ethis is the current codes i have that are working.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eSub Export_To_PDF()\n\nDim WBName, filepath, Filepth As String\nWBName = ActiveWorkbook.Name\n\nFilepth = Workbooks(\"Book1.xlsx\").Sheets(\"Sheet1\").Range(\"B4\").Value\n\nfilepath = Filepth \u0026amp; \"\\\" \u0026amp; WBName \u0026amp; \".pdf\"\n\nActiveSheet.ExportAsFixedFormat _\nType:=xlTypePDF, _\nFilename:=filepath, _\nQuality:=xlQualityMinimum, IncludeDocProperties:=True, _\nIgnorePrintAreas:=False, OpenAfterPublish:=False\n\nEnd Sub\n\nSub Macro1()\n\n\nSheets(\"Balancing Summary\").Select\nRange(\"E24\").Select\nActiveCell.FormulaR1C1 = \"A1111\"\nRange(\"E26\").Select\nActiveSheet.Pictures.Insert(\"C:\\Users\\a1111\\Music\\ThePicture.jpg\").Select\nChDir \"C:\\Users\\a1111\\Documents\\Done\"\n\nCall Export_To_PDF\n\nEnd Sub\n\nSub DoAll()\n\nWorkbooks(\"Book1.xlsx\").Activate\n\nDim wbkX As Workbook\nFor Each wbkX In Application.Workbooks\nwbkX.Activate \nCall Macro1\nNext wbkX\n\nEnd Sub\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe code takes the address typed in Cell B4 and saves the document there. i need the same to be done for the picture. the address for the picture will be typed in Book1, Sheet 1, B3. i need the below line to not have the address but refer to the specific cell in that book and sheet when the macro is run.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eActiveSheet.Pictures.Insert(\"C:\\Users\\a1111\\Music\\ThePicture.jpg\").Select\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ethere will be multiple workbooks and sheets open, so it has to specify the correct workbook and sheet.\u003c/p\u003e\n\n\u003cp\u003ei need it done similarly to the below line\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eFilepth = Workbooks(\"Book1.xlsx\").Sheets(\"Sheet1\").Range(\"B4\").Value\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"45883049","answer_count":"2","comment_count":"4","creation_date":"2017-08-25 09:09:31.037 UTC","favorite_count":"0","last_activity_date":"2017-08-25 13:57:28.007 UTC","last_edit_date":"2017-08-25 13:34:58.8 UTC","last_editor_display_name":"","last_editor_user_id":"1955214","owner_display_name":"","owner_user_id":"1955214","post_type_id":"1","score":"-1","tags":"excel-vba|variables","view_count":"38"} +{"id":"45878045","title":"Excel VBA set variable over multiple workbooks","body":"\u003cp\u003eI am working on a standard \"book 1, sheet1\" workbook, will rename when I am done.\u003c/p\u003e\n\n\u003cp\u003eI have a cluster manager workbook, the sheet in this workbook will have information typed up by the user. The information is 3 parts: a user ID, location of a picture, save location.\u003c/p\u003e\n\n\u003cp\u003ethis is the current codes i have that are working.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eSub Export_To_PDF()\n\nDim WBName, filepath, Filepth As String\nWBName = ActiveWorkbook.Name\n\nFilepth = Workbooks(\"Book1.xlsx\").Sheets(\"Sheet1\").Range(\"B4\").Value\n\nfilepath = Filepth \u0026amp; \"\\\" \u0026amp; WBName \u0026amp; \".pdf\"\n\nActiveSheet.ExportAsFixedFormat _\nType:=xlTypePDF, _\nFilename:=filepath, _\nQuality:=xlQualityMinimum, IncludeDocProperties:=True, _\nIgnorePrintAreas:=False, OpenAfterPublish:=False\n\nEnd Sub\n\nSub Macro1()\n\n\nSheets(\"Balancing Summary\").Select\nRange(\"E24\").Select\nActiveCell.FormulaR1C1 = \"A1111\"\nRange(\"E26\").Select\nActiveSheet.Pictures.Insert(\"C:\\Users\\a1111\\Music\\ThePicture.jpg\").Select\nChDir \"C:\\Users\\a1111\\Documents\\Done\"\n\nCall Export_To_PDF\n\nEnd Sub\n\nSub DoAll()\n\nWorkbooks(\"Book1.xlsx\").Activate\n\nDim wbkX As Workbook\nFor Each wbkX In Application.Workbooks\nwbkX.Activate \nCall Macro1\nNext wbkX\n\nEnd Sub\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe code takes the address typed in Cell B4 and saves the document there. i need the same to be done for the picture. the address for the picture will be typed in Book1, Sheet 1, B3. i need the below line to not have the address but refer to the specific cell in that book and sheet when the macro is run.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eActiveSheet.Pictures.Insert(\"C:\\Users\\a1111\\Music\\ThePicture.jpg\").Select\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ethere will be multiple workbooks and sheets open, so it has to specify the correct workbook and sheet.\u003c/p\u003e\n\n\u003cp\u003ei need it done similarly to the below line\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eFilepth = Workbooks(\"Book1.xlsx\").Sheets(\"Sheet1\").Range(\"B4\").Value\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"45883049","answer_count":"2","comment_count":"4","creation_date":"2017-08-25 09:09:31.037 UTC","favorite_count":"0","last_activity_date":"2017-08-25 13:57:28.007 UTC","last_edit_date":"2017-08-25 13:34:58.8 UTC","last_editor_display_name":"","last_editor_user_id":"1955214","owner_display_name":"","owner_user_id":"1955214","post_type_id":"1","score":"-1","tags":"excel-vba|variables","view_count":"38"} {"id":"6762251","title":"Trouble synchronously receiving messages from Queue in Websphere 6.1","body":"\u003cp\u003eI have trouble developing JMS application with Websphere 6.1.0.33 with EJB 3.0 FP.\u003c/p\u003e\n\n\u003cp\u003eApplication has two queues - RequestQueue and ResponseQueue. \nAn MDB is attached to RequestQueue to process messages via Session bean and to post responses in ResponseQueue.\nServlet is used as a testing client. It has two options - to send a request to RequestQueue and to synchronously receive response via MessageConsumer.receiveNoWait.\nThe problem is that receiveNoWait always return null - even if there are messages is queue (i can see 'em through AdminConsole). MessageConsumer.receive blocks forever.\nMoreover, if I attach MDB to listen to ResponseQueue, it will work ok and receive all the responses.\u003c/p\u003e\n\n\u003cp\u003eSIB is used as the messaging engine, there are two destinations linked to queues.\nFor each MDB there is an Activation Specification configured.\u003c/p\u003e\n\n\u003cp\u003eI double-checked all bindings and still can't see the problem.\u003c/p\u003e\n\n\u003cp\u003eSpecifying trace as in \u003ca href=\"http://www-01.ibm.com/support/docview.wss?uid=swg21199176\" rel=\"nofollow\"\u003ehttp://www-01.ibm.com/support/docview.wss?uid=swg21199176\u003c/a\u003e gives no useful data.\u003c/p\u003e\n\n\u003cp\u003eMaybe I left out some configuration component?\u003c/p\u003e","answer_count":"2","comment_count":"0","creation_date":"2011-07-20 12:53:59.82 UTC","last_activity_date":"2011-07-22 07:19:59.64 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"853937","post_type_id":"1","score":"0","tags":"java|jms|websphere","view_count":"379"} {"id":"40765819","title":"Linker errors when using Boost Unique pointer with Boost Bind and Boost Function","body":"\u003cp\u003eUsing Boost Bind with a Boost Unique Pointer and Boost Function I am receiving linker errors depending on how I pass a callback to the receiving function.\u003cbr\u003e\nIf I create a Boost Function member variable by binding a callback containing a boost unique pointer param and pass this onto the receiving function, this results in linker errors when attempting to use the unique pointer when the callback is invoked.\u003c/p\u003e\n\n\u003cp\u003eIf I perform the bind in place when calling the receiving function I do not get the linker errors and the code behaves as expected.\u003c/p\u003e\n\n\u003cp\u003eSample code:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eclass test\n{\npublic:\n test() : callback_(boost::bind(\u0026amp;test::callback, this, _1, _2))\n\n void start()\n {\n // using boost function pointer,\n // this fails with linker errors\n accept(callback_); // (Method 1)\n\n // using in place bind\n // this is OK\n accept(boost::bind(\u0026amp;test::callback, this, _1, _2)); // (Method 2)\n }\n\n void callback(BOOST_RV_REF(boost::movelib::unique_ptr\u0026lt;message\u0026gt;) message,\n int version)\n {\n // attempting to use message if implemented as (Method 1) will result in linker errors\n\n message-\u0026gt;get_body(); // If I comment out this line then both methods compile and link???\n }\n\n boost::function\n \u0026lt; void ( BOOST_RV_REF(boost::movelib::unique_ptr \u0026lt; message \u0026gt;) message,\n int version) \u0026gt; callback_;\n\n};\n\n\nclass callback_tester\n{\n callback_tester(){};\n\n void accept(boost::function\n \u0026lt; void ( BOOST_RV_REF(boost::movelib::unique_ptr \u0026lt; message \u0026gt;) message,\n int version) callback)\n {\n // Assignment to local member variable is fine here so we\n // can invoke the callback at a later stage.\n test_callback_ = callback; \n\n test_callback_(boost::move(message_), version_);\n }\n\n\n // define handler to store and invoke test callback\n boost::function\n \u0026lt; void ( BOOST_RV_REF(boost::movelib::unique_ptr \u0026lt; message \u0026gt;) message,\n int version) \u0026gt; test_callback_;\n boost::movelib::unique_ptr\u0026lt;message\u0026gt; message_;\n int version_;\n};\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eSome of the linker errors are as follows:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eError: symbol `_ZN5boost8functionIFvRKNS_6system10error_codeERNS_2rvINS_7movelib10unique_ptrIN5cayan3hal7network10tcp_socketENS6_14default_deleteISB_EEEEEEEED2Ev' is already defined\nError: symbol `_ZN5boost9function2IvRKNS_6system10error_codeERNS_2rvINS_7movelib10unique_ptrIN5cayan3hal7network10tcp_socketENS6_14default_deleteISB_EEEEEEED2Ev' is already defined\nError: symbol `_ZNSt15binary_functionIRKN5boost6system10error_codeERNS0_2rvINS0_7movelib10unique_ptrIN5cayan3hal7network10tcp_socketENS6_14default_deleteISB_EEEEEEvEC2Ev' is already defined\n...\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eCan anyone tell me what the difference in the two methods is and why the linker errors only appear when attempting to access the unique pointer when Method 1 is used?\u003c/p\u003e\n\n\u003cp\u003eI have come across some information that the callback should be CopyConstructible to use with boost::function. But if that is true I would have expected both methods to bind and pass a callback containing a unique pointer to fail.\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2016-11-23 13:27:38.167 UTC","last_activity_date":"2016-11-23 14:41:13.937 UTC","last_edit_date":"2016-11-23 14:26:07.36 UTC","last_editor_display_name":"","last_editor_user_id":"7199743","owner_display_name":"","owner_user_id":"7199743","post_type_id":"1","score":"0","tags":"c++|boost|unique-ptr|boost-bind|boost-function","view_count":"57"} {"id":"22015376","title":"How to port existing Windows Store Application to Windows8 Mobile App ?","body":"\u003cp\u003eWe have existing Windows Store application which is developed using C# and XAML. We want to port the same to Windows 8 Mobile application. Is there any Guidelines available for this ?\u003c/p\u003e","answer_count":"3","comment_count":"0","creation_date":"2014-02-25 13:16:15.907 UTC","last_activity_date":"2014-03-07 03:12:50.897 UTC","last_edit_date":"2014-03-07 03:12:50.897 UTC","last_editor_display_name":"","last_editor_user_id":"3330969","owner_display_name":"","owner_user_id":"3350042","post_type_id":"1","score":"0","tags":"c#|xaml|windows-phone-8|winrt-xaml","view_count":"126"} @@ -3959,8 +3959,8 @@ {"id":"42290665","title":"Check if .ISO is already mounted in powershell, if not then mount","body":"\u003cp\u003eI have an ISO file that I copied off of an old game disk. But in order for me to play the game, I have to mount the ISO. \nI wrote a small Batch file that runs the \u003ccode\u003e.ps1\u003c/code\u003e PowerShell file to mount the ISO and then runs the EXE to start the game after it has been mounted. My problem is, if I run the script more than once it will mount the ISO again. \u003c/p\u003e\n\n\u003cp\u003eI want to check if the ISO is attached, mount it if it is not, or run the EXE if it is.\u003c/p\u003e\n\n\u003cp\u003eHere's what I have to mount the ISO: \u003cbr/\u003e\nBatch.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eECHO \"Mounting Stunt Track Driver\"\n\n@ECHO off\n\nPowershell.exe -executionpolicy remotesigned \n-File \"C:\\Users\\Allen\\Documents\\Games\\Hot Wheels Stunt Track \nDriver\\setup\\hot98\\mount.ps1\"\n\nstart /d \"C:\\Users\\Allen\\Documents\\Games\\Hot Wheels Stunt Track \nDriver\\setup\\hot98\" stunt.exe\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ePowerShell\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e#mounts the image\nMount-DiskImage -ImagePath \"C:\\Users\\Allen\\Documents\\Games\\Hot Wheels Stunt \nTrack Driver\\setup\\hot98\\HotwheelsStuntTrack.iso\"\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"2","comment_count":"0","creation_date":"2017-02-17 06:14:45.48 UTC","last_activity_date":"2017-02-17 17:47:29.707 UTC","last_edit_date":"2017-02-17 17:47:29.707 UTC","last_editor_display_name":"","last_editor_user_id":"881229","owner_display_name":"","owner_user_id":"7578944","post_type_id":"1","score":"1","tags":"powershell|batch-file","view_count":"242"} {"id":"31928117","title":"CSS property so that the text inside \u003cdiv\u003e element does not extend outside of background of \u003cdiv\u003e","body":"\u003cp\u003eWhat can I add to CSS property so that the text inside the div element does not extend out of my background color? I'm guessing that because the actual width of the div element is width of full page, so I will have to shrink my div element.\u003c/p\u003e\n\n\u003cp\u003ePlease see example here\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"https://jsfiddle.net/u5128tv7/\" rel=\"nofollow\"\u003eexample\u003c/a\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;div class=\"test\"\u0026gt;sadfssdfjklsdfjklsdfsdfksdfkhsdfksdfkhsdfkhsdkhfsdhkfksdhkhsdfkhsdk\u0026lt;/div\u0026gt;\n\n.test {\nbackground: grey;\nwidth: 400px;\nheight: 100px;\n}\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"31928200","answer_count":"4","comment_count":"1","creation_date":"2015-08-10 20:01:20.07 UTC","favorite_count":"0","last_activity_date":"2015-08-10 20:22:20.777 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"4852194","post_type_id":"1","score":"4","tags":"css","view_count":"91"} {"id":"33471081","title":"How to know if user is logged with google or facebook using passport.js?","body":"\u003cp\u003eIt easy to find if user is logged in. But how can I check if user is logged with specific oauth client?. ex. Google or Facebook \u003c/p\u003e","accepted_answer_id":"33471118","answer_count":"1","comment_count":"0","creation_date":"2015-11-02 05:02:58.93 UTC","last_activity_date":"2015-11-02 05:07:16.7 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"5514464","post_type_id":"1","score":"1","tags":"passport.js|passport-facebook|passport-google-oauth","view_count":"130"} -{"id":"41941442","title":"D3js v4: scaleOrdinal does not have the rangePoints()","body":"\u003cp\u003eI'm migrating the parallel coordinates source code \u003ca href=\"https://bl.ocks.org/jasondavies/1341281\" rel=\"noreferrer\"\u003ehere\u003c/a\u003e to the newest d3js version (d3js 4.5.0). I'm stuck to this line:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003evar x = d3.scale.ordinal().rangePoints([0, width], 1) \n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eIt seems that in d3js v4 the \u003ccode\u003erangePoints\u003c/code\u003e function does not exist anymore. I can change to d3.\u003ca href=\"https://github.com/d3/d3-scale/blob/master/src/ordinal.js\" rel=\"noreferrer\"\u003escaleOrdinal\u003c/a\u003e(), but it has only the \u003ccode\u003erange\u003c/code\u003e function, not the \u003ccode\u003erangePoints\u003c/code\u003e function. Any clue on for this?\u003c/p\u003e","accepted_answer_id":"41945740","answer_count":"1","comment_count":"0","creation_date":"2017-01-30 17:03:17.557 UTC","favorite_count":"2","last_activity_date":"2017-01-31 02:45:13.433 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"5586341","post_type_id":"1","score":"7","tags":"d3.js","view_count":"2034"} -{"id":"32758327","title":"In AngularJS, Is there a global way to check if any $timeout is pending?","body":"\u003cp\u003eI am using Protractor to test my code written in AngularJS\u003c/p\u003e\n\n\u003cp\u003eProbably there is some $timeout running in my AngularJS code which is making Protractor wait too long until it times out and gives error. But I am not able to figure out where in my code I am doing a continuous timeout/polling. Might be some library I am using but not sure.\u003c/p\u003e\n\n\u003cp\u003eIs there a global way to check in Angular how many timeouts are pending overall?\u003c/p\u003e\n\n\u003cp\u003eI am getting this error:\u003c/p\u003e\n\n\u003cblockquote\u003e\n \u003cp\u003eUncaught exception: Timed out waiting for Protractor to synchronize\n with the page after 10 seconds. Please see\n \u003ca href=\"https://github.com/angular/protractor/blob/master/docs/faq.md\" rel=\"nofollow\"\u003ehttps://github.com/angular/protractor/blob/master/docs/faq.md\u003c/a\u003e\u003c/p\u003e\n\u003c/blockquote\u003e\n\n\u003cp\u003eI have also tried increasing default timeout of page load from 10secs to upto 60secs which is way more than enough for my page to load. But still no success.\u003c/p\u003e\n\n\u003cp\u003eThis also brings me to another question: What are the advantages of using $timeout over the normal setTimeout in javascript\u003c/p\u003e","answer_count":"0","comment_count":"2","creation_date":"2015-09-24 09:50:48.353 UTC","favorite_count":"1","last_activity_date":"2015-09-24 10:06:41.55 UTC","last_edit_date":"2015-09-24 10:06:41.55 UTC","last_editor_display_name":"","last_editor_user_id":"2279116","owner_display_name":"","owner_user_id":"2279116","post_type_id":"1","score":"1","tags":"javascript|angularjs|testing|timeout|protractor","view_count":"133"} +{"id":"41941442","title":"D3js v4: scaleOrdinal does not have the rangePoints()","body":"\u003cp\u003eI'm migrating the parallel coordinates source code \u003ca href=\"https://bl.ocks.org/jasondavies/1341281\" rel=\"noreferrer\"\u003ehere\u003c/a\u003e to the newest d3js version (d3js 4.5.0). I'm stuck to this line:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003evar x = d3.scale.ordinal().rangePoints([0, width], 1) \n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eIt seems that in d3js v4 the \u003ccode\u003erangePoints\u003c/code\u003e function does not exist anymore. I can change to d3.\u003ca href=\"https://github.com/d3/d3-scale/blob/main/src/ordinal.js\" rel=\"noreferrer\"\u003escaleOrdinal\u003c/a\u003e(), but it has only the \u003ccode\u003erange\u003c/code\u003e function, not the \u003ccode\u003erangePoints\u003c/code\u003e function. Any clue on for this?\u003c/p\u003e","accepted_answer_id":"41945740","answer_count":"1","comment_count":"0","creation_date":"2017-01-30 17:03:17.557 UTC","favorite_count":"2","last_activity_date":"2017-01-31 02:45:13.433 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"5586341","post_type_id":"1","score":"7","tags":"d3.js","view_count":"2034"} +{"id":"32758327","title":"In AngularJS, Is there a global way to check if any $timeout is pending?","body":"\u003cp\u003eI am using Protractor to test my code written in AngularJS\u003c/p\u003e\n\n\u003cp\u003eProbably there is some $timeout running in my AngularJS code which is making Protractor wait too long until it times out and gives error. But I am not able to figure out where in my code I am doing a continuous timeout/polling. Might be some library I am using but not sure.\u003c/p\u003e\n\n\u003cp\u003eIs there a global way to check in Angular how many timeouts are pending overall?\u003c/p\u003e\n\n\u003cp\u003eI am getting this error:\u003c/p\u003e\n\n\u003cblockquote\u003e\n \u003cp\u003eUncaught exception: Timed out waiting for Protractor to synchronize\n with the page after 10 seconds. Please see\n \u003ca href=\"https://github.com/angular/protractor/blob/main/docs/faq.md\" rel=\"nofollow\"\u003ehttps://github.com/angular/protractor/blob/main/docs/faq.md\u003c/a\u003e\u003c/p\u003e\n\u003c/blockquote\u003e\n\n\u003cp\u003eI have also tried increasing default timeout of page load from 10secs to upto 60secs which is way more than enough for my page to load. But still no success.\u003c/p\u003e\n\n\u003cp\u003eThis also brings me to another question: What are the advantages of using $timeout over the normal setTimeout in javascript\u003c/p\u003e","answer_count":"0","comment_count":"2","creation_date":"2015-09-24 09:50:48.353 UTC","favorite_count":"1","last_activity_date":"2015-09-24 10:06:41.55 UTC","last_edit_date":"2015-09-24 10:06:41.55 UTC","last_editor_display_name":"","last_editor_user_id":"2279116","owner_display_name":"","owner_user_id":"2279116","post_type_id":"1","score":"1","tags":"javascript|angularjs|testing|timeout|protractor","view_count":"133"} {"id":"5350410","title":"Silverlight RadGridView refresh","body":"\u003cp\u003eI'm deleting a user from my GridView, but when I delete it. I first need to refresh my page to see the result. \u003c/p\u003e\n\n\u003cp\u003eAnybody any idea?\u003c/p\u003e\n\n\u003cp\u003eThis is where I try to rebind the datasource\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eif (e.PropertyName == \"deleted\")\n {\n RadGridView1.ItemsSource = null;\n RadGridView1.DataContext = null;\n RadGridView1.DataContext = _viewModel;\n _viewModel.GetCovrUsers();\n\n\n RadGridView1.ItemsSource = _viewModel.CovrUsers;\n this._viewModel.PropertyChanged -= _viewModel_PropertyChanged;\n\n }\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"1","comment_count":"1","creation_date":"2011-03-18 10:03:20.523 UTC","last_activity_date":"2012-09-12 05:18:25.417 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"653589","post_type_id":"1","score":"1","tags":"silverlight|refresh|radgridview","view_count":"1721"} {"id":"25987935","title":"merge same array index according to key and build a new array","body":"\u003cp\u003eI am trying to merge array index such as\u003cbr\u003e\n011,021,031, 012,022,032, 013,023,033, 014,024,034 .\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e$temp = array();\nforeach($samplearray as $key =\u0026gt; $val){\n foreach($val as $key1 =\u0026gt; $val1){\n //what should logic here \n }\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003cstrong\u003esample array\u003c/strong\u003e \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e$samplearray = array ( \"AA\" =\u0026gt; array ( 0 =\u0026gt; array ( \"created by\" =\u0026gt; \"011\",\n \"date\" =\u0026gt; \"12-03-14\",\n \"time\" =\u0026gt; \"12.00 pm\"\n ),\n 1 =\u0026gt; array ( \"created by\" =\u0026gt; \"012\",\n \"date\" =\u0026gt; \"12-03-14\",\n \"time\" =\u0026gt; \"12.00 pm\"\n ),\n 2 =\u0026gt; array ( \"created by\" =\u0026gt; \"013\",\n \"date\" =\u0026gt; \"12-03-14\",\n \"time\" =\u0026gt; \"12.00 pm\"\n ),\n 3 =\u0026gt; array ( \"created by\" =\u0026gt; \"014\",\n \"date\" =\u0026gt; \"12-03-14\",\n \"time\" =\u0026gt; \"12.00 pm\"\n ) \n ),\n \"BB\" =\u0026gt; array ( 0 =\u0026gt; array ( \"created by\" =\u0026gt; \"021\",\n \"date\" =\u0026gt; \"12-03-14\",\n \"time\" =\u0026gt; \"12.00 pm\"\n ),\n 1 =\u0026gt; array ( \"created by\" =\u0026gt; \"022\",\n \"date\" =\u0026gt; \"12-03-14\",\n \"time\" =\u0026gt; \"12.00 pm\"\n ),\n 2 =\u0026gt; array ( \"created by\" =\u0026gt; \"023\",\n \"date\" =\u0026gt; \"12-03-14\",\n \"time\" =\u0026gt; \"12.00 pm\"\n ),\n 3 =\u0026gt; array ( \"created by\" =\u0026gt; \"024\",\n \"date\" =\u0026gt; \"12-03-14\",\n \"time\" =\u0026gt; \"12.00 pm\"\n ) \n ),\n \"CC\" =\u0026gt; array ( 0 =\u0026gt; array ( \"created by\" =\u0026gt; \"031\",\n \"date\" =\u0026gt; \"12-03-14\",\n \"time\" =\u0026gt; \"12.00 pm\"\n ),\n 1 =\u0026gt; array ( \"created by\" =\u0026gt; \"032\",\n \"date\" =\u0026gt; \"12-03-14\",\n \"time\" =\u0026gt; \"12.00 pm\"\n ),\n 2 =\u0026gt; array ( \"created by\" =\u0026gt; \"033\",\n \"date\" =\u0026gt; \"12-03-14\",\n \"time\" =\u0026gt; \"12.00 pm\"\n ),\n 3 =\u0026gt; array ( \"created by\" =\u0026gt; \"034\",\n \"date\" =\u0026gt; \"12-03-14\",\n \"time\" =\u0026gt; \"12.00 pm\"\n ) \n )\n );\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003cstrong\u003eRequired output\u003c/strong\u003e \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e$newArray = array ( 0 =\u0026gt; array ( \"created by\" =\u0026gt; \"011\",\n \"date\" =\u0026gt; \"12-03-14\",\n \"time\" =\u0026gt; \"12.00 pm\"\n ),\n 1 =\u0026gt; array ( \"created by\" =\u0026gt; \"021\",\n \"date\" =\u0026gt; \"12-03-14\",\n \"time\" =\u0026gt; \"12.00 pm\"\n ),\n 2 =\u0026gt; array ( \"created by\" =\u0026gt; \"031\",\n \"date\" =\u0026gt; \"12-03-14\",\n \"time\" =\u0026gt; \"12.00 pm\"\n ),\n 3 =\u0026gt; array ( \"created by\" =\u0026gt; \"012\",\n \"date\" =\u0026gt; \"12-03-14\",\n \"time\" =\u0026gt; \"12.00 pm\"\n ), \n 4 =\u0026gt; array ( \"created by\" =\u0026gt; \"022\",\n \"date\" =\u0026gt; \"12-03-14\",\n \"time\" =\u0026gt; \"12.00 pm\"\n ),\n 5 =\u0026gt; array ( \"created by\" =\u0026gt; \"032\",\n \"date\" =\u0026gt; \"12-03-14\",\n \"time\" =\u0026gt; \"12.00 pm\"\n ),\n 6 =\u0026gt; array ( \"created by\" =\u0026gt; \"013\",\n \"date\" =\u0026gt; \"12-03-14\",\n \"time\" =\u0026gt; \"12.00 pm\"\n ),\n 7 =\u0026gt; array ( \"created by\" =\u0026gt; \"023\",\n \"date\" =\u0026gt; \"12-03-14\",\n \"time\" =\u0026gt; \"12.00 pm\"\n ),\n 8 =\u0026gt; array ( \"created by\" =\u0026gt; \"033\",\n \"date\" =\u0026gt; \"12-03-14\",\n \"time\" =\u0026gt; \"12.00 pm\"\n ),\n 9 =\u0026gt; array ( \"created by\" =\u0026gt; \"014\",\n \"date\" =\u0026gt; \"12-03-14\",\n \"time\" =\u0026gt; \"12.00 pm\"\n ),\n 10 =\u0026gt; array ( \"created by\" =\u0026gt; \"024\",\n \"date\" =\u0026gt; \"12-03-14\",\n \"time\" =\u0026gt; \"12.00 pm\"\n ),\n 11 =\u0026gt; array ( \"created by\" =\u0026gt; \"034\",\n \"date\" =\u0026gt; \"12-03-14\",\n \"time\" =\u0026gt; \"12.00 pm\"\n ), \n );\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"25988044","answer_count":"2","comment_count":"0","creation_date":"2014-09-23 06:04:04.477 UTC","last_activity_date":"2014-09-23 06:41:50.503 UTC","last_edit_date":"2014-09-23 06:32:20.057 UTC","last_editor_display_name":"","last_editor_user_id":"1868277","owner_display_name":"","owner_user_id":"1868277","post_type_id":"1","score":"1","tags":"php|arrays|php-5.5","view_count":"54"} {"id":"7287060","title":"Sandboxing my App with Scripting Bridge to send email","body":"\u003cp\u003eI'm using a scripting bridge for sending mails from my Mac App. Now I need to sandbox the app and sending mails is not longer working while sandboxing is enabled.\u003c/p\u003e\n\n\u003cp\u003eDoes anybody know how to fix that?\u003c/p\u003e\n\n\u003cp\u003eThanks,\nAndreas\u003c/p\u003e\n\n\u003cp\u003eCode: \n` \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e/* create a Scripting Bridge object for talking to the Mail application */\n MailApplication *mail = [SBApplication applicationWithBundleIdentifier:@\"com.apple.Mail\"];\n\n\n/* create a new outgoing message object */\nMailOutgoingMessage *emailMessage =\n[[[mail classForScriptingClass:@\"outgoing message\"] alloc]\n initWithProperties:\n [NSDictionary dictionaryWithObjectsAndKeys:\n [self.subjectField stringValue], @\"subject\",\n [[self.messageContent textStorage] string], @\"content\",\n nil]];\n\n/* add the object to the mail app */\n[[mail outgoingMessages] addObject: emailMessage];\n...\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e`\u003c/p\u003e","answer_count":"4","comment_count":"1","creation_date":"2011-09-02 17:21:46.523 UTC","favorite_count":"1","last_activity_date":"2014-04-22 00:13:23.2 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"347741","post_type_id":"1","score":"5","tags":"objective-c|cocoa|sandbox","view_count":"1758"} @@ -4006,7 +4006,7 @@ {"id":"3753157","title":"Why can't I call `history` from within Ruby?","body":"\u003cp\u003eI can run Bash shell commands from with a Ruby program or irb using backticks (and %x(), system, etc). But that does not work with history for some reason.\u003c/p\u003e\n\n\u003cp\u003eFor example:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ejones$ irb --simple-prompt\n\u0026gt;\u0026gt; `whoami`\n=\u0026gt; \"jones\\n\"\n\u0026gt;\u0026gt; `history`\n(irb):2: command not found: history\n=\u0026gt; \"\"\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eFrom within a Ruby program it produces this error:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31: command not found: history\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eIn bash itself, those commands work fine\u003c/p\u003e\n\n\u003cp\u003eIt's not that the Ruby call is invoking a new shell - it simply does not find that command...\u003c/p\u003e\n\n\u003cp\u003eAnyone know why? I'm stumped...\u003c/p\u003e","accepted_answer_id":"3753305","answer_count":"3","comment_count":"0","creation_date":"2010-09-20 15:52:21.337 UTC","last_activity_date":"2010-09-20 16:08:20.733 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"290665","post_type_id":"1","score":"3","tags":"ruby|bash|history","view_count":"573"} {"id":"35633857","title":"Sql function that should error but instead creates successfully","body":"\u003cp\u003eI'm debugging a larger script and narrowed it down to the fact that a function is being created when it should error.\u003c/p\u003e\n\n\u003cp\u003eI tested the following function which SHOULD fail:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eCREATE FUNCTION ShouldFail( @x INT )\nRETURNS int\nAS\nBEGIN \nDECLARE @i INT\n\nSELECT @i = id FROM dbo.IDontExist\nRETURN @i\nEND\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eInstead the creation succeeds. Any ideas why?\u003c/p\u003e","accepted_answer_id":"35633971","answer_count":"1","comment_count":"0","creation_date":"2016-02-25 17:11:33.167 UTC","last_activity_date":"2016-02-25 17:16:58.187 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"2362927","post_type_id":"1","score":"0","tags":"sql|compiler-errors|syntax-error","view_count":"13"} {"id":"31685470","title":"autocomplete menu not visible in jqgrid in a Bootstrap tab","body":"\u003cp\u003eJQuery 2.1.1, Bootstrap 3.0.3 and JQGrid 4.8.2\u003c/p\u003e\n\n\u003cp\u003eI have a jqgrid that is included on a page that utilizes Bootstrap tabs. One of the columns uses autocomplete to provide options for inline editing. The function fires and retrieves the data but the autocomplete menu is not visible. If I run my code outside of the Bootstrap tab, the menu appears correctly. I've tried playing around with the z-index of ui-autocomplete and tab-pane but nothing has worked. Any suggestions?\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;style\u0026gt;\n.ui-autocomplete { font-size: 11px; position: absolute; cursor: default;z-index:1000 !important;}\n\u0026lt;/style\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHere is a snippet grid definition:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003evar myGrid = jQuery(\"#payments\").jqGrid({\n datatype: \"local\",\n data: myData,\n editurl: 'clientArray',\n onSelectRow: editRow,\n colModel: [\n { label: 'Payment ID', name: 'PaymentID', key: true, width: 75 },\n { label: 'Country', name: 'Country', \n width: 100 ,\n editable: true,\n edittype: \"text\",\n editoptions: {\n dataInit: function (element) {\n window.setTimeout(function () {\n $(element).autocomplete({\n id: 'AutoComplete',\n source: [\"United States of America\", \"Germany\", \"Sweden\", \"Greece\" ],\n minLength: 2,\n autoFocus: true\n });\n }, 100);\n }\n }\n },\n ....\n ],\n viewrecords: true,\n width: 1000,\n height: 250,\n subGrid: true, \n subGridRowExpanded: showChildGrid, \n pager: jQuery('#report_pager')\n });\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThis is a the tab that contains the grid:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e...\n\u0026lt;div class=\"tab-pane\" id=\"spendT\"\u0026gt;\n \u0026lt;div class=\"col-sm-12\"\u0026gt;\n \u0026lt;fieldset class=\"well the-fieldset\" \u0026gt;\n \u0026lt;legend class=\"the-legend\"\u0026gt;Spend\u0026lt;/legend\u0026gt;\n \u0026lt;br\u0026gt;\n \u0026lt;div class=\"report_Tbl\" id=\"report_Tbl\" style=\"text-align:left;padding:2px;\"\u0026gt;\n \u0026lt;div id=\"report_pager\" class=\"scroll\" style=\"text-align:left;\"\u0026gt; \u0026lt;/div\u0026gt;\n \u0026lt;table id=\"payments\" class=\"scroll\" \u0026gt;\u0026lt;/table\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;/fieldset\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;/div\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"0","comment_count":"3","creation_date":"2015-07-28 19:31:16.023 UTC","last_activity_date":"2015-07-28 19:31:16.023 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"2754423","post_type_id":"1","score":"0","tags":"jquery|css|twitter-bootstrap|jqgrid|jquery-autocomplete","view_count":"301"} -{"id":"15777824","title":"Can't set cookies in Laravel 4","body":"\u003cp\u003eI'm using the latest version of Laravel 4 and I can't set cookies:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eRoute::get('cookietest', function()\n{\n Cookie::forever('forever', 'Success');\n $forever = Cookie::get('forever');\n Cookie::make('temporary', 'Victory', 5);\n $temporary = Cookie::get('temporary');\n return View::make('cookietest', array('forever' =\u0026gt; $forever, 'temporary' =\u0026gt; $temporary, 'variableTest' =\u0026gt; 'works'));\n});\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eView script:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e@extends('layouts.master')\n\n@section('content')\n Forever cookie: {{ $forever }} \u0026lt;br /\u0026gt;\n Temporary cookie: {{ $temporary }} \u0026lt;br /\u0026gt;\n Variable test: {{ $variableTest }}\n@stop\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eYields:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eForever cookie: \nTemporary cookie: \nVariable test: works\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eIt doesn't matter if I refresh the page or create the cookies in one route and try to access them in another. I can confirm that no cookies are being set with the above operation. The cookies 'laravel_payload' and 'laravel_session' as well as 'remember_[HASH]' do exist and I can set cookies with regular PHP using setcookie.\u003c/p\u003e\n\n\u003cp\u003eNo errors are thrown or logged anywhere that I can find. I'm running Linux Mint locally and Debian on my server, both with nginx and I have the same problem in both places.\u003c/p\u003e","accepted_answer_id":"15807337","answer_count":"3","comment_count":"0","creation_date":"2013-04-03 02:23:36.167 UTC","favorite_count":"1","last_activity_date":"2014-10-27 09:18:26.517 UTC","last_edit_date":"2013-04-11 12:00:05.307 UTC","last_editor_display_name":"","last_editor_user_id":"1269513","owner_display_name":"","owner_user_id":"301168","post_type_id":"1","score":"5","tags":"cookies|laravel|laravel-4","view_count":"19456"} +{"id":"15777824","title":"Can't set cookies in Laravel 4","body":"\u003cp\u003eI'm using the latest version of Laravel 4 and I can't set cookies:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eRoute::get('cookietest', function()\n{\n Cookie::forever('forever', 'Success');\n $forever = Cookie::get('forever');\n Cookie::make('temporary', 'Victory', 5);\n $temporary = Cookie::get('temporary');\n return View::make('cookietest', array('forever' =\u0026gt; $forever, 'temporary' =\u0026gt; $temporary, 'variableTest' =\u0026gt; 'works'));\n});\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eView script:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e@extends('layouts.cluster_manager')\n\n@section('content')\n Forever cookie: {{ $forever }} \u0026lt;br /\u0026gt;\n Temporary cookie: {{ $temporary }} \u0026lt;br /\u0026gt;\n Variable test: {{ $variableTest }}\n@stop\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eYields:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eForever cookie: \nTemporary cookie: \nVariable test: works\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eIt doesn't matter if I refresh the page or create the cookies in one route and try to access them in another. I can confirm that no cookies are being set with the above operation. The cookies 'laravel_payload' and 'laravel_session' as well as 'remember_[HASH]' do exist and I can set cookies with regular PHP using setcookie.\u003c/p\u003e\n\n\u003cp\u003eNo errors are thrown or logged anywhere that I can find. I'm running Linux Mint locally and Debian on my server, both with nginx and I have the same problem in both places.\u003c/p\u003e","accepted_answer_id":"15807337","answer_count":"3","comment_count":"0","creation_date":"2013-04-03 02:23:36.167 UTC","favorite_count":"1","last_activity_date":"2014-10-27 09:18:26.517 UTC","last_edit_date":"2013-04-11 12:00:05.307 UTC","last_editor_display_name":"","last_editor_user_id":"1269513","owner_display_name":"","owner_user_id":"301168","post_type_id":"1","score":"5","tags":"cookies|laravel|laravel-4","view_count":"19456"} {"id":"26659457","title":"Spring ApplicationContext closed before bean invoked","body":"\u003cp\u003eIn my Spring app I noticed strange behavior of Spring (or Eclipse). It confused me. ApplicationContext surrounded with try/catch to be sure is closed after done in finally block. But in Eclipse console I saw that it closed before bean invoked.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epublic class Main {\n\n public static void main(String[] args) {\n\n ApplicationContext context = null;\n try {\n context = new ClassPathXmlApplicationContext(new String[] { \"beans-annot.xml\" });\n Launcher launcher = (Launcher) context.getBean(\"launcher\");\n\n System.out.println(launcher);\n launcher.invokeBean();\n } catch (BeansException e) {\n e.printStackTrace();\n } finally {\n if(context != null)\n ((AbstractApplicationContext) context).close();\n }\n }\n}\n\n@Component\npublic class Bean {\n public void invoke(){\n System.out.println(\"invoke bean\");\n }\n}\n@Component\npublic class Launcher {\n\n @Autowired\n public Bean bean;\n\n //setter\n\n public void invokeBean(){\n bean.invoke();\n }\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ebeans-annot.xml\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;?xml version=\"1.0\" encoding=\"UTF-8\"?\u0026gt;\n\n\u0026lt;beans xmlns=\"http://www.springframework.org/schema/beans\"\n xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:context=\"http://www.springframework.org/schema/context\"\n xmlns:aop=\"http://www.springframework.org/schema/aop\"\n xsi:schemaLocation=\"http://www.springframework.org/schema/beans\n http://www.springframework.org/schema/beans/spring-beans-3.0.xsd\n http://www.springframework.org/schema/aop\n http://www.springframework.org/schema/aop/spring-aop-3.0.xsd\n http://www.springframework.org/schema/context\n http://www.springframework.org/schema/context/spring-context-3.0.xsd\"\u0026gt;\n\n \u0026lt;context:component-scan base-package=\"my.ioc\" /\u0026gt;\n \u0026lt;context:annotation-config /\u0026gt;\n\n\u0026lt;/beans\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eIn Eclipse console output:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e[INFO] --- exec-maven-plugin:1.2.1:java (default-cli) @ IoC ---\nокт 30, 2014 8:52:56 PM org.springframework.context.support.ClassPathXmlApplicationContext prepareRefresh\nINFO: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@6e4e4adb: startup date [Thu Oct 30 20:52:56 FET 2014]; root of context hierarchy\nокт 30, 2014 8:52:56 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions\nINFO: Loading XML bean definitions from class path resource [beans-annot.xml]\nmy.ioc.Launcher@2b7f535d\nокт 30, 2014 8:52:56 PM org.springframework.context.support.ClassPathXmlApplicationContext doClose\nINFO: Closing org.springframework.context.support.ClassPathXmlApplicationContext@6e4e4adb: startup date [Thu Oct 30 20:52:56 FET 2014]; root of context hierarchy\ninvoke bean\n[INFO] ------------------------------------------------------------------------\n[INFO] BUILD SUCCESS\n[INFO] ------------------------------------------------------------------------\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAs you can see doClose method init before Bean, why? I think that it's Eclipse or maven plugin error... Project was build with exec-maven-plugin.\u003c/p\u003e","accepted_answer_id":"26664212","answer_count":"1","comment_count":"7","creation_date":"2014-10-30 17:23:06.413 UTC","last_activity_date":"2014-10-30 22:10:18.693 UTC","last_edit_date":"2014-10-30 18:51:02.787 UTC","last_editor_display_name":"","last_editor_user_id":"3157816","owner_display_name":"","owner_user_id":"3157816","post_type_id":"1","score":"0","tags":"java|eclipse|spring|maven","view_count":"1648"} {"id":"11693748","title":"java getRuntime().exec() not working?","body":"\u003cp\u003eBasically, when I type these commands in \nthe terminal by hand, the sift program works and writes a .key file, but when I try to call it from my program, nothing is written. \u003c/p\u003e\n\n\u003cp\u003eAm I using the exec() method correctly? I have looked through the API and I can't seem to spot where I went wrong.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epublic static void main(String[] args) throws IOException, InterruptedException\n{ \n //Task 1: create .key file for the input file\n String[] arr = new String[3];\n arr[0] = \"\\\"C:/Users/Wesley/Documents/cv/final project/ObjectRecognition/sift/siftWin32.exe\\\"\";\n arr[1] = \"\u0026lt;\\\"C:/Users/Wesley/Documents/cv/final project/ObjectRecognition/sift/cover_actual.pgm\\\"\";\n arr[2] = \"\u0026gt;\\\"C:/Users/Wesley/Documents/cv/final project/ObjectRecognition/sift/keys/cover_actual.key\\\"\";\n\n String command = (arr[0]+\" \"+arr[1]+\" \"+arr[2]);\n\n Process p=Runtime.getRuntime().exec(command); \n p.waitFor(); \n BufferedReader reader=new BufferedReader(new InputStreamReader(p.getInputStream())); \n String line=reader.readLine(); \n\n while(line!=null) \n { \n System.out.println(line); \n line=reader.readLine(); \n } \n}\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"11693878","answer_count":"5","comment_count":"3","creation_date":"2012-07-27 18:38:13.303 UTC","favorite_count":"1","last_activity_date":"2014-02-07 10:45:01.047 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1526984","post_type_id":"1","score":"1","tags":"java|runtime|exec","view_count":"9051"} {"id":"39713125","title":"Pre-Computing Nested Data Set MongoDB","body":"\u003cp\u003eI am implementing an application where I need to pre-compute some stats and using \u003ccode\u003eaggregation\u003c/code\u003e to show computed results through APIs. \u003c/p\u003e\n\n\u003cp\u003eI store all data set on unit day computation. Means for one day, I compute all stats and store those in one MongoDB document. So far linear structure of computing works. \u003c/p\u003e\n\n\u003cp\u003eNow I have following complex scenario where multiple inter-related items are encountered. Look at the sample data\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003edata = [\n {id: 1 , date: '29-08-2016', service: 'Good', text: 'R1', categories: ['10-20', 'Male', 'Speed', 'Service']},\n {id: 2 , date: '29-08-2016', service: 'Good', text: 'R2', categories: ['51+', 'Female', 'Strength', 'Service']},\n {id: 3 , date: '29-08-2016', service: 'Good', text: 'R3', categories: ['21-50', 'Male', 'Speed']},\n {id: 4 , date: '29-08-2016', service: 'Bad', text: 'R4', categories: ['10-20', 'Female', 'Flexibility']},\n {id: 5 , date: '29-08-2016', service: 'Bad', text: 'R5', categories: ['21-50', 'Female']}\n]\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eSo I compute linear information from above data set into a MongoDB document: \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e{\n date: '29-08-2016',\n total: 5, \n sub_total: {\n 'Good': 3,\n 'Bad': 2\n }\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eNow I need to pre-compute count of categories as well. As I do: \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e{\n date: '29-08-2016',\n total: 5, \n sub_total: {\n 'Good': 3,\n 'Bad': 2\n },\n categories: {\n '10-20': 2,\n '21-50': 1,\n '51+': 1,\n 'Male': 2,\n 'Female': 3,\n 'Service': 2,\n 'Speed': 2,\n 'Flexibility': 1,\n 'Strength': 1,\n }\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThis structure also work if I need to know individual category information. But it gets more complex when I have questions like this: \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eCount of Speed and Service for Female having age 10-20\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI can't figure out a json structure which can help to answer above questions and using mongodb aggregations. \u003c/p\u003e\n\n\u003cp\u003eAny suggestions. \u003c/p\u003e","answer_count":"0","comment_count":"1","creation_date":"2016-09-26 22:03:38.16 UTC","last_activity_date":"2017-07-23 02:06:30.437 UTC","last_edit_date":"2017-09-22 18:01:22.247 UTC","last_editor_display_name":"","last_editor_user_id":"-1","owner_display_name":"","owner_user_id":"534329","post_type_id":"1","score":"1","tags":"mongodb|database|nosql","view_count":"27"} @@ -4018,7 +4018,7 @@ {"id":"30976425","title":"How to filter through a table using ng-repeat checkboxes with Angularjs","body":"\u003cp\u003eOnce upon a time this was working but somehow it's broken. I want to be able to produce checkboxes using ng-repeat to get as many checkboxes as required based on stored data and use these to filter through a table produced. \u003c/p\u003e\n\n\u003cp\u003eAdditionally I don't want identical values for the checkboxes to be repeated.\u003c/p\u003e\n\n\u003cp\u003eI have made a plnkr with the code.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;div class=\"row\"\u0026gt;\n \u0026lt;label data-ng-repeat=\"x in projects\"\u0026gt;\n \u0026lt;input\n type=\"checkbox\"\n data-ng-true-value=\"{{x.b}}\"\n data-ng-false-value=''\n ng-model=\"quer[queryBy]\" /\u0026gt;\n {{x.b}}\n \u0026lt;/label\u0026gt;\n\u0026lt;/div\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003ca href=\"http://plnkr.co/edit/RBjSNweUskAtLUH3Ss6r?p=preview\" rel=\"nofollow\"\u003ehttp://plnkr.co/edit/RBjSNweUskAtLUH3Ss6r?p=preview\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eSo in summary.\u003c/p\u003e\n\n\u003col\u003e\n\u003cli\u003e\u003cp\u003eCheckboxes to filter \u003ccode\u003eRef\u003c/code\u003e.\u003c/p\u003e\u003c/li\u003e\n\u003cli\u003e\u003cp\u003eCheckboxes to be unique.\u003c/p\u003e\u003c/li\u003e\n\u003cli\u003e\u003cp\u003eCheckboxes to be made based off \u003ccode\u003eng-repeat\u003c/code\u003e using \u003ccode\u003eRef\u003c/code\u003e.\u003c/p\u003e\u003c/li\u003e\n\u003c/ol\u003e","accepted_answer_id":"30977408","answer_count":"2","comment_count":"0","creation_date":"2015-06-22 09:28:45.743 UTC","last_activity_date":"2015-06-23 13:43:39.143 UTC","last_edit_date":"2015-06-22 09:53:43.92 UTC","last_editor_display_name":"","last_editor_user_id":"2173016","owner_display_name":"","owner_user_id":"4572435","post_type_id":"1","score":"3","tags":"javascript|angularjs|checkbox|filter|angularjs-ng-repeat","view_count":"4343"} {"id":"6918989","title":"How to get the _locale variable inside in a Symfony layout?","body":"\u003cp\u003eI'm working with Symfony 2 on a site which having 2 languages,\nand I want to change patterns of my routes depending on user locale language !\u003c/p\u003e\n\n\u003cp\u003eExample:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003euser_login_en:\n pattern: /en/user/login.html\n defaults: { _controller: SfErrorsAppBundle:User:login, _locale: en }\n\nuser_login_fr:\n pattern: /fr/utilisateur/connexion.html\n defaults: { _controller: SfErrorsAppBundle:User:login, _locale: fr}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eInside a template, this is not difficult, i just have to pass the $this-\u003eget('session')-\u003egetLocale() from the controller to the template...\u003c/p\u003e\n\n\u003cp\u003eTo work, I have to call my routes:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e$router-\u0026gt;generate('user_login_'.$locale, array());\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eBut inside my layouts, I have of course a menu, and sidebars, which have links... So I want to get the locale variable to use it ! So my question is simple: how to get this variable inside a \"layout\" template ? Otherwise, have you got any idea to change the pattern depending on the language ?\u003c/p\u003e\n\n\u003cp\u003eThe reasons are that I want beautiful routes for all users, whether they're english or french... And also for a SEO reason !\u003c/p\u003e","accepted_answer_id":"7441612","answer_count":"4","comment_count":"0","creation_date":"2011-08-02 21:39:02.35 UTC","favorite_count":"6","last_activity_date":"2014-10-23 10:08:06.49 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"875519","post_type_id":"1","score":"48","tags":"templates|layout|routing|translation|symfony","view_count":"55052"} {"id":"16429301","title":"When is persistence.xml necessary for Play 2.1.1 Java? Entities don't persist in a many-to-one relationship","body":"\u003cp\u003eIn my program, I have a Task model with a \u003ccode\u003eallDates\u003c/code\u003e field, which is a collection of all the Dates that task occurs on. My goal is to make a calendar manager that allows users to input tasks that repeat on certain days.\u003c/p\u003e\n\n\u003cp\u003eIn Tasks, I defined a OneToMany relation between a task and its dates in \u003ca href=\"https://github.com/six5532one/calpractice2/blob/repeatingEvents/app/models/Task.java\" rel=\"nofollow noreferrer\"\u003eline 34\u003c/a\u003e. To treat the elements of \u003ccode\u003eallDates\u003c/code\u003e as an entity, I wrapped each date in a DateHelper model that is another Ebean entity.\u003c/p\u003e\n\n\u003cp\u003eRight before I save the Task, my console output indicates someTask.allDates.size() is accurate and a number greater than one. After I save the task, however:\u003c/p\u003e\n\n\u003cp\u003e1) I query DateHelpers in \u003ca href=\"https://github.com/six5532one/calpractice2/blob/repeatingEvents/app/models/Task.java\" rel=\"nofollow noreferrer\"\u003eline 194\u003c/a\u003e for all DateHelper instances for a given task, and the server only returns the first DateHelper that was added to someTask.allDates, rather than returning the same number of DateHelpers that was added to the task before I saved.\u003c/p\u003e\n\n\u003cp\u003e2) someTask.allDates.size() also returns 1, and the only element in allDates is the first DateHelper I added before saving the task.\u003c/p\u003e\n\n\u003cp\u003eI read \u003ca href=\"https://stackoverflow.com/questions/6257284/play-framework-jpa-how-to-implement-one-to-many-relationship\"\u003ehere\u003c/a\u003e and \u003ca href=\"http://www.playframework.com/documentation/2.1.1/JavaJPA\" rel=\"nofollow noreferrer\"\u003ehere\u003c/a\u003e that Play developers should modify a persistence.xml file to integrate with JPA. Do I need to do this if I am importing ebean? Also, my program successfully maps one User to many Tasks, so I am confused about why the OneToMany mapping does not work for one Task to many TaskHelpers.\u003c/p\u003e","answer_count":"0","comment_count":"0","creation_date":"2013-05-07 22:03:27.13 UTC","last_activity_date":"2013-05-07 22:07:39.947 UTC","last_edit_date":"2017-05-23 12:28:09.877 UTC","last_editor_display_name":"","last_editor_user_id":"-1","owner_display_name":"","owner_user_id":"1644251","post_type_id":"1","score":"1","tags":"java|playframework|playframework-2.1|persistence.xml","view_count":"213"} -{"id":"11545975","title":"can't see asp.net gridview on page load","body":"\u003cp\u003eI have a gridview that won't show on page load. The gridview is inside of some asp:Panels which are inside of an update panel. I stepped through the code, so I know the gridview has rows of data. If I move the gridview outside of the panels and update panels, then it will show up with data. Does anybody know why it doesn't work as it sits below, inside of the panels and update panels? \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e \u0026lt;%@ Page Language=\"VB\" AutoEventWireup=\"false\" EnableEventValidation=\"false\" MasterPageFile=\"~/CTPublic.master\" CodeFile=\"Tank.aspx.vb\" Inherits=\"CargoTank_Internal_Tank\" %\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;div style=\"padding-top:9px; width:100%; min-width:800px; \" \u0026gt;\n \u0026lt;asp:UpdatePanel ID=\"udpTank\" runat=\"server\" \u0026gt;\n \u0026lt;ContentTemplate\u0026gt;\n \u0026lt;ajaxToolkit:RoundedCornersExtender runat=\"server\" BorderColor=\"#3260a0\" Corners=\"All\" Radius=\"5\" Color=\"#98B9C9\" TargetControlID=\"pnlTank\" ID=\"ajRCEpnlTank\" \u0026gt;\u0026lt;/ajaxToolkit:RoundedCornersExtender\u0026gt;\n\n \u0026lt;asp:Panel runat=\"server\" BackColor=\"#ecece7\" Width=\"95%\" ID=\"pnlTank\" \u0026gt;\n\n \u0026lt;div \u0026gt;\n \u0026lt;div style=\"float:left; width:70%; background-color:#98B9C9; height:19px;\"\u0026gt;Tanks\u0026lt;/div\u0026gt;\n \u0026lt;div style=\"float:right; width:30%; height:19px;background-color:#98B9C9; text-align:right\"\u0026gt;\n \u0026lt;asp:Button ID=\"btnAddNewTank\" style=\"background:transparent; border:0px;\" runat=\"server\" Font-Underline=\"true\" size=\"1\" Font-Bold=true text=\"Add New\" /\u0026gt; \n\n \u0026lt;/div\u0026gt; \n \u0026lt;div style=\"padding-top:19px;\"\u0026gt;\u0026lt;/div\u0026gt;\n \u0026lt;/div\u0026gt; \n \u0026lt;div style=\"width:100%;\"\u0026gt;\n \u0026lt;table width=\"100%\"\u0026gt;\n \u0026lt;tr\u0026gt;\n \u0026lt;td colspan=\"6\" class=\"tdheaderbar\"\u0026gt;Search Tanks\n \u0026lt;/td\u0026gt;\n \u0026lt;/tr\u0026gt;\n \u0026lt;tr\u0026gt;\n \u0026lt;td\u0026gt;CT #\u0026lt;/td\u0026gt;\n \u0026lt;td\u0026gt;\u0026lt;asp:TextBox runat=\"server\" ID=\"txtCTNumber\" \u0026gt;\u0026lt;/asp:TextBox\u0026gt;\u0026lt;/td\u0026gt;\n \u0026lt;td\u0026gt;Serial #\u0026lt;/td\u0026gt;\n \u0026lt;td\u0026gt;\u0026lt;asp:TextBox runat=\"server\" ID=\"txtSerialNumber\" MaxLength=\"17\"\u0026gt;\u0026lt;/asp:TextBox\u0026gt;\u0026lt;/td\u0026gt;\n \u0026lt;td\u0026gt;City\u0026lt;/td\u0026gt;\n \u0026lt;td\u0026gt;\u0026lt;asp:TextBox runat=\"server\" ID=\"txtCity\"\u0026gt;\u0026lt;/asp:TextBox\u0026gt;\u0026lt;/td\u0026gt;\n\n \u0026lt;/tr\u0026gt;\n \u0026lt;tr\u0026gt;\n \u0026lt;td\u0026gt;Capacity\u0026lt;/td\u0026gt;\n \u0026lt;td\u0026gt;\u0026lt;asp:TextBox runat=\"server\" ID=\"txtCapacity\"\u0026gt;\u0026lt;/asp:TextBox\u0026gt;\u0026lt;/td\u0026gt;\n \u0026lt;td\u0026gt;Unit #\u0026lt;/td\u0026gt;\n \u0026lt;td\u0026gt;\u0026lt;asp:TextBox runat=\"server\" ID=\"txtUnitNumber\"\u0026gt;\u0026lt;/asp:TextBox\u0026gt;\u0026lt;/td\u0026gt;\n \u0026lt;td\u0026gt;License State\u0026lt;/td\u0026gt;\n \u0026lt;td\u0026gt;\u0026lt;asp:DropDownList EnableViewState=\"true\" runat=\"server\" ID=\"ddlState\" DataSourceID=\"linqStates\" \n Width=\"156px\" DataTextField=\"StateText\" DataValueField=\"StateID\"\u0026gt;\u0026lt;/asp:DropDownList\u0026gt;\n \u0026lt;asp:LinqDataSource ID=\"linqStates\" runat=\"server\" \n ContextTypeName=\"DataClassesDataContext\" TableName=\"States\"\u0026gt;\n \u0026lt;/asp:LinqDataSource\u0026gt;\n \u0026lt;/td\u0026gt;\n\n \u0026lt;/tr\u0026gt;\n \u0026lt;tr\u0026gt;\n \u0026lt;td\u0026gt;Tank Type\u0026lt;/td\u0026gt;\n \u0026lt;td\u0026gt;\n \u0026lt;asp:DropDownList runat=\"server\" ID=\"ddlTankType\" Width=\"156px\"\n \u0026gt;\u0026lt;/asp:DropDownList\u0026gt;\n\n \u0026lt;/td\u0026gt; \n \u0026lt;td\u0026gt;Compartment\u0026lt;/td\u0026gt;\n \u0026lt;td\u0026gt;\u0026lt;asp:TextBox runat=\"server\" ID=\"txtCompartment\"\u0026gt;\u0026lt;/asp:TextBox\u0026gt;\u0026lt;/td\u0026gt;\n \u0026lt;td\u0026gt;License #\u0026lt;/td\u0026gt;\n \u0026lt;td\u0026gt;\u0026lt;asp:TextBox runat=\"server\" ID=\"txtLicenseNumber\"\u0026gt;\u0026lt;/asp:TextBox\u0026gt;\u0026lt;/td\u0026gt;\n \u0026lt;/tr\u0026gt;\n \u0026lt;tr\u0026gt;\n \u0026lt;td\u0026gt;Manufacturer\u0026lt;/td\u0026gt;\n \u0026lt;td colspan=\"2\"\u0026gt;\n \u0026lt;asp:DropDownList runat=\"server\" ID=\"ddlManufacturer\" \n \u0026gt;\u0026lt;/asp:DropDownList\u0026gt;\n\n \u0026lt;/td\u0026gt; \n\n\n \u0026lt;td\u0026gt;\u0026lt;asp:CheckBox runat=\"server\" ID=\"chkNoLogIn\" Text=\"No Log In Associated\" /\u0026gt;\u0026lt;/td\u0026gt;\n \u0026lt;td\u0026gt;\u0026lt;/td\u0026gt; \u0026lt;td\u0026gt;\u0026lt;/td\u0026gt; \n \u0026lt;/tr\u0026gt;\n \u0026lt;tr\u0026gt;\u0026lt;td\u0026gt;Company\u0026lt;/td\u0026gt;\n \u0026lt;td colspan=\"5\"\u0026gt; \u0026lt;asp:DropDownList runat=\"server\" ID=\"ddlCompany\" \u0026gt;\u0026lt;/asp:DropDownList\u0026gt;\u0026lt;/td\u0026gt; \n \u0026lt;/tr\u0026gt; \n \u0026lt;tr\u0026gt;\n \u0026lt;td colspan=\"3\"\u0026gt;\n \u0026lt;/td\u0026gt;\n \u0026lt;td\u0026gt;\u0026lt;asp:Button runat=\"server\" ID=\"btnSearch\" Text=\"Search\" /\u0026gt;\u0026lt;/td\u0026gt;\n \u0026lt;/tr\u0026gt;\n \u0026lt;/table\u0026gt;\n \u0026lt;/div\u0026gt;\n\n \u0026lt;/asp:Panel\u0026gt;\n \u0026lt;/ContentTemplate\u0026gt;\n \u0026lt;Triggers\u0026gt;\n \u0026lt;asp:AsyncPostBackTrigger ControlID=\"btnSearch\" EventName=\"Click\" /\u0026gt;\n \u0026lt;/Triggers\u0026gt; \n \u0026lt;/asp:UpdatePanel\u0026gt;\n \u0026lt;br /\u0026gt;\n\n \u0026lt;div style=\"padding-top:9px; width:100%; \" id=\"divTankDetail\" runat=\"server\"\u0026gt;\n \u0026lt;asp:UpdatePanel ID=\"updTankDetail\" runat=\"server\" \u0026gt;\n \u0026lt;ContentTemplate\u0026gt;\n \u0026lt;ajaxToolkit:DropShadowExtender runat=\"server\" ID=\"dsetank\" TargetControlID=\"pnlTankDetail\" TrackPosition=\"true\" BehaviorID=\"pnlTankDetailHeader\"\u0026gt;\u0026lt;/ajaxToolkit:DropShadowExtender\u0026gt;\n \u0026lt;ajaxToolkit:DragPanelExtender runat=\"server\" ID=\"dpeTankDetail\" TargetControlID=\"pnlTankDetail\" DragHandleID=\"pnlTankDetailHeader\"\u0026gt;\u0026lt;/ajaxToolkit:DragPanelExtender\u0026gt;\n \u0026lt;asp:Panel CssClass=\"TankpopupPosition\" BackColor=\"LightBlue\" Visible=\"false\" runat=\"server\" BorderColor=\"#3260a0\" BorderWidth=\"2px\" Width=\"801px\" ID=\"pnlTankDetail\" \u0026gt;\n \u0026lt;asp:Panel runat=\"server\" BorderColor=\"#3260a0\" BorderWidth=\"1px\" Width=\"800px\" ID=\"pnlTankDetailHeader\"\u0026gt;\n \u0026lt;div \u0026gt;\n \u0026lt;div style=\"float:left; width:90%; background-color:#98B9C9; height:19px;\"\u0026gt;Tank Detail\u0026lt;/div\u0026gt;\n \u0026lt;div style=\"float:right; width:10%; border-right-width:2px; border-width:1px; border-color:#3260a0; height:19px;background-color:#98B9C9; text-align:right\"\u0026gt;\n \u0026lt;asp:Button ID=\"btnClose\" style=\"background:transparent; border:0px;\" runat=\"server\" size=\"1\" Font-Bold=true text=\"X\" /\u0026gt;\u0026amp;nbsp;\n \u0026lt;/div\u0026gt; \n\n \u0026lt;div style=\"padding-top:19px;\"\u0026gt;\u0026lt;/div\u0026gt;\n \u0026lt;/div\u0026gt; \n \u0026lt;/asp:Panel\u0026gt;\n \u0026lt;asp:Panel runat=\"server\" Width=\"800px\" ID=\"pnlTankDetailBody\"\u0026gt;\n \u0026lt;div id=\"divTankDetailbody\" runat=\"server\" style=\"width:100%\" \u0026gt;\n \u0026lt;br /\u0026gt;\n \u0026lt;table width=\"100%\"\u0026gt;\n \u0026lt;tr\u0026gt;\n \u0026lt;td\u0026gt;CT #\u0026lt;/td\u0026gt;\n \u0026lt;td\u0026gt;\u0026lt;asp:TextBox TabIndex=\"10\" runat=\"server\" BorderStyle=\"Inset\" BorderColor=\"White\" BorderWidth=\"2px\" BackColor=\"Transparent\" ID=\"txtCTNum\" ReadOnly=\"true\" \u0026gt;\u0026lt;/asp:TextBox\u0026gt;\n \u0026lt;asp:Label ID=\"lblCTNumber\" runat=\"server\" Text=\"*\"\u0026gt;\u0026lt;/asp:Label\u0026gt;\u0026amp;nbsp\u0026lt;/td\u0026gt;\n \u0026lt;td\u0026gt;Serial #\u0026lt;/td\u0026gt;\n \u0026lt;td\u0026gt;\u0026lt;asp:TextBox TabIndex=\"14\" runat=\"server\" BorderStyle=\"Inset\" BorderColor=\"White\" BorderWidth=\"2px\" ID=\"txtSeriaNum\" MaxLength=\"17\"\u0026gt;\u0026lt;/asp:TextBox\u0026gt;\n \u0026lt;asp:Label ID=\"lblSerialNumber\" runat=\"server\" Text=\"*\"\u0026gt;\u0026lt;/asp:Label\u0026gt;\u0026amp;nbsp\u0026lt;/td\u0026gt;\n \u0026lt;td\u0026gt;City\u0026lt;/td\u0026gt;\n \u0026lt;td\u0026gt;\u0026lt;asp:TextBox runat=\"server\" TabIndex=\"18\" BorderStyle=\"Inset\" BorderColor=\"White\" BorderWidth=\"2px\" ID=\"txtOrignatedCity\"\u0026gt;\u0026lt;/asp:TextBox\u0026gt;\u0026lt;/td\u0026gt;\n \u0026lt;/tr\u0026gt;\n \u0026lt;tr\u0026gt;\n \u0026lt;td\u0026gt;Capacity\u0026lt;/td\u0026gt;\n \u0026lt;td\u0026gt;\u0026lt;asp:TextBox TabIndex=\"11\" runat=\"server\" BorderStyle=\"Inset\" BorderColor=\"White\" BorderWidth=\"2px\" ID=\"txtTanktCapacity\"\u0026gt;\u0026lt;/asp:TextBox\u0026gt;\n \u0026lt;asp:Label ID=\"lblCapacity\" runat=\"server\" Text=\"*\"\u0026gt;\u0026lt;/asp:Label\u0026gt;\u0026amp;nbsp\u0026lt;/td\u0026gt;\n \u0026lt;td\u0026gt;Compartment\u0026lt;/td\u0026gt;\n \u0026lt;td\u0026gt;\u0026lt;asp:TextBox runat=\"server\" TabIndex=\"15\" ID=\"txtCompartment2\" BorderStyle=\"Inset\" BorderColor=\"White\" BorderWidth=\"2px\"\u0026gt;\u0026lt;/asp:TextBox\u0026gt;\n \u0026lt;asp:Label ID=\"lblCompartment\" runat=\"server\" Text=\"*\"\u0026gt;\u0026lt;/asp:Label\u0026gt;\u0026amp;nbsp\u0026lt;/td\u0026gt;\n\n \u0026lt;td\u0026gt;License #\u0026lt;/td\u0026gt;\n \u0026lt;td\u0026gt;\u0026lt;asp:TextBox runat=\"server\" BorderStyle=\"Inset\" TabIndex=\"19\" BorderColor=\"White\" BorderWidth=\"2px\" ID=\"txtLicenseNum\"\u0026gt;\u0026lt;/asp:TextBox\u0026gt;\u0026lt;/td\u0026gt;\n \u0026lt;/tr\u0026gt;\n \u0026lt;tr\u0026gt;\n \u0026lt;td\u0026gt;Tank Type\u0026lt;/td\u0026gt;\n \u0026lt;td\u0026gt;\n \u0026lt;asp:DropDownList runat=\"server\" TabIndex=\"12\" ID=\"ddlTankType2\" Width=\"156px\" \n DataTextField=\"TankTypeName\" \n DataValueField=\"TankTypeName\"\u0026gt;\u0026lt;/asp:DropDownList\u0026gt;\u0026lt;asp:Label ID=\"lblTankType\" runat=\"server\" Text=\"*\"\u0026gt;\u0026lt;/asp:Label\u0026gt;\u0026amp;nbsp\n \u0026lt;/td\u0026gt; \n \u0026lt;td\u0026gt;Unit #\u0026lt;/td\u0026gt;\n \u0026lt;td\u0026gt;\u0026lt;asp:TextBox runat=\"server\" TabIndex=\"16\" BorderStyle=\"Inset\" BorderColor=\"White\" BorderWidth=\"2px\" ID=\"txtUnitNum\"\u0026gt;\u0026lt;/asp:TextBox\u0026gt;\u0026lt;/td\u0026gt;\n\n \u0026lt;td\u0026gt;License State\u0026lt;/td\u0026gt;\n \u0026lt;td\u0026gt; \n \u0026lt;asp:DropDownList EnableViewState=\"true\" Width=\"156px\" TabIndex=\"20\" runat=\"server\" ID=\"ddlLicenseState\" DataSourceID=\"linqStates\" \n DataTextField=\"StateText\" DataValueField=\"StateID\"\u0026gt;\u0026lt;/asp:DropDownList\u0026gt; \n\n\n \u0026lt;asp:LinqDataSource ID=\"LinqDataSource1\" runat=\"server\" \n ContextTypeName=\"DataClassesDataContext\" TableName=\"States\"\u0026gt;\n \u0026lt;/asp:LinqDataSource\u0026gt;\n \u0026lt;/td\u0026gt;\n\n \u0026lt;/tr\u0026gt;\n \u0026lt;tr\u0026gt;\n \u0026lt;td\u0026gt;Manufacturer\u0026lt;/td\u0026gt;\n \u0026lt;td colspan=\"1\"\u0026gt;\n \u0026lt;asp:DropDownList runat=\"server\" TabIndex=\"13\" ID=\"ddlManufacturer2\" \n \u0026gt;\n \u0026lt;/asp:DropDownList\u0026gt;\u0026lt;asp:Label ID=\"lblManufacturer\" runat=\"server\" Text=\"*\"\u0026gt;\u0026lt;/asp:Label\u0026gt;\u0026amp;nbsp\n \u0026lt;/td\u0026gt; \n \u0026lt;td\u0026gt;Company\u0026lt;/td\u0026gt;\n \u0026lt;td colspan=\"3\"\u0026gt; \u0026lt;asp:DropDownList runat=\"server\" TabIndex=\"17\" ID=\"ddlCompany2\" \u0026gt;\u0026lt;/asp:DropDownList\u0026gt;\u0026lt;asp:Label ID=\"lblCompany2\" runat=\"server\" Text=\"*\"\u0026gt;\u0026lt;/asp:Label\u0026gt;\u0026lt;/td\u0026gt; \n\n \u0026lt;/tr\u0026gt;\n \u0026lt;tr\u0026gt;\n \u0026lt;td colspan=\"6\" align=\"center\"\u0026gt;\u0026lt;br /\u0026gt;\n \u0026lt;asp:Label ID=\"lblChangeOwnership\" Font-Size=\"Medium\" runat=\"server\"\u0026gt;\u0026lt;/asp:Label\u0026gt;\n \u0026lt;br /\u0026gt;\n \u0026lt;asp:CheckBox ID=\"chkChangeOwnership\" runat=\"server\" Text=\"Changing ownership\" ForeColor=\"Red\" Font-Bold=\"true\" /\u0026gt;\n \u0026lt;/td\u0026gt;\n \u0026lt;/tr\u0026gt;\n \u0026lt;tr\u0026gt;\n \u0026lt;td colspan=\"6\" align=\"center\"\u0026gt;\n \u0026lt;br /\u0026gt;\n \u0026lt;asp:Button runat=\"server\" ID=\"btnAdd\" TabIndex=\"21\" Text=\"Add\" Width=\"60px\" /\u0026gt; \n \u0026lt;asp:Button runat=\"server\" ID=\"btnUpdate\" TabIndex=\"22\" Text=\"Update\" Width=\"60px\" /\u0026gt; \n \u0026lt;asp:Button runat=\"server\" ID=\"btnChangeOnwership\" TabIndex=\"23\" Text=\"Change\" Width=\"60px\" /\u0026gt; \n \u0026lt;asp:Button runat=\"server\" ID=\"btnCancel\" TabIndex=\"24\" Text=\"Cancel\" Width=\"60px\" /\u0026gt;\n \u0026lt;br /\u0026gt;\u0026lt;br /\u0026gt;\n \u0026lt;asp:GridView ID=\"grdTanks\" runat=\"server\" AllowPaging=\"True\" \n AutoGenerateColumns=\"False\" BackColor=\"Transparent\" GridLines=\"None\" \n PagerSettings-Mode=\"NumericFirstLast\" PageSize=\"10\" \n RowStyle-HorizontalAlign=\"left\" Width=\"100%\"\u0026gt;\n \u0026lt;AlternatingRowStyle CssClass=\"alternateItemStyle\" /\u0026gt;\n \u0026lt;HeaderStyle CssClass=\"headerStyle\" /\u0026gt;\n \u0026lt;PagerSettings Mode=\"NumericFirstLast\" /\u0026gt;\n \u0026lt;RowStyle CssClass=\"itemStyle\" /\u0026gt;\n \u0026lt;Columns\u0026gt;\n \u0026lt;asp:BoundField DataField=\"CargoTankID\" HeaderText=\"CT #\" InsertVisible=\"False\" \n ReadOnly=\"True\" SortExpression=\"CargoTankID\" /\u0026gt;\n \u0026lt;asp:BoundField DataField=\"CompanyID\" HeaderText=\"CompanyID\" \n SortExpression=\"CompanyID\" Visible=\"false\" /\u0026gt;\n \u0026lt;asp:BoundField DataField=\"OriginatedCity\" HeaderText=\"OriginatedCity\" \n SortExpression=\"OriginatedCity\" Visible=\"false\" /\u0026gt;\n \u0026lt;asp:BoundField DataField=\"LicenseNumber\" HeaderText=\"LicenseNumber\" \n SortExpression=\"LicenseNumber\" Visible=\"false\" /\u0026gt;\n \u0026lt;asp:BoundField DataField=\"LicenseState\" HeaderText=\"LicenseState\" \n SortExpression=\"LicenseState\" Visible=\"false\" /\u0026gt;\n \u0026lt;asp:BoundField DataField=\"UnitNumber\" HeaderText=\"Unit Number\" \n SortExpression=\"UnitNumber\" Visible=\"false\" /\u0026gt;\n \u0026lt;asp:TemplateField HeaderText=\"Company\"\u0026gt;\n \u0026lt;ItemTemplate\u0026gt;\n \u0026lt;%#DisplayCompanyName(Eval(\"CompanyID\"))%\u0026gt;\n \u0026lt;/ItemTemplate\u0026gt;\n \u0026lt;/asp:TemplateField\u0026gt;\n \u0026lt;asp:BoundField DataField=\"SerialNumber\" HeaderText=\"Serial Number\" \n SortExpression=\"SerialNumber\" /\u0026gt;\n \u0026lt;asp:BoundField DataField=\"Capacity\" HeaderText=\"Capacity\" \n SortExpression=\"Capacity\" /\u0026gt;\n \u0026lt;asp:TemplateField HeaderText=\"Manufacturer\"\u0026gt;\n \u0026lt;ItemTemplate\u0026gt;\n \u0026lt;%#DisplayManufacturer(Eval(\"ManufacturerID\"))%\u0026gt;\n \u0026lt;/ItemTemplate\u0026gt;\n \u0026lt;/asp:TemplateField\u0026gt;\n \u0026lt;asp:BoundField DataField=\"TankType\" HeaderText=\"Tank Type\" \n SortExpression=\"TankType\" Visible=\"false\" /\u0026gt;\n \u0026lt;asp:BoundField DataField=\"Compartment\" HeaderText=\"Compartment\" \n SortExpression=\"Compartment\" Visible=\"false\" /\u0026gt;\n \u0026lt;asp:BoundField DataField=\"DecalID\" HeaderText=\"DecalID\" \n SortExpression=\"DecalID\" Visible=\"false\" /\u0026gt;\n \u0026lt;asp:TemplateField HeaderText=\"Decal Status\"\u0026gt;\n \u0026lt;ItemTemplate\u0026gt;\n \u0026lt;%#DisplayTestLink(Eval(\"CargoTankID\"))%\u0026gt;\n \u0026lt;/ItemTemplate\u0026gt;\n \u0026lt;/asp:TemplateField\u0026gt;\n \u0026lt;/Columns\u0026gt;\n \u0026lt;/asp:GridView\u0026gt;\n \u0026lt;/td\u0026gt;\n\n \u0026lt;/tr\u0026gt;\n \u0026lt;/table\u0026gt;\n\n \u0026lt;/div\u0026gt;\n \u0026lt;/asp:Panel\u0026gt;\n \u0026lt;/asp:Panel\u0026gt;\n \u0026lt;/ContentTemplate\u0026gt;\n \u0026lt;Triggers\u0026gt;\n \u0026lt;asp:AsyncPostBackTrigger ControlID=\"btnSearch\" EventName=\"Click\" /\u0026gt;\n\n \u0026lt;/Triggers\u0026gt; \n \u0026lt;/asp:UpdatePanel\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003c/p\u003e\n\n\u003cp\u003e\u003c/p\u003e\n\n\u003cp\u003e\u003c/p\u003e\n\n\u003cp\u003eHere is my code behind:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load\n If Not Page.IsPostBack Then\n If (Me.Page.User.Identity.IsAuthenticated) Then\n Dim db As DataClassesDataContext = New DataClassesDataContext()\n\n Dim tanks = From t In db.CT_Tanks _\n Select t\n\n Me.grdTanks.DataSource = tanks\n Me.grdTanks.DataBind()\n\n Dim tanktype = (From t In db.CT_TankTypes _\n Select t).ToList\n\n ddlTankType.DataSource = tanktype\n ddlTankType.DataTextField = \"TankTypeName\"\n ddlTankType.DataValueField = \"TankTypeName\"\n ddlTankType.DataBind()\n ddlTankType.Items.Insert(0, \"-- Select a Type --\")\n ddlTankType2.DataSource = tanktype\n ddlTankType2.DataTextField = \"TankTypeName\"\n ddlTankType2.DataValueField = \"TankTypeName\"\n ddlTankType2.DataBind()\n ddlTankType2.Items.Insert(0, \"-- Select a Type --\")\n\n Dim manufacturer = (From m In db.CT_Manufacturers _\n Select m).ToList\n\n ddlManufacturer.DataSource = manufacturer\n ddlManufacturer.DataTextField = \"ManufacturerName\"\n ddlManufacturer.DataValueField = \"ManufacturerID\"\n ddlManufacturer.DataBind()\n ddlManufacturer.Items.Insert(0, \"-- Select a Manufacturer --\")\n\n ddlManufacturer2.DataSource = manufacturer\n ddlManufacturer2.DataTextField = \"ManufacturerName\"\n ddlManufacturer2.DataValueField = \"ManufacturerID\"\n ddlManufacturer2.DataBind()\n ddlManufacturer2.Items.Insert(0, \"-- Select a Manufacturer --\")\n\n Dim companies = (From c In db.CT_Companies _\n Where c.IsOwner = True _\n Select c Order By c.CompanyName Ascending).ToList\n\n ddlCompany.DataSource = companies\n ddlCompany.DataTextField = \"CompanyName\"\n ddlCompany.DataValueField = \"CompanyID\"\n ddlCompany.DataBind()\n ddlCompany.Items.Insert(0, \"-- Select a Company --\")\n\n ddlCompany2.DataSource = companies\n ddlCompany2.DataTextField = \"CompanyName\"\n ddlCompany2.DataValueField = \"CompanyID\"\n ddlCompany2.DataBind()\n ddlCompany2.Items.Insert(0, \"-- Select a Company --\")\n\n End If\n End If\n\nEnd Sub\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"4","comment_count":"4","creation_date":"2012-07-18 16:22:50.09 UTC","last_activity_date":"2014-01-09 02:19:11.88 UTC","last_edit_date":"2012-07-18 16:49:43.187 UTC","last_editor_display_name":"","last_editor_user_id":"1202606","owner_display_name":"","owner_user_id":"1202606","post_type_id":"1","score":"0","tags":"asp.net","view_count":"3947"} +{"id":"11545975","title":"can't see asp.net gridview on page load","body":"\u003cp\u003eI have a gridview that won't show on page load. The gridview is inside of some asp:Panels which are inside of an update panel. I stepped through the code, so I know the gridview has rows of data. If I move the gridview outside of the panels and update panels, then it will show up with data. Does anybody know why it doesn't work as it sits below, inside of the panels and update panels? \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e \u0026lt;%@ Page Language=\"VB\" AutoEventWireup=\"false\" EnableEventValidation=\"false\" ClusterClusterManagerPageFile=\"~/CTPublic.cluster_manager\" CodeFile=\"Tank.aspx.vb\" Inherits=\"CargoTank_Internal_Tank\" %\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;div style=\"padding-top:9px; width:100%; min-width:800px; \" \u0026gt;\n \u0026lt;asp:UpdatePanel ID=\"udpTank\" runat=\"server\" \u0026gt;\n \u0026lt;ContentTemplate\u0026gt;\n \u0026lt;ajaxToolkit:RoundedCornersExtender runat=\"server\" BorderColor=\"#3260a0\" Corners=\"All\" Radius=\"5\" Color=\"#98B9C9\" TargetControlID=\"pnlTank\" ID=\"ajRCEpnlTank\" \u0026gt;\u0026lt;/ajaxToolkit:RoundedCornersExtender\u0026gt;\n\n \u0026lt;asp:Panel runat=\"server\" BackColor=\"#ecece7\" Width=\"95%\" ID=\"pnlTank\" \u0026gt;\n\n \u0026lt;div \u0026gt;\n \u0026lt;div style=\"float:left; width:70%; background-color:#98B9C9; height:19px;\"\u0026gt;Tanks\u0026lt;/div\u0026gt;\n \u0026lt;div style=\"float:right; width:30%; height:19px;background-color:#98B9C9; text-align:right\"\u0026gt;\n \u0026lt;asp:Button ID=\"btnAddNewTank\" style=\"background:transparent; border:0px;\" runat=\"server\" Font-Underline=\"true\" size=\"1\" Font-Bold=true text=\"Add New\" /\u0026gt; \n\n \u0026lt;/div\u0026gt; \n \u0026lt;div style=\"padding-top:19px;\"\u0026gt;\u0026lt;/div\u0026gt;\n \u0026lt;/div\u0026gt; \n \u0026lt;div style=\"width:100%;\"\u0026gt;\n \u0026lt;table width=\"100%\"\u0026gt;\n \u0026lt;tr\u0026gt;\n \u0026lt;td colspan=\"6\" class=\"tdheaderbar\"\u0026gt;Search Tanks\n \u0026lt;/td\u0026gt;\n \u0026lt;/tr\u0026gt;\n \u0026lt;tr\u0026gt;\n \u0026lt;td\u0026gt;CT #\u0026lt;/td\u0026gt;\n \u0026lt;td\u0026gt;\u0026lt;asp:TextBox runat=\"server\" ID=\"txtCTNumber\" \u0026gt;\u0026lt;/asp:TextBox\u0026gt;\u0026lt;/td\u0026gt;\n \u0026lt;td\u0026gt;Serial #\u0026lt;/td\u0026gt;\n \u0026lt;td\u0026gt;\u0026lt;asp:TextBox runat=\"server\" ID=\"txtSerialNumber\" MaxLength=\"17\"\u0026gt;\u0026lt;/asp:TextBox\u0026gt;\u0026lt;/td\u0026gt;\n \u0026lt;td\u0026gt;City\u0026lt;/td\u0026gt;\n \u0026lt;td\u0026gt;\u0026lt;asp:TextBox runat=\"server\" ID=\"txtCity\"\u0026gt;\u0026lt;/asp:TextBox\u0026gt;\u0026lt;/td\u0026gt;\n\n \u0026lt;/tr\u0026gt;\n \u0026lt;tr\u0026gt;\n \u0026lt;td\u0026gt;Capacity\u0026lt;/td\u0026gt;\n \u0026lt;td\u0026gt;\u0026lt;asp:TextBox runat=\"server\" ID=\"txtCapacity\"\u0026gt;\u0026lt;/asp:TextBox\u0026gt;\u0026lt;/td\u0026gt;\n \u0026lt;td\u0026gt;Unit #\u0026lt;/td\u0026gt;\n \u0026lt;td\u0026gt;\u0026lt;asp:TextBox runat=\"server\" ID=\"txtUnitNumber\"\u0026gt;\u0026lt;/asp:TextBox\u0026gt;\u0026lt;/td\u0026gt;\n \u0026lt;td\u0026gt;License State\u0026lt;/td\u0026gt;\n \u0026lt;td\u0026gt;\u0026lt;asp:DropDownList EnableViewState=\"true\" runat=\"server\" ID=\"ddlState\" DataSourceID=\"linqStates\" \n Width=\"156px\" DataTextField=\"StateText\" DataValueField=\"StateID\"\u0026gt;\u0026lt;/asp:DropDownList\u0026gt;\n \u0026lt;asp:LinqDataSource ID=\"linqStates\" runat=\"server\" \n ContextTypeName=\"DataClassesDataContext\" TableName=\"States\"\u0026gt;\n \u0026lt;/asp:LinqDataSource\u0026gt;\n \u0026lt;/td\u0026gt;\n\n \u0026lt;/tr\u0026gt;\n \u0026lt;tr\u0026gt;\n \u0026lt;td\u0026gt;Tank Type\u0026lt;/td\u0026gt;\n \u0026lt;td\u0026gt;\n \u0026lt;asp:DropDownList runat=\"server\" ID=\"ddlTankType\" Width=\"156px\"\n \u0026gt;\u0026lt;/asp:DropDownList\u0026gt;\n\n \u0026lt;/td\u0026gt; \n \u0026lt;td\u0026gt;Compartment\u0026lt;/td\u0026gt;\n \u0026lt;td\u0026gt;\u0026lt;asp:TextBox runat=\"server\" ID=\"txtCompartment\"\u0026gt;\u0026lt;/asp:TextBox\u0026gt;\u0026lt;/td\u0026gt;\n \u0026lt;td\u0026gt;License #\u0026lt;/td\u0026gt;\n \u0026lt;td\u0026gt;\u0026lt;asp:TextBox runat=\"server\" ID=\"txtLicenseNumber\"\u0026gt;\u0026lt;/asp:TextBox\u0026gt;\u0026lt;/td\u0026gt;\n \u0026lt;/tr\u0026gt;\n \u0026lt;tr\u0026gt;\n \u0026lt;td\u0026gt;Manufacturer\u0026lt;/td\u0026gt;\n \u0026lt;td colspan=\"2\"\u0026gt;\n \u0026lt;asp:DropDownList runat=\"server\" ID=\"ddlManufacturer\" \n \u0026gt;\u0026lt;/asp:DropDownList\u0026gt;\n\n \u0026lt;/td\u0026gt; \n\n\n \u0026lt;td\u0026gt;\u0026lt;asp:CheckBox runat=\"server\" ID=\"chkNoLogIn\" Text=\"No Log In Associated\" /\u0026gt;\u0026lt;/td\u0026gt;\n \u0026lt;td\u0026gt;\u0026lt;/td\u0026gt; \u0026lt;td\u0026gt;\u0026lt;/td\u0026gt; \n \u0026lt;/tr\u0026gt;\n \u0026lt;tr\u0026gt;\u0026lt;td\u0026gt;Company\u0026lt;/td\u0026gt;\n \u0026lt;td colspan=\"5\"\u0026gt; \u0026lt;asp:DropDownList runat=\"server\" ID=\"ddlCompany\" \u0026gt;\u0026lt;/asp:DropDownList\u0026gt;\u0026lt;/td\u0026gt; \n \u0026lt;/tr\u0026gt; \n \u0026lt;tr\u0026gt;\n \u0026lt;td colspan=\"3\"\u0026gt;\n \u0026lt;/td\u0026gt;\n \u0026lt;td\u0026gt;\u0026lt;asp:Button runat=\"server\" ID=\"btnSearch\" Text=\"Search\" /\u0026gt;\u0026lt;/td\u0026gt;\n \u0026lt;/tr\u0026gt;\n \u0026lt;/table\u0026gt;\n \u0026lt;/div\u0026gt;\n\n \u0026lt;/asp:Panel\u0026gt;\n \u0026lt;/ContentTemplate\u0026gt;\n \u0026lt;Triggers\u0026gt;\n \u0026lt;asp:AsyncPostBackTrigger ControlID=\"btnSearch\" EventName=\"Click\" /\u0026gt;\n \u0026lt;/Triggers\u0026gt; \n \u0026lt;/asp:UpdatePanel\u0026gt;\n \u0026lt;br /\u0026gt;\n\n \u0026lt;div style=\"padding-top:9px; width:100%; \" id=\"divTankDetail\" runat=\"server\"\u0026gt;\n \u0026lt;asp:UpdatePanel ID=\"updTankDetail\" runat=\"server\" \u0026gt;\n \u0026lt;ContentTemplate\u0026gt;\n \u0026lt;ajaxToolkit:DropShadowExtender runat=\"server\" ID=\"dsetank\" TargetControlID=\"pnlTankDetail\" TrackPosition=\"true\" BehaviorID=\"pnlTankDetailHeader\"\u0026gt;\u0026lt;/ajaxToolkit:DropShadowExtender\u0026gt;\n \u0026lt;ajaxToolkit:DragPanelExtender runat=\"server\" ID=\"dpeTankDetail\" TargetControlID=\"pnlTankDetail\" DragHandleID=\"pnlTankDetailHeader\"\u0026gt;\u0026lt;/ajaxToolkit:DragPanelExtender\u0026gt;\n \u0026lt;asp:Panel CssClass=\"TankpopupPosition\" BackColor=\"LightBlue\" Visible=\"false\" runat=\"server\" BorderColor=\"#3260a0\" BorderWidth=\"2px\" Width=\"801px\" ID=\"pnlTankDetail\" \u0026gt;\n \u0026lt;asp:Panel runat=\"server\" BorderColor=\"#3260a0\" BorderWidth=\"1px\" Width=\"800px\" ID=\"pnlTankDetailHeader\"\u0026gt;\n \u0026lt;div \u0026gt;\n \u0026lt;div style=\"float:left; width:90%; background-color:#98B9C9; height:19px;\"\u0026gt;Tank Detail\u0026lt;/div\u0026gt;\n \u0026lt;div style=\"float:right; width:10%; border-right-width:2px; border-width:1px; border-color:#3260a0; height:19px;background-color:#98B9C9; text-align:right\"\u0026gt;\n \u0026lt;asp:Button ID=\"btnClose\" style=\"background:transparent; border:0px;\" runat=\"server\" size=\"1\" Font-Bold=true text=\"X\" /\u0026gt;\u0026amp;nbsp;\n \u0026lt;/div\u0026gt; \n\n \u0026lt;div style=\"padding-top:19px;\"\u0026gt;\u0026lt;/div\u0026gt;\n \u0026lt;/div\u0026gt; \n \u0026lt;/asp:Panel\u0026gt;\n \u0026lt;asp:Panel runat=\"server\" Width=\"800px\" ID=\"pnlTankDetailBody\"\u0026gt;\n \u0026lt;div id=\"divTankDetailbody\" runat=\"server\" style=\"width:100%\" \u0026gt;\n \u0026lt;br /\u0026gt;\n \u0026lt;table width=\"100%\"\u0026gt;\n \u0026lt;tr\u0026gt;\n \u0026lt;td\u0026gt;CT #\u0026lt;/td\u0026gt;\n \u0026lt;td\u0026gt;\u0026lt;asp:TextBox TabIndex=\"10\" runat=\"server\" BorderStyle=\"Inset\" BorderColor=\"White\" BorderWidth=\"2px\" BackColor=\"Transparent\" ID=\"txtCTNum\" ReadOnly=\"true\" \u0026gt;\u0026lt;/asp:TextBox\u0026gt;\n \u0026lt;asp:Label ID=\"lblCTNumber\" runat=\"server\" Text=\"*\"\u0026gt;\u0026lt;/asp:Label\u0026gt;\u0026amp;nbsp\u0026lt;/td\u0026gt;\n \u0026lt;td\u0026gt;Serial #\u0026lt;/td\u0026gt;\n \u0026lt;td\u0026gt;\u0026lt;asp:TextBox TabIndex=\"14\" runat=\"server\" BorderStyle=\"Inset\" BorderColor=\"White\" BorderWidth=\"2px\" ID=\"txtSeriaNum\" MaxLength=\"17\"\u0026gt;\u0026lt;/asp:TextBox\u0026gt;\n \u0026lt;asp:Label ID=\"lblSerialNumber\" runat=\"server\" Text=\"*\"\u0026gt;\u0026lt;/asp:Label\u0026gt;\u0026amp;nbsp\u0026lt;/td\u0026gt;\n \u0026lt;td\u0026gt;City\u0026lt;/td\u0026gt;\n \u0026lt;td\u0026gt;\u0026lt;asp:TextBox runat=\"server\" TabIndex=\"18\" BorderStyle=\"Inset\" BorderColor=\"White\" BorderWidth=\"2px\" ID=\"txtOrignatedCity\"\u0026gt;\u0026lt;/asp:TextBox\u0026gt;\u0026lt;/td\u0026gt;\n \u0026lt;/tr\u0026gt;\n \u0026lt;tr\u0026gt;\n \u0026lt;td\u0026gt;Capacity\u0026lt;/td\u0026gt;\n \u0026lt;td\u0026gt;\u0026lt;asp:TextBox TabIndex=\"11\" runat=\"server\" BorderStyle=\"Inset\" BorderColor=\"White\" BorderWidth=\"2px\" ID=\"txtTanktCapacity\"\u0026gt;\u0026lt;/asp:TextBox\u0026gt;\n \u0026lt;asp:Label ID=\"lblCapacity\" runat=\"server\" Text=\"*\"\u0026gt;\u0026lt;/asp:Label\u0026gt;\u0026amp;nbsp\u0026lt;/td\u0026gt;\n \u0026lt;td\u0026gt;Compartment\u0026lt;/td\u0026gt;\n \u0026lt;td\u0026gt;\u0026lt;asp:TextBox runat=\"server\" TabIndex=\"15\" ID=\"txtCompartment2\" BorderStyle=\"Inset\" BorderColor=\"White\" BorderWidth=\"2px\"\u0026gt;\u0026lt;/asp:TextBox\u0026gt;\n \u0026lt;asp:Label ID=\"lblCompartment\" runat=\"server\" Text=\"*\"\u0026gt;\u0026lt;/asp:Label\u0026gt;\u0026amp;nbsp\u0026lt;/td\u0026gt;\n\n \u0026lt;td\u0026gt;License #\u0026lt;/td\u0026gt;\n \u0026lt;td\u0026gt;\u0026lt;asp:TextBox runat=\"server\" BorderStyle=\"Inset\" TabIndex=\"19\" BorderColor=\"White\" BorderWidth=\"2px\" ID=\"txtLicenseNum\"\u0026gt;\u0026lt;/asp:TextBox\u0026gt;\u0026lt;/td\u0026gt;\n \u0026lt;/tr\u0026gt;\n \u0026lt;tr\u0026gt;\n \u0026lt;td\u0026gt;Tank Type\u0026lt;/td\u0026gt;\n \u0026lt;td\u0026gt;\n \u0026lt;asp:DropDownList runat=\"server\" TabIndex=\"12\" ID=\"ddlTankType2\" Width=\"156px\" \n DataTextField=\"TankTypeName\" \n DataValueField=\"TankTypeName\"\u0026gt;\u0026lt;/asp:DropDownList\u0026gt;\u0026lt;asp:Label ID=\"lblTankType\" runat=\"server\" Text=\"*\"\u0026gt;\u0026lt;/asp:Label\u0026gt;\u0026amp;nbsp\n \u0026lt;/td\u0026gt; \n \u0026lt;td\u0026gt;Unit #\u0026lt;/td\u0026gt;\n \u0026lt;td\u0026gt;\u0026lt;asp:TextBox runat=\"server\" TabIndex=\"16\" BorderStyle=\"Inset\" BorderColor=\"White\" BorderWidth=\"2px\" ID=\"txtUnitNum\"\u0026gt;\u0026lt;/asp:TextBox\u0026gt;\u0026lt;/td\u0026gt;\n\n \u0026lt;td\u0026gt;License State\u0026lt;/td\u0026gt;\n \u0026lt;td\u0026gt; \n \u0026lt;asp:DropDownList EnableViewState=\"true\" Width=\"156px\" TabIndex=\"20\" runat=\"server\" ID=\"ddlLicenseState\" DataSourceID=\"linqStates\" \n DataTextField=\"StateText\" DataValueField=\"StateID\"\u0026gt;\u0026lt;/asp:DropDownList\u0026gt; \n\n\n \u0026lt;asp:LinqDataSource ID=\"LinqDataSource1\" runat=\"server\" \n ContextTypeName=\"DataClassesDataContext\" TableName=\"States\"\u0026gt;\n \u0026lt;/asp:LinqDataSource\u0026gt;\n \u0026lt;/td\u0026gt;\n\n \u0026lt;/tr\u0026gt;\n \u0026lt;tr\u0026gt;\n \u0026lt;td\u0026gt;Manufacturer\u0026lt;/td\u0026gt;\n \u0026lt;td colspan=\"1\"\u0026gt;\n \u0026lt;asp:DropDownList runat=\"server\" TabIndex=\"13\" ID=\"ddlManufacturer2\" \n \u0026gt;\n \u0026lt;/asp:DropDownList\u0026gt;\u0026lt;asp:Label ID=\"lblManufacturer\" runat=\"server\" Text=\"*\"\u0026gt;\u0026lt;/asp:Label\u0026gt;\u0026amp;nbsp\n \u0026lt;/td\u0026gt; \n \u0026lt;td\u0026gt;Company\u0026lt;/td\u0026gt;\n \u0026lt;td colspan=\"3\"\u0026gt; \u0026lt;asp:DropDownList runat=\"server\" TabIndex=\"17\" ID=\"ddlCompany2\" \u0026gt;\u0026lt;/asp:DropDownList\u0026gt;\u0026lt;asp:Label ID=\"lblCompany2\" runat=\"server\" Text=\"*\"\u0026gt;\u0026lt;/asp:Label\u0026gt;\u0026lt;/td\u0026gt; \n\n \u0026lt;/tr\u0026gt;\n \u0026lt;tr\u0026gt;\n \u0026lt;td colspan=\"6\" align=\"center\"\u0026gt;\u0026lt;br /\u0026gt;\n \u0026lt;asp:Label ID=\"lblChangeOwnership\" Font-Size=\"Medium\" runat=\"server\"\u0026gt;\u0026lt;/asp:Label\u0026gt;\n \u0026lt;br /\u0026gt;\n \u0026lt;asp:CheckBox ID=\"chkChangeOwnership\" runat=\"server\" Text=\"Changing ownership\" ForeColor=\"Red\" Font-Bold=\"true\" /\u0026gt;\n \u0026lt;/td\u0026gt;\n \u0026lt;/tr\u0026gt;\n \u0026lt;tr\u0026gt;\n \u0026lt;td colspan=\"6\" align=\"center\"\u0026gt;\n \u0026lt;br /\u0026gt;\n \u0026lt;asp:Button runat=\"server\" ID=\"btnAdd\" TabIndex=\"21\" Text=\"Add\" Width=\"60px\" /\u0026gt; \n \u0026lt;asp:Button runat=\"server\" ID=\"btnUpdate\" TabIndex=\"22\" Text=\"Update\" Width=\"60px\" /\u0026gt; \n \u0026lt;asp:Button runat=\"server\" ID=\"btnChangeOnwership\" TabIndex=\"23\" Text=\"Change\" Width=\"60px\" /\u0026gt; \n \u0026lt;asp:Button runat=\"server\" ID=\"btnCancel\" TabIndex=\"24\" Text=\"Cancel\" Width=\"60px\" /\u0026gt;\n \u0026lt;br /\u0026gt;\u0026lt;br /\u0026gt;\n \u0026lt;asp:GridView ID=\"grdTanks\" runat=\"server\" AllowPaging=\"True\" \n AutoGenerateColumns=\"False\" BackColor=\"Transparent\" GridLines=\"None\" \n PagerSettings-Mode=\"NumericFirstLast\" PageSize=\"10\" \n RowStyle-HorizontalAlign=\"left\" Width=\"100%\"\u0026gt;\n \u0026lt;AlternatingRowStyle CssClass=\"alternateItemStyle\" /\u0026gt;\n \u0026lt;HeaderStyle CssClass=\"headerStyle\" /\u0026gt;\n \u0026lt;PagerSettings Mode=\"NumericFirstLast\" /\u0026gt;\n \u0026lt;RowStyle CssClass=\"itemStyle\" /\u0026gt;\n \u0026lt;Columns\u0026gt;\n \u0026lt;asp:BoundField DataField=\"CargoTankID\" HeaderText=\"CT #\" InsertVisible=\"False\" \n ReadOnly=\"True\" SortExpression=\"CargoTankID\" /\u0026gt;\n \u0026lt;asp:BoundField DataField=\"CompanyID\" HeaderText=\"CompanyID\" \n SortExpression=\"CompanyID\" Visible=\"false\" /\u0026gt;\n \u0026lt;asp:BoundField DataField=\"OriginatedCity\" HeaderText=\"OriginatedCity\" \n SortExpression=\"OriginatedCity\" Visible=\"false\" /\u0026gt;\n \u0026lt;asp:BoundField DataField=\"LicenseNumber\" HeaderText=\"LicenseNumber\" \n SortExpression=\"LicenseNumber\" Visible=\"false\" /\u0026gt;\n \u0026lt;asp:BoundField DataField=\"LicenseState\" HeaderText=\"LicenseState\" \n SortExpression=\"LicenseState\" Visible=\"false\" /\u0026gt;\n \u0026lt;asp:BoundField DataField=\"UnitNumber\" HeaderText=\"Unit Number\" \n SortExpression=\"UnitNumber\" Visible=\"false\" /\u0026gt;\n \u0026lt;asp:TemplateField HeaderText=\"Company\"\u0026gt;\n \u0026lt;ItemTemplate\u0026gt;\n \u0026lt;%#DisplayCompanyName(Eval(\"CompanyID\"))%\u0026gt;\n \u0026lt;/ItemTemplate\u0026gt;\n \u0026lt;/asp:TemplateField\u0026gt;\n \u0026lt;asp:BoundField DataField=\"SerialNumber\" HeaderText=\"Serial Number\" \n SortExpression=\"SerialNumber\" /\u0026gt;\n \u0026lt;asp:BoundField DataField=\"Capacity\" HeaderText=\"Capacity\" \n SortExpression=\"Capacity\" /\u0026gt;\n \u0026lt;asp:TemplateField HeaderText=\"Manufacturer\"\u0026gt;\n \u0026lt;ItemTemplate\u0026gt;\n \u0026lt;%#DisplayManufacturer(Eval(\"ManufacturerID\"))%\u0026gt;\n \u0026lt;/ItemTemplate\u0026gt;\n \u0026lt;/asp:TemplateField\u0026gt;\n \u0026lt;asp:BoundField DataField=\"TankType\" HeaderText=\"Tank Type\" \n SortExpression=\"TankType\" Visible=\"false\" /\u0026gt;\n \u0026lt;asp:BoundField DataField=\"Compartment\" HeaderText=\"Compartment\" \n SortExpression=\"Compartment\" Visible=\"false\" /\u0026gt;\n \u0026lt;asp:BoundField DataField=\"DecalID\" HeaderText=\"DecalID\" \n SortExpression=\"DecalID\" Visible=\"false\" /\u0026gt;\n \u0026lt;asp:TemplateField HeaderText=\"Decal Status\"\u0026gt;\n \u0026lt;ItemTemplate\u0026gt;\n \u0026lt;%#DisplayTestLink(Eval(\"CargoTankID\"))%\u0026gt;\n \u0026lt;/ItemTemplate\u0026gt;\n \u0026lt;/asp:TemplateField\u0026gt;\n \u0026lt;/Columns\u0026gt;\n \u0026lt;/asp:GridView\u0026gt;\n \u0026lt;/td\u0026gt;\n\n \u0026lt;/tr\u0026gt;\n \u0026lt;/table\u0026gt;\n\n \u0026lt;/div\u0026gt;\n \u0026lt;/asp:Panel\u0026gt;\n \u0026lt;/asp:Panel\u0026gt;\n \u0026lt;/ContentTemplate\u0026gt;\n \u0026lt;Triggers\u0026gt;\n \u0026lt;asp:AsyncPostBackTrigger ControlID=\"btnSearch\" EventName=\"Click\" /\u0026gt;\n\n \u0026lt;/Triggers\u0026gt; \n \u0026lt;/asp:UpdatePanel\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003c/p\u003e\n\n\u003cp\u003e\u003c/p\u003e\n\n\u003cp\u003e\u003c/p\u003e\n\n\u003cp\u003eHere is my code behind:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load\n If Not Page.IsPostBack Then\n If (Me.Page.User.Identity.IsAuthenticated) Then\n Dim db As DataClassesDataContext = New DataClassesDataContext()\n\n Dim tanks = From t In db.CT_Tanks _\n Select t\n\n Me.grdTanks.DataSource = tanks\n Me.grdTanks.DataBind()\n\n Dim tanktype = (From t In db.CT_TankTypes _\n Select t).ToList\n\n ddlTankType.DataSource = tanktype\n ddlTankType.DataTextField = \"TankTypeName\"\n ddlTankType.DataValueField = \"TankTypeName\"\n ddlTankType.DataBind()\n ddlTankType.Items.Insert(0, \"-- Select a Type --\")\n ddlTankType2.DataSource = tanktype\n ddlTankType2.DataTextField = \"TankTypeName\"\n ddlTankType2.DataValueField = \"TankTypeName\"\n ddlTankType2.DataBind()\n ddlTankType2.Items.Insert(0, \"-- Select a Type --\")\n\n Dim manufacturer = (From m In db.CT_Manufacturers _\n Select m).ToList\n\n ddlManufacturer.DataSource = manufacturer\n ddlManufacturer.DataTextField = \"ManufacturerName\"\n ddlManufacturer.DataValueField = \"ManufacturerID\"\n ddlManufacturer.DataBind()\n ddlManufacturer.Items.Insert(0, \"-- Select a Manufacturer --\")\n\n ddlManufacturer2.DataSource = manufacturer\n ddlManufacturer2.DataTextField = \"ManufacturerName\"\n ddlManufacturer2.DataValueField = \"ManufacturerID\"\n ddlManufacturer2.DataBind()\n ddlManufacturer2.Items.Insert(0, \"-- Select a Manufacturer --\")\n\n Dim companies = (From c In db.CT_Companies _\n Where c.IsOwner = True _\n Select c Order By c.CompanyName Ascending).ToList\n\n ddlCompany.DataSource = companies\n ddlCompany.DataTextField = \"CompanyName\"\n ddlCompany.DataValueField = \"CompanyID\"\n ddlCompany.DataBind()\n ddlCompany.Items.Insert(0, \"-- Select a Company --\")\n\n ddlCompany2.DataSource = companies\n ddlCompany2.DataTextField = \"CompanyName\"\n ddlCompany2.DataValueField = \"CompanyID\"\n ddlCompany2.DataBind()\n ddlCompany2.Items.Insert(0, \"-- Select a Company --\")\n\n End If\n End If\n\nEnd Sub\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"4","comment_count":"4","creation_date":"2012-07-18 16:22:50.09 UTC","last_activity_date":"2014-01-09 02:19:11.88 UTC","last_edit_date":"2012-07-18 16:49:43.187 UTC","last_editor_display_name":"","last_editor_user_id":"1202606","owner_display_name":"","owner_user_id":"1202606","post_type_id":"1","score":"0","tags":"asp.net","view_count":"3947"} {"id":"19168489","title":"HTTPS Force Redirect not working in Wordpress","body":"\u003cp\u003eMy Wordpress directory is at www.example.com/blog\u003c/p\u003e\n\n\u003cp\u003eI recently changed my entire site to force HTTPS. So my .htaccess file in /blog/ looks like this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;IfModule mod_rewrite.c\u0026gt;\nRewriteEngine On\nRewriteBase /blog/\nRewriteRule ^index\\.php$ - [L]\nRewriteCond %{REQUEST_FILENAME} !-f\nRewriteCond %{REQUEST_FILENAME} !-d\nRewriteRule . /blog/index.php [L]\n\u0026lt;/IfModule\u0026gt;\n\nRewriteEngine on\nRewriteCond %{HTTPS} off\nRewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI also changed the site URL in Wordpress settings to be HTTPS.\u003c/p\u003e\n\n\u003cp\u003eThis works perfectly in the homepage, but in any post pages, the end user is able to change to non-secure HTTP, by changing the URL and pressing enter.\u003c/p\u003e\n\n\u003cp\u003eFor example, they can type directly: \u003ca href=\"http://www.example.com/blog/post-1/\" rel=\"nofollow noreferrer\"\u003ehttp://www.example.com/blog/post-1/\u003c/a\u003e and it will load as HTTP.\u003c/p\u003e\n\n\u003cp\u003eWhat is wrong with my .htaccess file? Where is the loose end?\u003c/p\u003e","accepted_answer_id":"19168616","answer_count":"2","comment_count":"0","creation_date":"2013-10-03 20:17:20.84 UTC","favorite_count":"9","last_activity_date":"2016-12-31 08:21:31.553 UTC","last_edit_date":"2016-12-31 08:21:31.553 UTC","last_editor_display_name":"","last_editor_user_id":"1033581","owner_display_name":"","owner_user_id":"2011972","post_type_id":"1","score":"12","tags":"wordpress|apache|.htaccess|mod-rewrite|redirect","view_count":"8382"} {"id":"28858501","title":"How to print errors while streaming with tweepy in python?","body":"\u003cp\u003eI am a Python newbie and am trying to print error messages when using Tweepy to stream tweets. I used an endless loop in my streaming code because it generates InComplete Read errors otherwise. My aim is to print all the error messages I get while continuing to stream tweets, so that I am aware of errors other than the InComplete Read errors. \u003c/p\u003e\n\n\u003cp\u003eMy streamListerner is:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e# Code from http://badhessian.org/2012/10/collecting-real-time-twitter-data- with-the-streaming-api/ with minor modifications\nimport json, time, sys\nfrom tweepy import StreamListener\n\n# create an instance of a tweepy StreamListener to handle the incoming data. \nclass SListener(StreamListener):\n\n def __init__(self, fprefix = 'streamer'):\n # self.api = api or API()\n self.counter = 0\n self.fprefix = fprefix\n self.output = open('../Dissertation/stream_3_data/' + fprefix + '.' + time.strftime('%Y%m%d-%H%M%S') + '.json', 'w')\n self.delout = open('delete.txt', 'a')\n\n def on_data(self, data):\n\n if 'in_reply_to_status' in data:\n self.on_status(data)\n elif 'delete' in data:\n delete = json.loads(data)['delete']['status']\n if self.on_delete(delete['id'], delete['user_id']) is False:\n return False\n elif 'limit' in data:\n if self.on_limit(json.loads(data)['limit']['track']) is False:\n return False\n elif 'warning' in data:\n warning = json.loads(data)['warnings']\n print warning['message']\n return False\n\n def on_status(self, status):\n self.output.write(status)\n\n self.counter += 1\n\n if self.counter \u0026gt;= 5000: # New file is started every 5,000 tweets, tagged with prefix and a timestamp.\n self.output.close()\n self.output = open('../Dissertation/stream_3_data/' + self.fprefix + '.' \n + time.strftime('%Y%m%d-%H%M%S') + '.json', 'w')\n self.counter = 0\n\n return\n\n def on_delete(self, status_id, user_id):\n self.delout.write( str(status_id) + \"\\n\")\n return\n\n def on_limit(self, track):\n sys.stderr.write(track + \"\\n\")\n return\n\n def on_error(self, status_code):\n sys.stderr.write('Error: ' + str(status_code) + \"\\n\")\n return True # Don't kill the stream\n\n def on_timeout(self):\n sys.stderr.write(\"Timeout, sleeping for 60 seconds...\\n\")\n time.sleep(60)\n return True # Don't kill the stream\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe part that seems to generate problems is when I try to use the streamlistener:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003etwitter_api = tweepy_oauth()\nQ = \"twitter.com\"\n\nlocations = [101.615161,3.08115,101.753663,3.167507,\n 115.421372,39.43277,117.501099,41.05999,\n 120.858322,30.69094,121.9733,31.86889]\n\n# Create a streaming API and set a timeout value of 60 seconds.\nstreaming_api = tweepy.streaming.Stream(twitter_api, SListener(), timeout=60)\n\n# Used infinite loop from https://github.com/ryanmcgrath/twython/issues/288 cause \n# I kept getting InComplete Read Error. Probably due to high volumes of tweets being sent to me at once\n\n#Endless loop\nwhile True: \n try: \n streaming_api.filter(follow=None, track=None, locations=locations, stall_warnings=True)\n except:\n e = sys.exc_info()[0] #Get exception info\n print 'ERROR:',e #Print exception info\n continue\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eMy code does run and works, but I encounter the following error occasionally, which stops my entire stream:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e---------------------------------------------------------------------------\nIOError Traceback (most recent call last)\n\u0026lt;ipython-input-4-fb45fa5d8307\u0026gt; in \u0026lt;module\u0026gt;()\n 34 streaming_api.filter(follow=None, track=None, locations=locations, stall_warnings=True)\n 35 except:\n 36 e = sys.exc_info()[0] #Get exception info\n ---\u0026gt; 37 print 'ERROR:',e #Print exception info\n 38 continue\n\n IOError: [Errno 22] Invalid argument\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe timing when the error appears is inconsistent - it ranges from 1h into the stream to an entire day into the stream. \u003c/p\u003e\n\n\u003cp\u003eI concluded that the issue is with the print statement because I replaced line 37 with \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eprint 'Error'\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eand the same error message appears. I am not sure how to proceed when even the basic print statement does not work - any help would be great.\u003c/p\u003e","answer_count":"0","comment_count":"2","creation_date":"2015-03-04 15:37:41.957 UTC","last_activity_date":"2015-03-04 15:37:41.957 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"4632696","post_type_id":"1","score":"2","tags":"python|twitter|tweepy|ioerror","view_count":"619"} {"id":"13204736","title":"Solr searching within a dictionary file","body":"\u003cp\u003eI was wondering if there is something out of the box from Solr which would allow me to search within a dictinary file (containing words and phrases) to returning all the phrases that contains my search terms.\u003c/p\u003e\n\n\u003cp\u003eFor example, my dictionary file could have:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ered car\nblue bike\nbig bike tires\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhen I search 'bike', I expect to see \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eblue bike\nbig bike tires\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAnd when I search 'big tires', i expect to see \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ebig bike tires\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eIs there anything from Solr that could support this? I was looking into the SpellCheckComponent but it would only support prefix searches.\u003c/p\u003e\n\n\u003cp\u003eBasically, I would like to achieve solr searches (token searching) but against a dictionary file (this same file would also be used for autosuggest).\u003c/p\u003e\n\n\u003cp\u003eAny advice or direction would be appreciated.\u003c/p\u003e","accepted_answer_id":"13212232","answer_count":"1","comment_count":"0","creation_date":"2012-11-03 00:12:01.037 UTC","favorite_count":"1","last_activity_date":"2012-11-03 18:33:07.613 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1757622","post_type_id":"1","score":"0","tags":"search|dictionary|solr","view_count":"174"} @@ -4098,13 +4098,13 @@ {"id":"20428885","title":"Selecting from p:dataTable list and show details to another p:dataTable list","body":"\u003cp\u003eI have a \u003ccode\u003etable\u003c/code\u003e showing \u003ccode\u003elist\u003c/code\u003e from a \u003ccode\u003ebean\u003c/code\u003e. When I click one of the \u003ccode\u003erows\u003c/code\u003e, I want to view details from another bean list what would I write to value to second detail \u003ccode\u003edatatable list\u003c/code\u003e ?\u003c/p\u003e\n\n\u003cp\u003eLet say I have a \u003ccode\u003ebean\u003c/code\u003e of list students \u003ccode\u003edatatable\u003c/code\u003e containing name, surname and numbers, when I click a row, on the second \u003ccode\u003edatatable\u003c/code\u003e there is a \u003ccode\u003ebean list\u003c/code\u003e of \u003ccode\u003estudent\u003c/code\u003e's \u003ccode\u003eaddress\u003c/code\u003e, \u003ccode\u003ecity\u003c/code\u003e and \u003ccode\u003ecountry\u003c/code\u003e\u003c/p\u003e\n\n\u003cp\u003eNow I can \u003ccode\u003eSystem.out.print\u003c/code\u003e the \u003ccode\u003eadress detail\u003c/code\u003e of \u003ccode\u003estudent\u003c/code\u003e when I click to \u003ccode\u003erow\u003c/code\u003e in student table but I can't show it on \u003ccode\u003edatatable\u003c/code\u003e \u003c/p\u003e\n\n\u003cp\u003eI'm asking how I can take the values to a \u003ccode\u003edatatable\u003c/code\u003e, what will be the value in \u003ccode\u003edatatable\u003c/code\u003e?\nThanks for your help\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;?xml version=\"1.0\" encoding=\"UTF-8\"?\u0026gt;\n\u0026lt;!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \n\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"\u0026gt;\n\u0026lt;html xmlns=\"http://www.w3.org/1999/xhtml\"\n xmlns:h=\"http://java.sun.com/jsf/html\"\n xmlns:f=\"http://java.sun.com/jsf/core\"\n xmlns:p=\"http://primefaces.org/ui\"\u0026gt;\n\u0026lt;h:head\u0026gt;\u0026lt;/h:head\u0026gt;\n\u0026lt;h:body\u0026gt;\n \u0026lt;f:view\u0026gt;\n \u0026lt;h:form id=\"form\"\u0026gt;\n \u0026lt;p:dataTable id=\"users\" var=\"user\" value=\"#{userOS.osList}\"\n paginator=\"true\" rows=\"10\" rowKey=\"#{user.kisiid}\"\n selection=\"#{userOS.selectedOS}\" selectionMode=\"single\"\u0026gt;\n \u0026lt;f:facet name=\"header\"\u0026gt; \n Kullanıcı detaylarını görmek için view butonuna tıklayınız\n \u0026lt;/f:facet\u0026gt;\n \u0026lt;p:ajax event=\"rowSelect\" listener=\"#{userOS.onRowSelect}\" update=\":form:display\"\n oncomplete=\"userDialog\" /\u0026gt;\n\n \u0026lt;p:column headerText=\"Student No\" sortBy=\"ogrencino\"\n filterBy=\"ogrencino\" id=\"ogrencino\"\u0026gt;\n \u0026lt;h:outputText value=\"#{user.ogrencino}\" /\u0026gt;\n \u0026lt;f:param name=\"kid\" value=\"#{userOS.osList.rowIndex}\" /\u0026gt;\n \u0026lt;/p:column\u0026gt;\n\n \u0026lt;p:column headerText=\"Name\" sortBy=\"ad\" filterBy=\"ad\" id=\"ad\"\u0026gt;\n \u0026lt;h:outputText value=\"#{user.ad}\" /\u0026gt;\n \u0026lt;/p:column\u0026gt;\n \u0026lt;p:column headerText=\"Surname\" sortBy=\"soyad\" filterBy=\"soyad\"\n id=\"soyad\"\u0026gt;\n \u0026lt;h:outputText value=\"#{user.soyad}\" /\u0026gt;\n \u0026lt;/p:column\u0026gt;\n \u0026lt;p:column headerText=\"Faculty\" sortBy=\"altbirim.ad\"\n filterBy=\"altbirim.ad\" id=\"altbirim\"\u0026gt;\n \u0026lt;h:outputText value=\"#{user.altbirim.ad}\" /\u0026gt;\n \u0026lt;/p:column\u0026gt;\n \u0026lt;p:column headerText=\"Department\" sortBy=\"bolum.ad\"\n filterBy=\"bolum.ad\" id=\"bolum\"\u0026gt;\n \u0026lt;h:outputText value=\"#{user.bolum.ad}\" /\u0026gt;\n \u0026lt;/p:column\u0026gt;\n \u0026lt;p:column headerText=\"Status\" sortBy=\"ogrencidurum.ad\"\n filterBy=\"ogrencidurum.ad\" id=\"ogrencidurum\"\u0026gt;\n \u0026lt;h:outputText value=\"#{user.ogrencidurum.ad}\" /\u0026gt;\n \u0026lt;/p:column\u0026gt;\n\n \u0026lt;f:facet name=\"footer\"\u0026gt;\n \u0026lt;/f:facet\u0026gt;\n \u0026lt;/p:dataTable\u0026gt;\n\n \u0026lt;p:panel id=\"dialog\" header=\"User Detail\" widgetVar=\"userDialog\"\u0026gt;\n\n \u0026lt;h:panelGrid id=\"panelgrid\" columns=\"2\" cellpadding=\"4\"\u0026gt;\n \u0026lt;p:dataTable id=\"display\" var=\"adres\" value=\"#{userOS.adresList}\"\u0026gt;\n \u0026lt;p:column headerText=\"Adres Tipi\"\u0026gt;\n \u0026lt;h:outputText value=\"#{adres.AddressType}\" /\u0026gt;\n \u0026lt;/p:column\u0026gt;\n \u0026lt;p:column headerText=\"Adres\"\u0026gt;\n \u0026lt;h:outputText value=\"#{adres.Address}\" /\u0026gt;\n \u0026lt;/p:column\u0026gt;\n \u0026lt;p:column headerText=\"İl\"\u0026gt;\n \u0026lt;h:outputText value=\"#{adres.City}\" /\u0026gt;\n \u0026lt;/p:column\u0026gt;\n \u0026lt;p:column headerText=\"Ülke\"\u0026gt;\n \u0026lt;h:outputText value=\"#{adres.Country}\" /\u0026gt;\n \u0026lt;/p:column\u0026gt;\n \u0026lt;/p:dataTable\u0026gt;\n \u0026lt;/h:panelGrid\u0026gt;\n\n \u0026lt;/p:panel\u0026gt;\n\n\n \u0026lt;/h:form\u0026gt;\n \u0026lt;/f:view\u0026gt;\n\u0026lt;/h:body\u0026gt;\n\u0026lt;/html\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAnd \u003ccode\u003eKisiInfoProcess.java\u003c/code\u003e code :\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epackage com.revir.process;\n\nimport java.io.Serializable;\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.Iterator;\nimport java.util.List;\n\nimport javax.faces.application.FacesMessage;\nimport javax.faces.bean.ManagedBean;\nimport javax.faces.bean.SessionScoped;\nimport javax.faces.context.FacesContext;\n\nimport org.hibernate.Session;\nimport org.hibernate.Transaction;\nimport org.primefaces.event.SelectEvent;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\n\nimport com.revir.managed.bean.AddressBean;\nimport com.revir.managed.bean.OgrenimSureciBean;\nimport com.revir.domain.Adres;\nimport com.revir.domain.AdresDAO;\nimport com.revir.domain.Kisi;\nimport com.revir.domain.KisiDAO;\nimport com.revir.domain.Kisiadresi;\nimport com.revir.domain.Ogrenimsureci;\nimport com.revir.domain.OgrenimsureciDAO;\nimport com.revir.domain.Ulke;\nimport com.revir.process.KisiInfoProcess;\n\n@ManagedBean(name = \"userOS\")\n@SessionScoped\npublic class KisiInfoProcess implements Serializable {\n\n /**\n * \n */\n private static final long serialVersionUID = 1L;\n\n private static final Logger log = LoggerFactory\n .getLogger(KisiInfoProcess.class);\n\n private List\u0026lt;OgrenimSureciBean\u0026gt; osList;\n\n private List\u0026lt;AddressBean\u0026gt; adresList;\n\n private List\u0026lt;AddressBean\u0026gt; adresListesi;\n\n public List\u0026lt;AddressBean\u0026gt; getAdresListesi() {\n return adresListesi;\n }\n\n public void setAdresListesi(List\u0026lt;AddressBean\u0026gt; adresListesi) {\n this.adresListesi = adresListesi;\n }\n\n private OgrenimSureciBean selectedOS;\n\n private AddressBean selectedAdres;\n\n public OgrenimSureciBean getSelectedOS() {\n return selectedOS;\n }\n\n public void setSelectedOS(OgrenimSureciBean selectedOS) {\n this.selectedOS = selectedOS;\n }\n\n public AddressBean getSelectedAdres() {\n return selectedAdres;\n }\n\n public void setSelectedAdres(AddressBean selectedAdres) {\n this.selectedAdres = selectedAdres;\n }\n\n public List\u0026lt;OgrenimSureciBean\u0026gt; getOsList() {\n OgrenimsureciDAO ogrenimsureciDAO = new OgrenimsureciDAO();\n\n List\u0026lt;OgrenimSureciBean\u0026gt; osList = new ArrayList\u0026lt;OgrenimSureciBean\u0026gt;();\n\n for (Iterator i = ogrenimsureciDAO.findByMezunOgrenciler((short) 8)\n .iterator(); i.hasNext();) {\n Ogrenimsureci og = (Ogrenimsureci) i.next();\n OgrenimSureciBean osBean = new OgrenimSureciBean();\n\n osBean.setBolum(og.getBolum());\n osBean.setAd(og.getKisiByKisiid().getAd());\n osBean.setSoyad(og.getKisiByKisiid().getSoyad());\n osBean.setAltbirim(og.getAltbirim());\n osBean.setOgrencino(og.getOgrencino());\n osBean.setKisiid(og.getKisiByKisiid().getKisiid());\n osBean.setOgrencidurum(og.getOgrencidurum());\n\n osList.add(osBean);\n System.out.println(\"osBean : \" + osBean.toString());\n\n }\n return osList;\n }\n\n public void setOsList(List\u0026lt;OgrenimSureciBean\u0026gt; osList) {\n this.osList = osList;\n }\n\n public void onRowSelect(SelectEvent event) {\n\n System.out.println(\"On Row Select Metodu çalıştı\");\n\n try {\n getAdresList();\n } catch (Exception e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n }\n\n }\n\n public List\u0026lt;AddressBean\u0026gt; getAdresList() throws Exception {\n\n if (getSelectedOS() != null) {\n log.debug(\"PersonalInfoProcess - getAddressInfo - Start\");\n List\u0026lt;AddressBean\u0026gt; adresList = new ArrayList\u0026lt;AddressBean\u0026gt;();\n\n KisiDAO kisiDAO = new KisiDAO();\n AdresDAO adresDAO = new AdresDAO();\n\n Long kisiid = getSelectedOS().getKisiid();\n System.out.println(\"kisiid :\" + kisiid);\n Kisi kisi = kisiDAO.findById(kisiid);\n\n for (Iterator i = kisi.getKisiadresis().iterator(); i.hasNext();) {\n\n Kisiadresi kisiAdresi = (Kisiadresi) i.next();\n System.out.println(\"i :\" + i);\n Adres tmpAdres = adresDAO.findById(kisiAdresi.getId()\n .getAdresid());\n\n if (tmpAdres != null) {\n AddressBean address = new AddressBean(kisiid);\n\n if (tmpAdres.getAdresturu() == null) {\n address.setAddressType(null);\n } else {\n address.setAddressType(tmpAdres.getAdresturu().getAd());\n System.out.println(\"Adres Türü:\" +tmpAdres.getAdresturu().getAd());\n }\n\n address.setAddress(tmpAdres.getAdres());\n System.out.println(\"Şehir:\" +tmpAdres.getAdres());\n\n if (tmpAdres.getIl() == null) {\n address.setCity(null);\n } else {\n address.setCity(tmpAdres.getIl().getAd());\n System.out.println(\"Şehir:\" +tmpAdres.getIl().getAd());\n }\n\n if (tmpAdres.getUlke() == null) {\n address.setCountry(null);\n } else {\n address.setCountry(tmpAdres.getUlke().getAd());\n System.out.println(\"Ülke:\" +tmpAdres.getUlke().getAd());\n }\n\n adresList.add(address);\n\n System.out.println(\"adres\" + address);\n System.out.println(\"adreslist\" + adresList);\n }\n\n log.debug(\"PersonalInfoProcess - getAddressInfo - End / Returning\");\n }\n }\n return adresList;\n }\n\n public void setAdresList(List\u0026lt;AddressBean\u0026gt; adresList) {\n this.adresList = adresList;\n }\n\n}\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"0","comment_count":"3","creation_date":"2013-12-06 16:30:57.407 UTC","last_activity_date":"2016-10-26 10:05:21.777 UTC","last_edit_date":"2016-10-26 10:05:21.777 UTC","last_editor_display_name":"","last_editor_user_id":"4478047","owner_display_name":"","owner_user_id":"3070277","post_type_id":"1","score":"1","tags":"jsf|jsf-2|primefaces","view_count":"724"} {"id":"38386109","title":"How to expand to Labels having height in ratio 2:1?","body":"\u003cp\u003eI'm new to xcode storyboard. I have a viewcontroller that contain two label of same width, but \u003ccode\u003elabel 1\u003c/code\u003e is 80px in height and \u003ccode\u003elabel 2\u003c/code\u003e is 40px in height. \u003c/p\u003e\n\n\u003cp\u003eI want those two labels to auto expand in height depending on whether they are displayed in horizontal or vertical size class, but I want \u003ccode\u003elabel 1\u003c/code\u003e and \u003ccode\u003elabel 2\u003c/code\u003e to keep their height ratio of \u003ccode\u003e2:1\u003c/code\u003e. \u003c/p\u003e\n\n\u003cp\u003eI know the steps to take if I wan't both labels to be the same height (control drag from one label to another, click equal height, and go to size inspector and set their content hugging priority to 200) , but I don't know the steps to take when I want the labels' height ratio to be \u003ccode\u003e2:1\u003c/code\u003e and to auto expand in height depending on whether it is displayed horizontally or vertically.\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"https://i.stack.imgur.com/vUuC3.png\" rel=\"nofollow noreferrer\"\u003e\u003cimg src=\"https://i.stack.imgur.com/vUuC3.png\" alt=\"enter image description here\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eI want the two labels to expand, not the numbers below the labels\u003c/p\u003e","accepted_answer_id":"38387114","answer_count":"3","comment_count":"6","creation_date":"2016-07-15 00:21:46.04 UTC","last_activity_date":"2016-12-19 10:21:38.05 UTC","last_edit_date":"2016-12-19 10:21:38.05 UTC","last_editor_display_name":"","last_editor_user_id":"2227743","owner_display_name":"","owner_user_id":"5581182","post_type_id":"1","score":"1","tags":"ios|xcode|storyboard|uilabel","view_count":"82"} {"id":"33663801","title":"How do I customize default error message from spring @Valid validation?","body":"\u003cp\u003eDTO:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epublic class User {\n\n @NotNull\n private String name;\n\n @NotNull\n private String password;\n\n //..\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eController:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e@RequestMapping(value = \"/user\", method = RequestMethod.POST)\npublic ResponseEntity\u0026lt;String\u0026gt; saveUser(@Valid @RequestBody User user) {\n //..\n return new ResponseEntity\u0026lt;\u0026gt;(HttpStatus.OK);\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eDefault json error:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e{\"timestamp\":1417379464584,\"status\":400,\"error\":\"Bad Request\",\"exception\":\"org.springframework.web.bind.MethodArgumentNotValidException\",\"message\":\"Validation failed for argument at index 0 in method: public org.springframework.http.ResponseEntity\u0026lt;demo.User\u0026gt; demo.UserController.saveUser(demo.User), with 2 error(s): [Field error in object 'user' on field 'name': rejected value [null]; codes [NotNull.user.name,NotNull.name,NotNull.java.lang.String,NotNull]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [user.name,name]; arguments []; default message [name]]; default message [may not be null]],\"path\":\"/user\"}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI would like to have my custom json for each error occured. How do I accomplish that?\u003c/p\u003e","accepted_answer_id":"33664636","answer_count":"4","comment_count":"0","creation_date":"2015-11-12 03:15:01.167 UTC","favorite_count":"5","last_activity_date":"2017-04-06 16:25:11.81 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"5470370","post_type_id":"1","score":"10","tags":"json|spring","view_count":"10444"} -{"id":"42739440","title":"@PostConstruct not called in my jsf page","body":"\u003cp\u003eI have seen many questions around the same topic but none of them helped. In fact I am beginning learning primefaces.\u003c/p\u003e\n\n\u003cp\u003eHere is my \u003cstrong\u003exhtml\u003c/strong\u003e page (template):\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;?xml version='1.0' encoding='UTF-8' ?\u0026gt;\n\u0026lt;!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"\u0026gt;\n\u0026lt;html xmlns=\"http://www.w3.org/1999/xhtml\"\n xmlns:ui=\"http://xmlns.jcp.org/jsf/facelets\"\n xmlns:h=\"http://xmlns.jcp.org/jsf/html\"\n xmlns:p=\"http://primefaces.org/ui\"\n xmlns:f=\"http://xmlns.jcp.org/jsf/core\"\u0026gt;\n \u0026lt;f:view contentType=\"text/html\" locale=\"en\"\u0026gt;\n \u0026lt;h:head\u0026gt;\n \u0026lt;title\u0026gt;\u0026lt;ui:insert name=\"title\"\u0026gt;Master Data\u0026lt;/ui:insert\u0026gt;\u0026lt;/title\u0026gt;\n \u0026lt;h:outputStylesheet library=\"css\" name=\"layout.css\"/\u0026gt;\n \u0026lt;h:outputStylesheet library=\"css\" name=\"jsfcrud.css\"/\u0026gt;\n \u0026lt;h:outputScript library=\"js\" name=\"jsfcrud.js\"/\u0026gt;\n \u0026lt;/h:head\u0026gt;\n \u0026lt;h:body\u0026gt;\n \u0026lt;p:growl id=\"growl\" life=\"3000\" /\u0026gt;\n \u0026lt;h:panelGroup layout=\"block\" styleClass=\"slogan\"\u0026gt;\n \u0026lt;h:outputText value=\"Master Data Web module for single line v 1.0\"/\u0026gt;\n \u0026lt;/h:panelGroup\u0026gt;\n \u0026lt;h:form id=\"mainForm\" prependId=\"false\"\u0026gt;\n \u0026lt;h:panelGrid columns=\"2\" columnClasses=\"chaptersMenuColumn,chaptersContentColumn\"\u0026gt;\n\n \u0026lt;h:form\u0026gt;\n \u0026lt;f:ajax render=\":content\"\u0026gt;\n \u0026lt;p:menu\u0026gt;\n \u0026lt;p:submenu label=\"Master Data Sections\"\u0026gt;\n \u0026lt;p:menuitem value=\"KPI\" action=\"#{KpiBean.setPage('create')}\" /\u0026gt;\n \u0026lt;p:menuitem value=\"Queues\" url=\"\"/\u0026gt;\n \u0026lt;p:menuitem value=\"Causes\" url=\"\"/\u0026gt;\n \u0026lt;p:menuitem value=\"SubCauses\" url=\"\"/\u0026gt;\n \u0026lt;/p:submenu\u0026gt;\n \u0026lt;/p:menu\u0026gt; \n \u0026lt;/f:ajax\u0026gt;\n \u0026lt;/h:form\u0026gt;\n\n \u0026lt;h:panelGroup id=\"content\" layout=\"block\"\u0026gt;\n \u0026lt;ui:include src = \"../views/#{KpiBean.page}.xhtml\"/\u0026gt;\n \u0026lt;/h:panelGroup\u0026gt;\n \u0026lt;/h:panelGrid\u0026gt;\n \u0026lt;/h:form\u0026gt;\n \u0026lt;/h:body\u0026gt;\n \u0026lt;/f:view\u0026gt;\n\u0026lt;/html\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAnd here my Bean:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e@Named\n@SessionScoped\npublic class KpiBean implements Serializable {\n\n private String page= \"View\";\n\n @PostConstruct\n public void init() {\n page = \"View\"; // Default include.\n }\n\n public String getPage() {\n return page;\n }\n\n public void setPage(String page) {\n this.page = page;\n }\n\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhen I launch my Glassfish server and deploy the build I get that error:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ejavax.faces.view.facelets.TagAttributeException: /templates/template.xhtml @47,78 \u0026lt;ui:include src=\"../views/#{KpiBean.page}.xhtml\"\u0026gt; Invalid path : ../views/.xhtml\n\n at com.sun.faces.facelets.tag.ui.IncludeHandler.apply(IncludeHandler.java:129)\n\n at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"42739497","answer_count":"1","comment_count":"0","creation_date":"2017-03-11 19:13:34.52 UTC","last_activity_date":"2017-03-11 19:19:23.04 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1807373","post_type_id":"1","score":"-2","tags":"java|jsf|primefaces|jsf-2","view_count":"220"} +{"id":"42739440","title":"@PostConstruct not called in my jsf page","body":"\u003cp\u003eI have seen many questions around the same topic but none of them helped. In fact I am beginning learning primefaces.\u003c/p\u003e\n\n\u003cp\u003eHere is my \u003cstrong\u003exhtml\u003c/strong\u003e page (template):\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;?xml version='1.0' encoding='UTF-8' ?\u0026gt;\n\u0026lt;!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"\u0026gt;\n\u0026lt;html xmlns=\"http://www.w3.org/1999/xhtml\"\n xmlns:ui=\"http://xmlns.jcp.org/jsf/facelets\"\n xmlns:h=\"http://xmlns.jcp.org/jsf/html\"\n xmlns:p=\"http://primefaces.org/ui\"\n xmlns:f=\"http://xmlns.jcp.org/jsf/core\"\u0026gt;\n \u0026lt;f:view contentType=\"text/html\" locale=\"en\"\u0026gt;\n \u0026lt;h:head\u0026gt;\n \u0026lt;title\u0026gt;\u0026lt;ui:insert name=\"title\"\u0026gt;Cluster Manager Data\u0026lt;/ui:insert\u0026gt;\u0026lt;/title\u0026gt;\n \u0026lt;h:outputStylesheet library=\"css\" name=\"layout.css\"/\u0026gt;\n \u0026lt;h:outputStylesheet library=\"css\" name=\"jsfcrud.css\"/\u0026gt;\n \u0026lt;h:outputScript library=\"js\" name=\"jsfcrud.js\"/\u0026gt;\n \u0026lt;/h:head\u0026gt;\n \u0026lt;h:body\u0026gt;\n \u0026lt;p:growl id=\"growl\" life=\"3000\" /\u0026gt;\n \u0026lt;h:panelGroup layout=\"block\" styleClass=\"slogan\"\u0026gt;\n \u0026lt;h:outputText value=\"Cluster Manager Data Web module for single line v 1.0\"/\u0026gt;\n \u0026lt;/h:panelGroup\u0026gt;\n \u0026lt;h:form id=\"mainForm\" prependId=\"false\"\u0026gt;\n \u0026lt;h:panelGrid columns=\"2\" columnClasses=\"chaptersMenuColumn,chaptersContentColumn\"\u0026gt;\n\n \u0026lt;h:form\u0026gt;\n \u0026lt;f:ajax render=\":content\"\u0026gt;\n \u0026lt;p:menu\u0026gt;\n \u0026lt;p:submenu label=\"Cluster Manager Data Sections\"\u0026gt;\n \u0026lt;p:menuitem value=\"KPI\" action=\"#{KpiBean.setPage('create')}\" /\u0026gt;\n \u0026lt;p:menuitem value=\"Queues\" url=\"\"/\u0026gt;\n \u0026lt;p:menuitem value=\"Causes\" url=\"\"/\u0026gt;\n \u0026lt;p:menuitem value=\"SubCauses\" url=\"\"/\u0026gt;\n \u0026lt;/p:submenu\u0026gt;\n \u0026lt;/p:menu\u0026gt; \n \u0026lt;/f:ajax\u0026gt;\n \u0026lt;/h:form\u0026gt;\n\n \u0026lt;h:panelGroup id=\"content\" layout=\"block\"\u0026gt;\n \u0026lt;ui:include src = \"../views/#{KpiBean.page}.xhtml\"/\u0026gt;\n \u0026lt;/h:panelGroup\u0026gt;\n \u0026lt;/h:panelGrid\u0026gt;\n \u0026lt;/h:form\u0026gt;\n \u0026lt;/h:body\u0026gt;\n \u0026lt;/f:view\u0026gt;\n\u0026lt;/html\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAnd here my Bean:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e@Named\n@SessionScoped\npublic class KpiBean implements Serializable {\n\n private String page= \"View\";\n\n @PostConstruct\n public void init() {\n page = \"View\"; // Default include.\n }\n\n public String getPage() {\n return page;\n }\n\n public void setPage(String page) {\n this.page = page;\n }\n\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhen I launch my Glassfish server and deploy the build I get that error:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ejavax.faces.view.facelets.TagAttributeException: /templates/template.xhtml @47,78 \u0026lt;ui:include src=\"../views/#{KpiBean.page}.xhtml\"\u0026gt; Invalid path : ../views/.xhtml\n\n at com.sun.faces.facelets.tag.ui.IncludeHandler.apply(IncludeHandler.java:129)\n\n at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"42739497","answer_count":"1","comment_count":"0","creation_date":"2017-03-11 19:13:34.52 UTC","last_activity_date":"2017-03-11 19:19:23.04 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1807373","post_type_id":"1","score":"-2","tags":"java|jsf|primefaces|jsf-2","view_count":"220"} {"id":"35312030","title":"Undefined property in an \"hasOne\" relation","body":"\u003cp\u003eI tried a lot of possibilities and I have all the time the same error.\u003c/p\u003e\n\n\u003cp\u003eMaybe you should help me... Hope so! I am working on Laravel 4.2\u003c/p\u003e\n\n\u003cp\u003eI have two tables :\u003c/p\u003e\n\n\u003cp\u003eusers :\u003c/p\u003e\n\n\u003cp\u003e$table-\u003eincrements('id');\n $table-\u003estring('email', 50);\n...\u003c/p\u003e\n\n\u003cp\u003eaccount :\u003c/p\u003e\n\n\u003cp\u003e$table-\u003eincrements('id');\n $table-\u003einteger('user_id')-\u003eunsigned();\u003c/p\u003e\n\n\u003cp\u003eI have 2 models :\u003c/p\u003e\n\n\u003cp\u003eUser :\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epublic function account()\n {\n return $this-\u0026gt;hasOne('Account', 'id','user_id');\n }\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAccount :\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epublic function user()\n {\n return $this-\u0026gt;belongsTo('User', 'id');\n }\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eNow I would like to get the user_id in the account table by the relationship :\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e$userId = Auth::id();\n$account = User::find($userId)-\u0026gt;Account()-\u0026gt;user_id;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI get this error : ErrorException\nUndefined property: Illuminate\\Database\\Eloquent\\Relations\\HasOne::$user_id\u003c/p\u003e\n\n\u003cp\u003eCould you help me?\u003c/p\u003e\n\n\u003cp\u003eThank you in advance.\u003c/p\u003e","answer_count":"2","comment_count":"0","creation_date":"2016-02-10 10:02:37.513 UTC","last_activity_date":"2017-01-11 21:04:56.057 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"4266404","post_type_id":"1","score":"0","tags":"laravel-4|eloquent|one-to-one","view_count":"984"} {"id":"43122509","title":"Applying JsonDictionary attribute to dictionary","body":"\u003cp\u003eIf I try to add the JsonDictionary attribute to a .net Dictionary(Of Integer, MyClass), the compiler tells me, that the attribute could not be applied. Why is this?\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;JsonDictionary()\u0026gt;\nPublic ReadOnly Property monatswerte As Dictionary(Of Integer, MyClass)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI basically couldn't find any examples of how to use the JsonDictionary online.\u003c/p\u003e","answer_count":"2","comment_count":"2","creation_date":"2017-03-30 15:45:21.483 UTC","last_activity_date":"2017-10-15 16:31:16.667 UTC","last_edit_date":"2017-03-30 18:36:26.767 UTC","last_editor_display_name":"","last_editor_user_id":"3744182","owner_display_name":"","owner_user_id":"3254598","post_type_id":"1","score":"1","tags":"c#|.net|vb.net|json.net","view_count":"162"} {"id":"41965355","title":"VSCode debugging of Electron Main Process bundled with Webpack 2","body":"\u003cp\u003eMy Electron main process is written with TypeScript and bundled Webpack 2.\u003c/p\u003e\n\n\u003cp\u003eTranspilation is done through \u003ccode\u003ets-loader\u003c/code\u003e and \u003ccode\u003ebabel-loader\u003c/code\u003e.\u003c/p\u003e\n\n\u003cp\u003eDevelopment mode starts \u003ccode\u003ewebpack --watch\u003c/code\u003e with the \u003ca href=\"https://github.com/Black-Monolith/SuperNova/blob/f65db6384a18245273b13b4041a8c2f2ab5c8aac/webpack/targets/webpack.main.js\" rel=\"nofollow noreferrer\"\u003emain process configuration\u003c/a\u003e.\u003c/p\u003e\n\n\u003ch1\u003eProblem\u003c/h1\u003e\n\n\u003cp\u003eI cannot debug the main process using VSCode debugger.\u003c/p\u003e\n\n\u003cp\u003eAdding a breakpoint in the entry point \u003ccode\u003esrc/main/index.ts\u003c/code\u003e does not have any effect.\u003c/p\u003e\n\n\u003ch1\u003eConfiguration\u003c/h1\u003e\n\n\u003ch3\u003e\u003ca href=\"https://github.com/Black-Monolith/SuperNova/blob/f65db6384a18245273b13b4041a8c2f2ab5c8aac/.vscode/launch.json\" rel=\"nofollow noreferrer\"\u003e\u003ccode\u003e.vscode/launch.js\u003c/code\u003e\u003c/a\u003e\u003c/h3\u003e\n\n\u003cpre\u003e\u003ccode\u003e{\n \"configurations\": [\n {\n \"name\": \"Debug Main Process\",\n \"type\": \"node\",\n \"request\": \"launch\",\n \"cwd\": \"${workspaceRoot}\",\n \"runtimeExecutable\": \"${workspaceRoot}/node_modules/.bin/electron\",\n \"runtimeArgs\": [\n \"${workspaceRoot}\",\n \"--remote-debugging-port=9222\"\n ],\n \"sourceMaps\": true\n }\n ]\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003ch3\u003e\u003ca href=\"https://github.com/Black-Monolith/SuperNova/blob/f65db6384a18245273b13b4041a8c2f2ab5c8aac/webpack/targets/webpack.main.js\" rel=\"nofollow noreferrer\"\u003e\u003ccode\u003ewebpack.development.js\u003c/code\u003e\u003c/a\u003e\u003c/h3\u003e\n\n\u003cpre\u003e\u003ccode\u003e{\n target: 'electron',\n devtool: 'source-map',\n\n entry: {\n main: join(__dirname, 'src/main/index')\n },\n\n output: {\n path: join(__dirname, 'app'),\n filename: '[name].js'\n }\n}\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"41969144","answer_count":"2","comment_count":"0","creation_date":"2017-01-31 18:53:53.863 UTC","last_activity_date":"2017-02-01 12:37:23.303 UTC","last_edit_date":"2017-02-01 12:37:23.303 UTC","last_editor_display_name":"","last_editor_user_id":"1914206","owner_display_name":"","owner_user_id":"1914206","post_type_id":"1","score":"2","tags":"debugging|typescript|webpack|visual-studio-code|electron","view_count":"503"} {"id":"30910780","title":"HTML/CSS need disable margin","body":"\u003cp\u003eI spent almost half hour by searching where to disable margin for submenu. Here is an examples. \n\u003cimg src=\"https://i.stack.imgur.com/YCq6d.png\" alt=\"enter image description here\"\u003e\u003c/p\u003e\n\n\u003cp\u003eI did margin for menu links, and submenu have been affected too. BUT i dont need that. SO i cant find where to change submenu margin to be zero. You can find website in\u003c/p\u003e","accepted_answer_id":"30910827","answer_count":"5","comment_count":"1","creation_date":"2015-06-18 08:55:55.287 UTC","last_activity_date":"2015-06-18 09:14:22.023 UTC","last_edit_date":"2015-06-18 09:11:23.83 UTC","last_editor_display_name":"","last_editor_user_id":"4825782","owner_display_name":"","owner_user_id":"4825782","post_type_id":"1","score":"0","tags":"html|css","view_count":"38"} {"id":"13441918","title":"Can one class implement both subject and observer sections of the observer design pattern?","body":"\u003cp\u003eI'm designing an enemy framework for java and working with observer. I'm wondering if it is possible | worth the effort to have one class implement both observer and subject in java?\u003c/p\u003e\n\n\u003cp\u003eI want to have an enemy interface which implements both subject and observer so that the enemies within a certain distance of each other can alert each other if a player or enemy is sighted.\u003c/p\u003e\n\n\u003cp\u003eIs there a better pattern to use here? \u003c/p\u003e","accepted_answer_id":"13442142","answer_count":"1","comment_count":"0","creation_date":"2012-11-18 16:15:59.743 UTC","favorite_count":"0","last_activity_date":"2012-11-18 16:43:16.337 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1336484","post_type_id":"1","score":"1","tags":"java|observer-pattern","view_count":"638"} -{"id":"25719468","title":"Retrieve group of varbinary images in MVC","body":"\u003cp\u003eI have images stored in a \u003ccode\u003evarbinary\u003c/code\u003e column in my database in ASP.NET MVC. I tried to retrieve them using a foreach loop. \u003c/p\u003e\n\n\u003cp\u003eI have written content in controller like this\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e {\n db = new VideoContext();\n ViewData[\"VideoMenu\"] = db.VideosMaster.ToList();\n }\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eand try to display it in view like this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eforeach (var v in (IEnumerable\u0026lt;VideoJug.Models.VideosMaster\u0026gt;)ViewData[\"VideoMenu\"])\n{\n \u0026lt;img src=\"@String.Format(\"data:image/jpg;base64,{0}\", \n Convert.ToBase64String(v.VideoThumbnail));\" width=\"100\" height=\"100\" /\u0026gt;\n} \n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ebut I'm getting an error:\u003c/p\u003e\n\n\u003cblockquote\u003e\n \u003cp\u003eValue cannot be null.Parameter name: inArray\u003c/p\u003e\n\u003c/blockquote\u003e\n\n\u003cp\u003eCould anyone help me with this?\u003c/p\u003e","accepted_answer_id":"25721183","answer_count":"1","comment_count":"0","creation_date":"2014-09-08 07:40:45.077 UTC","favorite_count":"0","last_activity_date":"2014-09-08 09:33:22.457 UTC","last_edit_date":"2014-09-08 07:56:41.11 UTC","last_editor_display_name":"","last_editor_user_id":"13302","owner_display_name":"","owner_user_id":"4018304","post_type_id":"1","score":"0","tags":"asp.net-mvc|model-view-controller|binary","view_count":"623"} +{"id":"25719468","title":"Retrieve group of varbinary images in MVC","body":"\u003cp\u003eI have images stored in a \u003ccode\u003evarbinary\u003c/code\u003e column in my database in ASP.NET MVC. I tried to retrieve them using a foreach loop. \u003c/p\u003e\n\n\u003cp\u003eI have written content in controller like this\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e {\n db = new VideoContext();\n ViewData[\"VideoMenu\"] = db.VideosClusterManager.ToList();\n }\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eand try to display it in view like this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eforeach (var v in (IEnumerable\u0026lt;VideoJug.Models.VideosClusterManager\u0026gt;)ViewData[\"VideoMenu\"])\n{\n \u0026lt;img src=\"@String.Format(\"data:image/jpg;base64,{0}\", \n Convert.ToBase64String(v.VideoThumbnail));\" width=\"100\" height=\"100\" /\u0026gt;\n} \n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ebut I'm getting an error:\u003c/p\u003e\n\n\u003cblockquote\u003e\n \u003cp\u003eValue cannot be null.Parameter name: inArray\u003c/p\u003e\n\u003c/blockquote\u003e\n\n\u003cp\u003eCould anyone help me with this?\u003c/p\u003e","accepted_answer_id":"25721183","answer_count":"1","comment_count":"0","creation_date":"2014-09-08 07:40:45.077 UTC","favorite_count":"0","last_activity_date":"2014-09-08 09:33:22.457 UTC","last_edit_date":"2014-09-08 07:56:41.11 UTC","last_editor_display_name":"","last_editor_user_id":"13302","owner_display_name":"","owner_user_id":"4018304","post_type_id":"1","score":"0","tags":"asp.net-mvc|model-view-controller|binary","view_count":"623"} {"id":"37599629","title":"I want to create C# Web App which can create excel report from different SQL database only in one click.is there any good suggestion?","body":"\u003cp\u003eI want to create C# Web App which can create excel report from different SQL database only in one click.is there any good suggestion? \u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2016-06-02 18:32:19.903 UTC","last_activity_date":"2016-06-03 05:34:09.293 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"6273732","post_type_id":"1","score":"0","tags":"c#|sql|asp.net|asp.net-mvc|web","view_count":"53"} {"id":"44944192","title":"m2e Embedded Runtime: Global Settings File read from wrong location","body":"\u003cp\u003eIn Eclipse, I have configured a global settings file under \u003ccode\u003ePreferences \u0026gt; Maven \u0026gt; User Settings \u0026gt; Global Settings\u003c/code\u003e. This file contains a mirror configuration for repositories.\u003c/p\u003e\n\n\u003cp\u003eWhen Eclipse attempts to download dependencies, the settings in this file are used. When starting a maven build via \u003ccode\u003eRun As \u0026gt; Maven build\u003c/code\u003e, dependency resolution errors occur. When starting a Maven runtime outside from Eclipse, everything works as expected.\u003c/p\u003e\n\n\u003cp\u003eI enabled debug output and found the following line when starting a Maven build inside eclipse.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e[DEBUG] Reading global settings from EMBEDDED\\conf\\settings.xml\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003cstrong\u003eWhy is the configured global config file not used when starting a build in Eclipse?\u003c/strong\u003e What confuses me especially is Eclipse does use these settings when downloading dependencies in the workspace.\u003c/p\u003e\n\n\u003cp\u003eInterestingly, a configured user settings file \u003cem\u003eis\u003c/em\u003e used when starting a build from within Eclipse. \u003c/p\u003e","answer_count":"0","comment_count":"0","creation_date":"2017-07-06 08:56:56.207 UTC","last_activity_date":"2017-07-06 08:56:56.207 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"7677308","post_type_id":"1","score":"1","tags":"eclipse|maven|m2e","view_count":"57"} {"id":"12707902","title":"Having trouble converting from string to LPCTSTR","body":"\u003cp\u003eI am trying to put some text in a Static Text widget, like this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003em_StartupTime.SetWindowText(someStringVariable);\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAnd get an error:\u003c/p\u003e\n\n\u003cblockquote\u003e\n \u003cp\u003e'CWnd::SetWindowTextA' : cannot convert parameter 1 from 'std::string' to 'LPCTSTR'\u003c/p\u003e\n\u003c/blockquote\u003e\n\n\u003cp\u003eI have tried using the \u003ccode\u003ec.str()\u003c/code\u003e method, but when I do, the program compiles fine, but crashes at run-time, throwing an error:\u003c/p\u003e\n\n\u003cp\u003e\u003cimg src=\"https://i.stack.imgur.com/dnQVG.jpg\" alt=\"The error\"\u003e\u003c/p\u003e\n\n\u003cp\u003eSo I'm figuring out if the problem is related to the conversion, or anything other than that?\u003c/p\u003e\n\n\u003cp\u003eUsing CString doesn't solve the problem, and I have tried switching from Unicode charcter set to Multi-Byte, with no success. Oh, I am developing in MFC.\u003c/p\u003e\n\n\u003cp\u003eEDIT: Found a solution! I used the CString class.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003estring a = \"smth\";\nCString str(a.c_str());\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"12710669","answer_count":"2","comment_count":"5","creation_date":"2012-10-03 11:51:46.367 UTC","last_activity_date":"2012-10-21 11:36:55.337 UTC","last_edit_date":"2012-10-21 11:36:55.337 UTC","last_editor_display_name":"","last_editor_user_id":"904365","owner_display_name":"","owner_user_id":"1258091","post_type_id":"1","score":"0","tags":"c++|string|mfc","view_count":"1924"} @@ -4198,7 +4198,7 @@ {"id":"35753951","title":"Manually register a user in Laravel","body":"\u003cp\u003eIs it possible to manually register a user (with artisan?) rather than via the auth registration page?\u003c/p\u003e\n\n\u003cp\u003eI only need a handful of user accounts and wondered if there's a way to create these without having to set up the registration controllers and views.\u003c/p\u003e","accepted_answer_id":"35754495","answer_count":"4","comment_count":"1","creation_date":"2016-03-02 17:18:24.357 UTC","favorite_count":"4","last_activity_date":"2017-09-26 20:58:29.293 UTC","last_edit_date":"2016-03-02 17:32:30.237 UTC","last_editor_display_name":"","last_editor_user_id":"2094178","owner_display_name":"","owner_user_id":"1990849","post_type_id":"1","score":"10","tags":"php|laravel|laravel-5|laravel-5.2","view_count":"7437"} {"id":"14047896","title":"Date(value) and new Date(value)","body":"\u003cblockquote\u003e\n \u003cp\u003e\u003cstrong\u003ePossible Duplicate:\u003c/strong\u003e\u003cbr\u003e\n \u003ca href=\"https://stackoverflow.com/questions/3505693/difference-between-datedatestring-and-new-datedatestring\"\u003eDifference between Date(dateString) and new Date(dateString)\u003c/a\u003e \u003c/p\u003e\n\u003c/blockquote\u003e\n\n\n\n\u003cp\u003eWhat is the difference between\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eDate(1356567322705)\n\"Thu Dec 27 2012 03:13:37 GMT+0300 (Kaliningrad Standard Time)\"\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eand\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003enew Date(1356567322705)\nThu Dec 27 2012 03:15:22 GMT+0300 (Kaliningrad Standard Time)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eand why there is a gap of about 2 minutes?\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2012-12-27 00:16:51.137 UTC","favorite_count":"1","last_activity_date":"2012-12-27 00:18:36.567 UTC","last_edit_date":"2017-05-23 12:04:32.633 UTC","last_editor_display_name":"","last_editor_user_id":"-1","owner_display_name":"","owner_user_id":"377133","post_type_id":"1","score":"0","tags":"javascript|date","view_count":"456"} {"id":"18192990","title":"Using a $.get() in .Net MVC without a controller","body":"\u003cp\u003eIn .Net MVC if I'm using the JQuery \u003ccode\u003e.get()\u003c/code\u003e method to grab a file from the server would I still need to write up a \u003ccode\u003eRenderAction\u003c/code\u003e on a controller method to display its contents? Example JQuery: \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003efunction RenderPartialView(view, contentcontainer, maskcontainer, params) {\n $.get(view, params, function (data) {\n $(\"#\" + contentcontainer).html(data);\n $(maskcontainer).unmask();\n });\n}\n\n function displayExpandedView() {\n $('.expand-btn').on('click', function () {\n $(\".expanded-view\").modal();\n RenderPartialView(\"../some_dir/SomeView\", \"expanded-view\", \"#expanded-view\", null);\n })\n }\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eSo when I run the displayExpandedView() function I want to fill a div that is acting as a modal with the contents of the SomeView file. When I currently try to do this with in my application the server responds back with a 404 error saying the file cannot be found, even thought he path to it is correct. Using this method would I still need to have a controller return \u003ccode\u003ePartialView()\u003c/code\u003e? I was under the impression I would not. \u003c/p\u003e","accepted_answer_id":"18193170","answer_count":"2","comment_count":"6","creation_date":"2013-08-12 17:24:19.207 UTC","last_activity_date":"2013-08-12 17:35:23.25 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1211604","post_type_id":"1","score":"0","tags":"jquery|asp.net-mvc|asp.net-mvc-4","view_count":"179"} -{"id":"2951872","title":"How can i design a DB where the user can define the fields and types of a detail table in a M-D relationship?","body":"\u003cp\u003eMy application has one table called 'events' and each event has approx 30 standard fields, but also user defined fields that could be any name or type, in an 'eventdata' table. Users can define these event data tables, by specifying x number of fields (either text/double/datetime/boolean) and the names of these fields. This 'eventdata' (table) can be different for each 'event'.\u003c/p\u003e\n\n\u003cp\u003eMy current approach is to create a lookup table for the definitions. So if i need to query all 'event' and 'eventdata' per record, i do so in a M-D relaitionship using two queries (i.e. select * from events, then for each record in 'events', select * from 'some table').\u003c/p\u003e\n\n\u003cp\u003eIs there a better approach to doing this? I have implemented this so far, but most of my queries require two distinct calls to the DB - i cannot simply join my master 'events' table with different 'eventdata' tables for each record in in 'events'.\u003c/p\u003e\n\n\u003cp\u003eI guess my main question is: can i join my master table with different detail tables for each record? \u003c/p\u003e\n\n\u003cp\u003eE.g. \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eSELECT E.*, E.Tablename \nFROM events E \nLEFT JOIN 'E.tablename' T ON E._ID = T.ID\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eIf not, is there a better way to design my database considering i have no idea on how many user defined fields there may be and what type they will be. \u003c/p\u003e","accepted_answer_id":"2952354","answer_count":"6","comment_count":"1","creation_date":"2010-06-01 17:23:24.013 UTC","favorite_count":"2","last_activity_date":"2010-06-01 18:58:35.77 UTC","last_edit_date":"2010-06-01 17:27:00.933 UTC","last_editor_display_name":"","last_editor_user_id":"13302","owner_display_name":"","owner_user_id":"355657","post_type_id":"1","score":"2","tags":"sql|join","view_count":"333"} +{"id":"2951872","title":"How can i design a DB where the user can define the fields and types of a detail table in a M-D relationship?","body":"\u003cp\u003eMy application has one table called 'events' and each event has approx 30 standard fields, but also user defined fields that could be any name or type, in an 'eventdata' table. Users can define these event data tables, by specifying x number of fields (either text/double/datetime/boolean) and the names of these fields. This 'eventdata' (table) can be different for each 'event'.\u003c/p\u003e\n\n\u003cp\u003eMy current approach is to create a lookup table for the definitions. So if i need to query all 'event' and 'eventdata' per record, i do so in a M-D relaitionship using two queries (i.e. select * from events, then for each record in 'events', select * from 'some table').\u003c/p\u003e\n\n\u003cp\u003eIs there a better approach to doing this? I have implemented this so far, but most of my queries require two distinct calls to the DB - i cannot simply join my cluster manager 'events' table with different 'eventdata' tables for each record in in 'events'.\u003c/p\u003e\n\n\u003cp\u003eI guess my main question is: can i join my cluster manager table with different detail tables for each record? \u003c/p\u003e\n\n\u003cp\u003eE.g. \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eSELECT E.*, E.Tablename \nFROM events E \nLEFT JOIN 'E.tablename' T ON E._ID = T.ID\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eIf not, is there a better way to design my database considering i have no idea on how many user defined fields there may be and what type they will be. \u003c/p\u003e","accepted_answer_id":"2952354","answer_count":"6","comment_count":"1","creation_date":"2010-06-01 17:23:24.013 UTC","favorite_count":"2","last_activity_date":"2010-06-01 18:58:35.77 UTC","last_edit_date":"2010-06-01 17:27:00.933 UTC","last_editor_display_name":"","last_editor_user_id":"13302","owner_display_name":"","owner_user_id":"355657","post_type_id":"1","score":"2","tags":"sql|join","view_count":"333"} {"id":"27792835","title":"PHP: How to display date time in following format (2015-01-05T06:27:50.000Z )?","body":"\u003cp\u003eI want to show the datetime in the following format \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e2015-01-05T06:27:50.000Z \n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHow I can achieve this ? \u003c/p\u003e","accepted_answer_id":"27792899","answer_count":"2","comment_count":"0","creation_date":"2015-01-06 05:53:37.707 UTC","last_activity_date":"2016-08-03 21:11:53.967 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1216451","post_type_id":"1","score":"4","tags":"php|datetime","view_count":"682"} {"id":"13393287","title":"Visual Studio 2010 runs awful - can't find solution","body":"\u003cp\u003eI have a problem with my Visual Studio 2010 Professional - I'm working on a project at work, and everything in VS runs slow (maybe except IntelliSense). I know that start-up times usually are quite bad, and I can live with that.\u003c/p\u003e\n\n\u003cp\u003eBut building a medium sized solution (7 projects, a few hundred files) takes from 3 to even 10 minutes... After building the solution VS says that it's ready, but I have to wait for the localhost to respond up to 5 minutes... That's up to 15 minutes in total!\nTo keep things short: \u003c/p\u003e\n\n\u003cul\u003e\n\u003cli\u003eafter turning on everything I still have at least 1Gb of free RAM (4 total) and only 20-25% of processor usage\u003c/li\u003e\n\u003cli\u003eI have uninstalled every plugin\u003c/li\u003e\n\u003cli\u003eThe project builds and works fine on my teammate's computer\u003c/li\u003e\n\u003cli\u003eThe project works and builds even better when I work on a server using my computer and a virtual desktop\u003c/li\u003e\n\u003cli\u003eMy computer works just fine\u003c/li\u003e\n\u003cli\u003eI have just finished the painful re-installation of VS (after removing VS cleaning it's leftovers - or so I think)\u003c/li\u003e\n\u003c/ul\u003e\n\n\u003cp\u003eEDIT: After cleaning up my solution my build times are blazing fast! :) Plus, I was able to find out that I have some kind of problem with my processor, which didn't show up in the process manager until now... Anyway, I think my problem has been solved somehow...\nTHANK YOU!\u003c/p\u003e","accepted_answer_id":"13393348","answer_count":"5","comment_count":"11","creation_date":"2012-11-15 07:44:12.497 UTC","last_activity_date":"2012-11-15 08:52:20.78 UTC","last_edit_date":"2012-11-15 08:52:20.78 UTC","last_editor_display_name":"","last_editor_user_id":"1152125","owner_display_name":"","owner_user_id":"1152125","post_type_id":"1","score":"1","tags":"c#|visual-studio-2010","view_count":"447"} {"id":"10805278","title":"Joining Lists using Linq returns different result than corresponding SQL query?","body":"\u003cp\u003eI have 2 tables\u003c/p\u003e\n\n\u003cp\u003eTableA:\u003c/p\u003e\n\n\u003cpre class=\"lang-none prettyprint-override\"\u003e\u003ccode\u003eTableAID int,\nCol1 varchar(8)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eTableB:\u003c/p\u003e\n\n\u003cpre class=\"lang-none prettyprint-override\"\u003e\u003ccode\u003eTableBID int\nCol1 char(8),\nCol2 varchar(40)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhen I run a SQL query on the 2 tables it returns the following number of rows\u003c/p\u003e\n\n\u003cpre class=\"lang-sql prettyprint-override\"\u003e\u003ccode\u003eSELECT * FROM tableA (7200 rows)\nselect * FROM tableB (28030 rows)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhen joined on col1 and selects the data it returns the following number of rows\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eselect DISTINCT a.Col1,b.Col2 FROM tableA a\njoin tableB b on a.Col1=b.Col1 (6578 rows)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe above 2 tables on different databases so I created 2 EF models and retried the data separately and tried to join them in the code using linq with the following function. Surprisingly it returns 2886 records instead of 6578 records. Am I doing something wrong?\nThe individual lists seems to return the correct data but when I join them SQL query and linq query differs in the number of records.\u003c/p\u003e\n\n\u003cp\u003eAny help on this greatly appreciated.\u003c/p\u003e\n\n\n\n\u003cpre\u003e\u003ccode\u003e// This function is returning 2886 records \npublic List\u0026lt;tableC_POCO_Object\u0026gt; Get_TableC() \n{\n IEnumerable\u0026lt;tableC_POCO_Object\u0026gt; result = null;\n List\u0026lt;TableA\u0026gt; tableA_POCO_Object = Get_TableA(); // Returns 7200 records\n List\u0026lt;TableB\u0026gt; tableB_POCO_Object = Get_TableB(); // Returns 28030 records\n result = from tbla in tableA_POCO_Object\n join tblb in tableB_POCO_Object on tbla.Col1 equals tblb.Col1\n select new tableC_POCO_Object \n {\n Col1 = tblb.Col1,\n Col2 = tbla.Col2\n };\n return result.Distinct().ToList();\n}\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"3","comment_count":"8","creation_date":"2012-05-29 19:17:20.24 UTC","last_activity_date":"2014-07-03 10:03:26.47 UTC","last_edit_date":"2014-07-03 10:03:26.47 UTC","last_editor_display_name":"","last_editor_user_id":"759866","owner_display_name":"","owner_user_id":"1424482","post_type_id":"1","score":"1","tags":"c#","view_count":"582"} @@ -4212,7 +4212,7 @@ {"id":"17558093","title":"Search Outlook contacts by email using AppleScript and mdfind","body":"\u003cp\u003eIs there a more-efficient way to determine if a contact doesn't exist than this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eset theAddress to \"foo@bar.com\"\n\nset found to false\n\nrepeat with aContact in contacts\n\n if email addresses of aContact contains theAddress then\n set found to true\n exit repeat\n end if\n\nend repeat\n\nif not found then\n ...\nend if\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThis will create a new contact if it isn't found (and return \u003ccode\u003etrue\u003c/code\u003e):\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eset found to open contact email address \"foo@bar.com\"\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e** edit **\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"https://stackoverflow.com/questions/18859148/search-outlook-contacts-by-category\"\u003eSearch Outlook contacts by category\u003c/a\u003e suggests that I should be able to do this using a Spotlight query:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e-- the address to be found\nset theEmailAddress to \"foobar@acme.com\"\n\n-- search identity folder\nset currentIdentityFolder to quoted form of POSIX path of (current identity folder as string)\n\n--perform Spotlight query\nset theContacts to words of (do shell script \"mdfind -onlyin \" \u0026amp; currentIdentityFolder \u0026amp; \" 'kMDItemContentType == com.microsoft.outlook14.contact \u0026amp;\u0026amp; [metadata element that represents an email address] == \" \u0026amp; theEmailAddress \u0026amp; \"' | xargs -I % mdls -name com_microsoft_outlook_recordID '%' | cut -d'=' -f2 | sort -u | paste -s -\")\n\n-- process results\n...\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhat is the metadata element that represents a contact's email address?\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2013-07-09 21:00:35.087 UTC","last_activity_date":"2016-04-19 03:47:54.303 UTC","last_edit_date":"2017-05-23 12:16:00.48 UTC","last_editor_display_name":"","last_editor_user_id":"-1","owner_display_name":"","owner_user_id":"134367","post_type_id":"1","score":"1","tags":"osx|applescript|spotlight|outlook-2011","view_count":"510"} {"id":"37236790","title":"Regex for matching some characters that should be left out later","body":"\u003cp\u003eI will try to explain my situation with an example, consider the following string:\u003c/p\u003e\n\n\u003cp\u003e\u003ccode\u003e03 - The-Basics-of-Querying-the-Dom.mov\u003c/code\u003e\u003c/p\u003e\n\n\u003cp\u003eI need to remove all \u003ccode\u003e-\u003c/code\u003es (hyphens) excluding the one after the digits. In other words, all \u003cem\u003ehyphens\u003c/em\u003e in between the words.\u003c/p\u003e\n\n\u003cp\u003eThis is the REGEX I created: \u003ccode\u003e/([^\\s])\\-/\u003c/code\u003e. But the problem is, when I try to replace, the character before the space is also removed.\u003c/p\u003e\n\n\u003cp\u003eFollowing the result I am aiming for:\u003c/p\u003e\n\n\u003cp\u003e\u003ccode\u003e03 - The Basics of Querying the Dom.mov\u003c/code\u003e\u003c/p\u003e\n\n\u003cp\u003eThink, I can use something like exclude groups? I tried to use \u003ccode\u003e?:\u003c/code\u003e \u0026amp; \u003ccode\u003e?!\u003c/code\u003e in the capture group to avoid it from being matched, but didn't give any positive results.\u003c/p\u003e","accepted_answer_id":"37236852","answer_count":"2","comment_count":"4","creation_date":"2016-05-15 09:49:01.73 UTC","last_activity_date":"2016-05-15 09:55:44.243 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"2602869","post_type_id":"1","score":"0","tags":"regex|pcre","view_count":"36"} {"id":"41163298","title":"Chronos setting environment variable leads to error","body":"\u003cp\u003eI tried this both on the chronos config and in my job definition:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e \"environmentVariables\": [\n {\n \"name\": \"DOCKER_API_VERSION\",\n \"value\": \"$(docker version --format '{{.Server.Version}}')\"\n }\n ],\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eIt always fails with:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003edocker: Error response from daemon: 404 page not found.\nSee 'docker run --help'.\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe reason I'm trying to set that variable is because I'm running docker in docker and the client docker API sometimes has a different version than the server docker version and it has to be started with the \u003ccode\u003eDOCKER_API_VERSION\u003c/code\u003e env set in order to work.\u003c/p\u003e\n\n\u003cp\u003eI'm suspecting it's because of the computed value being set instead of a string value.\u003c/p\u003e\n\n\u003cp\u003eIn the logs I can see it runs as supposed and I don't know why it crashes to be honest:\u003c/p\u003e\n\n\u003cp\u003e\u003ccode\u003edocker run ... -e DOCKER_API_VERSION=$(docker version --format '{{.Server.Version}}') ...\u003c/code\u003e\u003c/p\u003e","answer_count":"0","comment_count":"4","creation_date":"2016-12-15 11:40:57.23 UTC","last_activity_date":"2016-12-15 11:40:57.23 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1515697","post_type_id":"1","score":"0","tags":"mesos|dcos|mesos-chronos","view_count":"88"} -{"id":"45445531","title":"Java : How to include a .properties file that is outside of jar into classpath?","body":"\u003cp\u003eWe would like to keep the .properties file out of the jar so that we can change the properties used in a module and we do not have to re-install the module.\u003c/p\u003e\n\n\u003cp\u003eBefore Java 8, we used to run a script and include the .properties file in the way below and it worked. But since when we updated to Java 8 , this way of including .properties file in classpath is not working, means java program fails not finding the .properties file.\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eMy script to run the java project:\u003c/strong\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e/usr/java/latest/bin/java -d64 -Xms1G -Xmx16G -XX:MaxPermSize=128m -XX:-UseGCOverheadLimit -cp \"/online/sand/lib/client-api-1.0.0.jar:/online/sand/oap_pub/lib/*:/online/sand/oap/oap_dw/run/client_api/application.properties\" team.online.client.api.MasterProcessor | tee -a client_api.log\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWe are using Sping context to pick up the properties file this way:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;util:properties id=\"app_props\"\n location=\"classpath*:/application.properties\" /\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThen a property in that appilcation.properties files is being used ( in many different files) this way:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e@Value( \"#{app_props[\\\"SERVICE_PATH_GET_METADATA\\\"]?:''}\" )\nprivate String metadataServicePath;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eLooking for a way to keep the.properties file out of the jar and in classpath so that Spring context finds that file.\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eIs their any other way than using ? We need to keep the properties file excluded from jar\u003c/strong\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eclass.getClassLoader( ).getResourceAsStream( \"application.properties\" );\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThanks in advance. \u003c/p\u003e","accepted_answer_id":"45515147","answer_count":"2","comment_count":"0","creation_date":"2017-08-01 18:47:09.35 UTC","last_activity_date":"2017-08-18 17:22:53.367 UTC","last_edit_date":"2017-08-18 17:22:53.367 UTC","last_editor_display_name":"","last_editor_user_id":"923988","owner_display_name":"","owner_user_id":"923988","post_type_id":"1","score":"0","tags":"java|spring|classpath","view_count":"215"} +{"id":"45445531","title":"Java : How to include a .properties file that is outside of jar into classpath?","body":"\u003cp\u003eWe would like to keep the .properties file out of the jar so that we can change the properties used in a module and we do not have to re-install the module.\u003c/p\u003e\n\n\u003cp\u003eBefore Java 8, we used to run a script and include the .properties file in the way below and it worked. But since when we updated to Java 8 , this way of including .properties file in classpath is not working, means java program fails not finding the .properties file.\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eMy script to run the java project:\u003c/strong\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e/usr/java/latest/bin/java -d64 -Xms1G -Xmx16G -XX:MaxPermSize=128m -XX:-UseGCOverheadLimit -cp \"/online/sand/lib/client-api-1.0.0.jar:/online/sand/oap_pub/lib/*:/online/sand/oap/oap_dw/run/client_api/application.properties\" team.online.client.api.ClusterManagerProcessor | tee -a client_api.log\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWe are using Sping context to pick up the properties file this way:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;util:properties id=\"app_props\"\n location=\"classpath*:/application.properties\" /\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThen a property in that appilcation.properties files is being used ( in many different files) this way:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e@Value( \"#{app_props[\\\"SERVICE_PATH_GET_METADATA\\\"]?:''}\" )\nprivate String metadataServicePath;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eLooking for a way to keep the.properties file out of the jar and in classpath so that Spring context finds that file.\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eIs their any other way than using ? We need to keep the properties file excluded from jar\u003c/strong\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eclass.getClassLoader( ).getResourceAsStream( \"application.properties\" );\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThanks in advance. \u003c/p\u003e","accepted_answer_id":"45515147","answer_count":"2","comment_count":"0","creation_date":"2017-08-01 18:47:09.35 UTC","last_activity_date":"2017-08-18 17:22:53.367 UTC","last_edit_date":"2017-08-18 17:22:53.367 UTC","last_editor_display_name":"","last_editor_user_id":"923988","owner_display_name":"","owner_user_id":"923988","post_type_id":"1","score":"0","tags":"java|spring|classpath","view_count":"215"} {"id":"6424898","title":"Is it possible to use Aero Peek for MDI children within a winforms application?","body":"\u003cp\u003eI've seen from the \u003ca href=\"http://archive.msdn.microsoft.com/WindowsAPICodePack\" rel=\"noreferrer\"\u003eWindows API Code Pack\u003c/a\u003e that it is possible to enable custom glass in a winforms application, but I've been unable to ascertain how to get child windows to show as separte thumbnails for aero peek (in much the same manner that IE displays the contents of its tabs as separate windows)\u003c/p\u003e\n\n\u003cp\u003eIs it possible to do this from a Winforms application, or will it involve lots of P/Invoke voodoo?\u003c/p\u003e","accepted_answer_id":"6427378","answer_count":"1","comment_count":"0","creation_date":"2011-06-21 12:01:51.193 UTC","favorite_count":"1","last_activity_date":"2011-06-21 14:56:39.707 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"50447","post_type_id":"1","score":"5","tags":"c#|winforms|windows-7|aero-peek","view_count":"552"} {"id":"3968350","title":"Resetting animation in Android without starting it","body":"\u003cp\u003eI have an \u003ccode\u003eAnimationDrawable\u003c/code\u003e that is running. How to stop \u0026amp; reset it so that it does not start again until \u003ccode\u003estart()\u003c/code\u003e is called? Calling \u003ccode\u003esetVisible(true, true)\u003c/code\u003e resets it, but also immediately starts animation, and I'd like to avoid it.\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2010-10-19 12:36:05.277 UTC","last_activity_date":"2011-08-02 15:05:45.177 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"6533","post_type_id":"1","score":"2","tags":"android","view_count":"292"} {"id":"3088779","title":"Android - How to display an ImageView as a header in a listactivity?","body":"\u003cp\u003eI'm trying to display an image before the list in a listactivity. \u003c/p\u003e\n\n\u003cp\u003eIf I put an ImageView before the ListView, then only the list is displayed... still quite an android n00b so any pointers appreciated :)\u003c/p\u003e\n\n\u003cp\u003eHeres my main.xml which lays out the list activity:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;?xml version=\"1.0\" encoding=\"utf-8\"?\u0026gt;\n\u0026lt;LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\" \n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"\u0026gt;\n\n \u0026lt;ImageView android:id=\"@+id/header\"\n android:src=\"@drawable/header\"\n android:layout_width=\"fill_parent\"\n android:layout_height=\"wrap_content\"\n android:layout_gravity=\"top\"\n android:scaleType=\"fitStart\"\n /\u0026gt;\n\n \u0026lt;ListView android:id=\"@+id/android:list\" \n android:layout_width=\"fill_parent\" \n android:layout_height=\"wrap_content\"\n android:scaleType=\"fitEnd\"\n /\u0026gt;\n\u0026lt;/LinearLayout\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"3088798","answer_count":"1","comment_count":"0","creation_date":"2010-06-21 21:56:03.1 UTC","last_activity_date":"2010-06-21 21:58:08.383 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"62709","post_type_id":"1","score":"0","tags":"android|imageview|listactivity","view_count":"1410"} @@ -4408,7 +4408,7 @@ {"id":"25722843","title":"Android IMAGE_CAPTURE always returns Activity.RESULT_CANCELED","body":"\u003cp\u003eI want to take a photo in my app. On the emulator everything works fine.\nBut on the tablet, the Intent immediately returns Activity.RESULT_CANCELED in onActivityResult. The picture is saved on the SD Card. \u003c/p\u003e\n\n\u003cp\u003eHere is the code for taking picture:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eIntent intent = new Intent(\"android.media.action.IMAGE_CAPTURE\");\nString tmpFile = CommonFunctions.generateRandomFileName() + \".jpg\";\nString fileName = CommonFunctions.getNoticeSavePath() + tmpFile;\nSystem.out.println(\"Filename \" + fileName);\nintent.putExtra(MediaStore.EXTRA_OUTPUT, \nUri.fromFile(new File(fileName)));\nnotice.setBild(tmpFile);\nstartActivityForResult(intent, RESULT_PICTURE);\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eCode for onActivityResult:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epublic void onActivityResult(int requestCode, int resultCode, Intent data) {\n super.onActivityResult(requestCode, resultCode, data);\n\n\n switch (requestCode) {\n\n case RESULT_PICTURE:\n System.out.println(\"ResultCode\" + resultCode);\n if (resultCode == Activity.RESULT_OK) {\n\n }\n else if (resultCode == Activity.RESULT_CANCELED){\n notice.setBild(\"\");\n Toast.makeText(getBaseContext(), \"Bild wurde nicht hinzugefügt\", Toast.LENGTH_LONG).show();\n }\n break;\n }\n }\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ePermissions are set:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\"/\u0026gt;\n\u0026lt;uses-permission android:name=\"android.permission.CAMERA\"/\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe result is always RESULT_CANCELED, but the photo is stored correctly on the sd card.\nWhat could the problem be?\u003c/p\u003e","answer_count":"1","comment_count":"5","creation_date":"2014-09-08 11:05:17.933 UTC","last_activity_date":"2014-10-08 19:54:38.023 UTC","last_edit_date":"2014-09-08 11:42:07.923 UTC","last_editor_display_name":"","last_editor_user_id":"898423","owner_display_name":"","owner_user_id":"598596","post_type_id":"1","score":"0","tags":"android|camera","view_count":"446"} {"id":"44577622","title":"Lambda data frame reference a value in another column","body":"\u003cp\u003eHow do I correctly reference another column value when using a Lambda in a pandas dataframe. \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003edfresult_tmp2['Retention_Rolling_temp'] = dfresult_tmp2['Retention_tmp'].apply(lambda x: x if x['Count Billings']/4 \u0026lt; 0.20 else '')\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe above code gives me this error.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eTypeError: 'float' object is not subscriptable\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"44577818","answer_count":"1","comment_count":"0","creation_date":"2017-06-15 21:52:59.963 UTC","last_activity_date":"2017-06-15 22:18:27.117 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"2386086","post_type_id":"1","score":"1","tags":"python|pandas|lambda","view_count":"77"} {"id":"15599918","title":"tracking down AWT exception in Clojure UI app under Leiningen","body":"\u003cp\u003eReferring to this SO \u003ca href=\"https://stackoverflow.com/questions/2792451/improving-my-first-clojure-program\"\u003equestion on a first UI program in Clojure\u003c/a\u003e, I created a new \u003ccode\u003eLeiningen\u003c/code\u003e app project:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003elein new app a-ui-app\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ecopied the source into the \u003ccode\u003ecore.clj\u003c/code\u003e that leiningen generated and modified the \u003ccode\u003e-main\u003c/code\u003e routine to call it\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e(defn -main\n \"See https://stackoverflow.com/questions/2792451/improving-my-first-clojure-program?rq=1.\"\n [\u0026amp; args]\n ;; work around dangerous default behaviour in Clojure\n (alter-var-root #'*read-eval* (constantly false))\n\n (doto panel\n (.setFocusable true)\n (.addKeyListener panel))\n\n (doto frame\n (.add panel)\n (.pack)\n (.setDefaultCloseOperation JFrame/EXIT_ON_CLOSE)\n (.setVisible true))\n\n (loop []\n (draw-rectangle panel @x @y)\n (Thread/sleep 10)\n (recur))\n )\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI then run it via either\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003elein run\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eor \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003elein uberjar\njava -jar ./target/a-ui-app-0.1.0-SNAPSHOT-standalone.jar \n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eIn both cases, the app works well, but in the terminal that I used to start it up, I get an exception after a random delay of several seconds:\u003c/p\u003e\n\n\u003cblockquote\u003e\n \u003cp\u003eException in thread \"AWT-EventQueue-0\"\n java.lang.IllegalArgumentException: No matching clause: 157 at\n a_ui_app.core$fn__16$fn__21$fn__22.invoke(core.clj:19) at\n clojure.lang.AFn.call(AFn.java:18) at\n clojure.lang.LockingTransaction.run(LockingTransaction.java:263) at\n clojure.lang.LockingTransaction.runInTransaction(LockingTransaction.java:231)\n at a_ui_app.core$fn__16$fn__21.invoke(core.clj:17) at\n a_ui_app.core.proxy$javax.swing.JPanel$KeyListener$6c415903.keyPressed(Unknown\n Source) at java.awt.Component.processKeyEvent(Component.java:6340) at\n javax.swing.JComponent.processKeyEvent(JComponent.java:2809) at\n a_ui_app.core.proxy$javax.swing.JPanel$KeyListener$6c415903.processKeyEvent(Unknown\n Source) at java.awt.Component.processEvent(Component.java:6159) at\n java.awt.Container.processEvent(Container.java:2083) many more\n lines...\u003c/p\u003e\n\u003c/blockquote\u003e\n\n\u003cp\u003eI made no changes to \u003ccode\u003eproject.clj\u003c/code\u003e -- just used the leiningen-generated one.\u003c/p\u003e\n\n\u003cp\u003eI'd like to understand what's going on. I am by no means knowledgeable in Java Threading. Is the problem related to the way leiningen launches the app's Java threads? Is it unavoidable? If not, how can I fix it, both for this little sample program and going forward, as a project pattern for future projects using the UI thread (which I think is \u003ccode\u003eAWT-EventQueue-0\u003c/code\u003e).\u003c/p\u003e","accepted_answer_id":"15602460","answer_count":"1","comment_count":"1","creation_date":"2013-03-24 14:53:20.443 UTC","last_activity_date":"2013-03-25 00:22:52.07 UTC","last_edit_date":"2017-05-23 12:04:56.033 UTC","last_editor_display_name":"","last_editor_user_id":"-1","owner_display_name":"","owner_user_id":"520997","post_type_id":"1","score":"3","tags":"clojure|awt|leiningen","view_count":"241"} -{"id":"5451932","title":"Right to left asp.net menu - Help me setup my CSS","body":"\u003cp\u003eCoders, I am trying to style my Asp.net menu control and I have a set of CSS definitions that styles my menu:\nHere is the CSS:\u003c/p\u003e\n\n\u003cpre\u003e\n.MainMenu\n{\n\n background: url(\"http://cables.com.sa/en/ddtabmenufiles/media/blockdefault.gif\") repeat-x scroll center center black;\n border-color: #625E00;\n border-style: solid;\n border-width: 1px 0;\n float: right;\n font: bold 13px Arial;\n margin: 0;\n padding: 0;\n width: 100%;\n}\n\n.MainMenu a {\n float: right;\n}\n\n.MainMenu li {\n display: inline;\n float: right;\n}\n\n.MainMenu li a {\n border-right: 1px solid white;\n color: white;\n float: right;\n padding: 9px 11px;\n text-decoration: none;\n}\n\n.MainMenu li a:visited \n{\n color: white;\n}\n\n\n.MainMenu li a:hover, .MainMenu li a.current {\n background: url(\"http://cables.com.sa/en/ddtabmenufiles/media/blockactive.gif\") repeat-x scroll center center transparent;\n color: white;\n}\n\u003c/pre\u003e\n\n\u003cp\u003eAnd here is the Asp.net Masterpage code:\u003c/p\u003e\n\n\u003cp\u003e\u003ccode\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e \u0026lt;asp:Menu ID=\"NavigationMenu\" runat=\"server\" CssClass=\"MainMenu\" EnableViewState=\"False\"\n IncludeStyleBlock=\"False\" Orientation=\"Horizontal\"\u0026gt;\n \u0026lt;Items\u0026gt;\n \u0026lt;asp:MenuItem NavigateUrl=\"~/Default.aspx\" Text=\"Home\" /\u0026gt;\n \u0026lt;asp:MenuItem NavigateUrl=\"~/About.aspx\" Text=\"About\" /\u0026gt;\n \u0026lt;/Items\u0026gt;\n \u0026lt;/asp:Menu\u0026gt; \n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003c/code\u003e\u003c/p\u003e\n\n\u003cp\u003eNotice that in the CSS I have setup the floating to be ‘float: right’ because I am using this CSS style for an Arabic menu (ie: text direction: right to left + float: right). But the problem is that my menu items are still showing on the left side.\u003c/p\u003e\n\n\u003cp\u003eMy question is, how do I set my CSS to show my menu items on the left side?\u003c/p\u003e\n\n\u003cp\u003eRemarks: I want my menu items to appear like this website: \nwww.tech-nuke.com\nAnd I am taking my current style from:\n\u003ca href=\"http://cables.com.sa/en/index.php?p=home\" rel=\"nofollow\"\u003ehttp://cables.com.sa/en/index.php?p=home\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eThanks in advance.\u003c/p\u003e","answer_count":"4","comment_count":"0","creation_date":"2011-03-27 19:53:06.443 UTC","favorite_count":"1","last_activity_date":"2015-03-21 09:46:54.673 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"485909","post_type_id":"1","score":"0","tags":"asp.net|css|menu","view_count":"5810"} +{"id":"5451932","title":"Right to left asp.net menu - Help me setup my CSS","body":"\u003cp\u003eCoders, I am trying to style my Asp.net menu control and I have a set of CSS definitions that styles my menu:\nHere is the CSS:\u003c/p\u003e\n\n\u003cpre\u003e\n.MainMenu\n{\n\n background: url(\"http://cables.com.sa/en/ddtabmenufiles/media/blockdefault.gif\") repeat-x scroll center center black;\n border-color: #625E00;\n border-style: solid;\n border-width: 1px 0;\n float: right;\n font: bold 13px Arial;\n margin: 0;\n padding: 0;\n width: 100%;\n}\n\n.MainMenu a {\n float: right;\n}\n\n.MainMenu li {\n display: inline;\n float: right;\n}\n\n.MainMenu li a {\n border-right: 1px solid white;\n color: white;\n float: right;\n padding: 9px 11px;\n text-decoration: none;\n}\n\n.MainMenu li a:visited \n{\n color: white;\n}\n\n\n.MainMenu li a:hover, .MainMenu li a.current {\n background: url(\"http://cables.com.sa/en/ddtabmenufiles/media/blockactive.gif\") repeat-x scroll center center transparent;\n color: white;\n}\n\u003c/pre\u003e\n\n\u003cp\u003eAnd here is the Asp.net ClusterManagerpage code:\u003c/p\u003e\n\n\u003cp\u003e\u003ccode\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e \u0026lt;asp:Menu ID=\"NavigationMenu\" runat=\"server\" CssClass=\"MainMenu\" EnableViewState=\"False\"\n IncludeStyleBlock=\"False\" Orientation=\"Horizontal\"\u0026gt;\n \u0026lt;Items\u0026gt;\n \u0026lt;asp:MenuItem NavigateUrl=\"~/Default.aspx\" Text=\"Home\" /\u0026gt;\n \u0026lt;asp:MenuItem NavigateUrl=\"~/About.aspx\" Text=\"About\" /\u0026gt;\n \u0026lt;/Items\u0026gt;\n \u0026lt;/asp:Menu\u0026gt; \n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003c/code\u003e\u003c/p\u003e\n\n\u003cp\u003eNotice that in the CSS I have setup the floating to be ‘float: right’ because I am using this CSS style for an Arabic menu (ie: text direction: right to left + float: right). But the problem is that my menu items are still showing on the left side.\u003c/p\u003e\n\n\u003cp\u003eMy question is, how do I set my CSS to show my menu items on the left side?\u003c/p\u003e\n\n\u003cp\u003eRemarks: I want my menu items to appear like this website: \nwww.tech-nuke.com\nAnd I am taking my current style from:\n\u003ca href=\"http://cables.com.sa/en/index.php?p=home\" rel=\"nofollow\"\u003ehttp://cables.com.sa/en/index.php?p=home\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eThanks in advance.\u003c/p\u003e","answer_count":"4","comment_count":"0","creation_date":"2011-03-27 19:53:06.443 UTC","favorite_count":"1","last_activity_date":"2015-03-21 09:46:54.673 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"485909","post_type_id":"1","score":"0","tags":"asp.net|css|menu","view_count":"5810"} {"id":"13474897","title":"Select distinct records with Min Date from two tables with Left Join","body":"\u003cp\u003eI'm trying to retrieve all distinct AccountId’s as well as the earliest InsertDate for each. Occasionally the AccountId is not known and although the transactions may be distinct I want to bucket all of the ‘-1’s into their own group. \u003c/p\u003e\n\n\u003cp\u003eThis is what I have attempted so far along with the schemas.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e CREATE TABLE #tmpResults (\n Trans Varchar(12), \n AccountId Varchar(50), \nEarlyDate DateTime DEFAULT getdate(), CardType Varchar(16))\n\ninsert #tmpResults\n select [Trans] = convert(varchar(12),'CashSale')\n , [AccountId] = b.AccountId\n , [EarlyDate] = min(b.InsertDate)\n , case when c.name LIKE '%VISA%' then 'VISA'\n when c.name LIKE '%MasterCard%' then 'MasterCard'\n when c.name LIKE '%AMEX%' then 'AMEX'\n else 'Other'\n end as [CardType] \n from TransBatch b\n left join CardVer_3 c WITH (NOLOCK) ON c.Id = B.BatchId\n left join TransBatch b2\n on (b.accountid = b2.accountid and (b.InsertDate \u0026gt; b2.InsertDate or b.InsertDate = b2.InsertDate))\n and b2.accountid is NULL\n group by b.accountid, b.InsertDate,c.name \n order by b.accountid DESC\n\n select * from #tmpResults\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe table schemas are like so: \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e**TransBatch** \nRecordId |BatchId |InsertDate | AccountId | AccNameHolder \n6676 | 11 | 2012-11-01 05:19:04.000 | 12345 | Account1 \n6677 | 11 | 2012-11-01 05:19:04.000 | 12345 | Account1 \n6678 | 11 | 2012-11-01 05:19:04.000 | 55555 | Account2 \n6679 | 11 | 2012-11-01 05:19:04.000 | -1 | NULL \n6680 | 12 | 2012-11-02 05:20:04.000 | 12345 | Account1 \n6681 | 12 | 2012-11-02 05:20:04.000 | 55555 | Account2 \n6682 | 13 | 2012-11-04 06:20:04.000 | 44444 | Account3 \n6683 | 14 | 2012-11-05 05:30:04.000 | 44444 | Account3 \n6684 | 14 | 2012-11-05 05:31:04.000 | -1 | NULL \n\n\n**CardVer_3** \nBatchId |Name \n11 |MasterCard \n12 |Visa \n13 |AMEX \n14 |GoCard\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThis will be an intermediate table, the output is planned to look like the attached.\u003c/p\u003e\n\n\u003cp\u003e\u003cimg src=\"https://i.imgur.com/g1uLp.png\" alt=\"No of distinct accounts per cardtype grouped by min age (date from today)\"\u003e\u003c/p\u003e","answer_count":"2","comment_count":"0","creation_date":"2012-11-20 14:03:49.5 UTC","last_activity_date":"2012-11-21 14:03:30.01 UTC","last_edit_date":"2012-11-20 23:17:30.41 UTC","last_editor_display_name":"","last_editor_user_id":"1773949","owner_display_name":"","owner_user_id":"1773949","post_type_id":"1","score":"1","tags":"sql|sql-server|sql-server-2008|tsql","view_count":"351"} {"id":"12199624","title":"Nil NSString method","body":"\u003cp\u003eI have an \u003ccode\u003eNSString\u003c/code\u003e that is stored in Core Data. It is optional, which I believe in the sqlite db means it can be null. I have a convenience method I call 'isEmptyOrWhitespace' shown here:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e- (BOOL)isEmptyOrWhiteSpace {\n return self == nil ||\n self.length == 0 ||\n [self stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]].length == 0;\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhen my string from Core Data is nil, it doesn't seem to call this method, that is the breakpoints are never hit. This is particularly annoying because a code chunk like this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eif(![string isEmptyOrWhitespace]) {\n [string doSomething];\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003ccode\u003edoSomething\u003c/code\u003e is being run if string is nil, obviously not my intent. Is there a way to get around this without checking if my string is nil before calling a method on it? Or is this a \"feature\" of Objective-C that methods aren't run on nil objects?\u003c/p\u003e","accepted_answer_id":"12199669","answer_count":"2","comment_count":"2","creation_date":"2012-08-30 14:49:11.737 UTC","last_activity_date":"2012-08-30 15:11:09.42 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"350538","post_type_id":"1","score":"0","tags":"objective-c|nsstring","view_count":"156"} {"id":"42113674","title":"Unit testing a jee filter","body":"\u003cp\u003eI am trying to test this filter:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epublic class HttpMethodOverrideHeaderFilter extends OncePerRequestFilter {\n private static final String X_HTTP_METHOD_OVERRIDE_HEADER = \"X-HTTP-Method-Override\";\n\n @Override\n protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)\n throws ServletException, IOException {\n\n if (isMethodOverriden(request)) {\n HttpServletRequest wrapper = new HttpMethodRequestWrapper(request, request.getHeader(X_HTTP_METHOD_OVERRIDE_HEADER).toUpperCase(Locale.ENGLISH));\n filterChain.doFilter(wrapper, response);\n }\n else {\n filterChain.doFilter(request, response);\n }\n\n }\n\n private boolean isMethodOverriden(HttpServletRequest request) {\n String methodOverride = request.getHeader(X_HTTP_METHOD_OVERRIDE_HEADER);\n return RequestMethod.POST.name().equalsIgnoreCase(request.getMethod()) \u0026amp;\u0026amp;\n (RequestMethod.PUT.name().equalsIgnoreCase(methodOverride) || RequestMethod.DELETE.name().equalsIgnoreCase(methodOverride));\n }\n\n protected static class HttpMethodRequestWrapper extends HttpServletRequestWrapper {\n private final String method;\n\n public HttpMethodRequestWrapper(HttpServletRequest request, String method) {\n super(request);\n this.method = method;\n }\n\n @Override\n public String getMethod() {\n return this.method;\n }\n }\n\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAnd this is the unit test:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e@RunWith(MockitoJUnitRunner.class)\npublic class HttpMethodOverrideHeaderFilterTest {\n\n private static final String X_HTTP_METHOD_OVERRIDE_HEADER = \"X-HTTP-Method-Override\";\n\n private HttpMethodOverrideHeaderFilter httpMethodOverrideHeaderFilter;\n\n @Mock\n private HttpServletRequest httpServletRequest;\n\n @Mock\n private HttpServletResponse httpServletResponse;\n\n @Mock\n private FilterChain filterChain;\n\n @Before\n public void setUp() {\n httpMethodOverrideHeaderFilter = new HttpMethodOverrideHeaderFilter();\n }\n\n @Test\n public void testDoFilterInternalWithPUTMethodAsOverrideHeader() throws Exception {\n when(httpServletRequest.getHeader(X_HTTP_METHOD_OVERRIDE_HEADER)).thenReturn(\"PUT\");\n when(httpServletRequest.getMethod()).thenReturn(\"POST\");\n\n HttpServletRequest wrapper = new HttpMethodOverrideHeaderFilter.HttpMethodRequestWrapper(httpServletRequest, \"PUT\");\n\n httpMethodOverrideHeaderFilter.doFilterInternal(httpServletRequest, httpServletResponse, filterChain);\n verify(filterChain).doFilter(wrapper, httpServletResponse);\n }\n\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe test is not passing as wrapper is not the same instance. Basically what I need to know is if the wrapper was set the PUT method. Any ideas?\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2017-02-08 12:52:42.703 UTC","last_activity_date":"2017-02-08 13:16:54.687 UTC","last_edit_date":"2017-02-08 12:53:51.77 UTC","last_editor_display_name":"","last_editor_user_id":"3885376","owner_display_name":"","owner_user_id":"1990218","post_type_id":"1","score":"0","tags":"testing|junit","view_count":"47"} @@ -4416,7 +4416,7 @@ {"id":"25503735","title":"Convert Pdf to Image as per the pdf page","body":"\u003cp\u003eI want to upload a pdf then after I want to convert to image as per the pdf page means that If pdf have 2 pages then 2 images will generate.\u003c/p\u003e\n\n\u003cp\u003eAfter generate this image I want to store into table.\u003c/p\u003e\n\n\u003cp\u003eFor example\u003c/p\u003e\n\n\u003cp\u003eI have a pdf table in that I upload a PDF and another table is image that I want to store pdf's images that newly generated.\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eI just need help for how to generate images from pdf as per the page\u003c/strong\u003e\u003c/p\u003e\n\n\u003cp\u003eso How can i do this?\u003c/p\u003e\n\n\u003cp\u003ePlease Help me?\u003c/p\u003e\n\n\u003cp\u003eThanks\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2014-08-26 10:37:33.197 UTC","last_activity_date":"2014-08-26 18:03:07.29 UTC","last_edit_date":"2014-08-26 10:44:25.247 UTC","last_editor_display_name":"user3794252","owner_display_name":"user3794252","post_type_id":"1","score":"0","tags":"ruby-on-rails|pdf|ruby-on-rails-4","view_count":"1855"} {"id":"5973329","title":"Play Framework: How to validate a subset of fields in an object?","body":"\u003cp\u003eI have an User object that has many attributes. In my edit profile screen I'm displaying a subset of those attributes. In the corresponding controller action how can I validate only those fields that are being edited and not all the fields in the User object? \u003c/p\u003e\n\n\u003cp\u003eI have annotated the fields in the User object with the MaxSize, Email, URL, etc. constraints and don't want to repeat them again by validating each field manually. \u003c/p\u003e\n\n\u003cp\u003eAny pointers would be greatly appreciated. Thanks!\u003c/p\u003e","accepted_answer_id":"5975444","answer_count":"1","comment_count":"0","creation_date":"2011-05-12 04:33:39.853 UTC","last_activity_date":"2011-05-12 21:07:41.36 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"751355","post_type_id":"1","score":"5","tags":"java|playframework","view_count":"832"} {"id":"16307290","title":"PowerShell match names with user email addresses and format as mailto","body":"\u003cp\u003eSo i have the below script which scans a drive for folders, it then pulls in a csv with folder names and folder owners and then matches them and outputs to HTML.\u003c/p\u003e\n\n\u003cp\u003eI am looking for a way to within this use PS to look up the users names in the csv grab their email address from AD and then in the output of the HTML put them as mailto code.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003efunction name($filename, $folderowners, $directory, $output){\n $server = hostname\n $date = Get-Date -format \"dd-MMM-yyyy HH:mm\"\n $a = \"\u0026lt;style\u0026gt;\"\n $a = $a + \"TABLE{border-width: 1px;border-style: solid;border-color:black;}\"\n $a = $a + \"Table{background-color:#ffffff;border-collapse: collapse;}\"\n $a = $a + \"TH{border-width:1px;padding:0px;border-style:solid;border-color:black;}\"\n $a = $a + \"TR{border-width:1px;padding-left:5px;border-style:solid;border- \n color:black;}\"\n$a = $a + \"TD{border-width:1px;padding-left:5px;border-style:solid;border-color:black;}\"\n$a = $a + \"body{ font-family:Calibri; font-size:11pt;}\"\n$a = $a + \"\u0026lt;/style\u0026gt;\"\n\n$c = \" \u0026lt;br\u0026gt;\u0026lt;/br\u0026gt; Content\"\n\n$b = Import-Csv $folderowners\n$mappings = @{}\n$b | % { $mappings.Add($_.FolderName, $_.Owner) }\n\n\n\nGet-ChildItem $directory | where {$_.PSIsContainer -eq $True} | select Name, \n@{n=\"Owner\";e={$mappings[$_.Name]}} | sort -property Name | \nConvertTo-Html -head $a -PostContent $c | \nOut-File $output\n}\n\nname \"gdrive\" \"\\\\server\\location\\gdrive.csv\" \"\\\\server\\location$\" \n\"\\\\server\\location\\gdrive.html\"\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"16307708","answer_count":"2","comment_count":"0","creation_date":"2013-04-30 19:12:13.543 UTC","last_activity_date":"2013-04-30 21:16:55.96 UTC","last_editor_display_name":"","owner_display_name":"user2299515","post_type_id":"1","score":"2","tags":"html|powershell","view_count":"421"} -{"id":"40976405","title":"Access a mesos-master behind a domain name (not an IP)","body":"\u003cp\u003eIs it possible to run and access a mesos master on a machine that is placed behind a proxy?\u003c/p\u003e\n\n\u003cp\u003eI have successfully succeeded to deployed a MesosMaster/Marathon/MesosSalve on my local infrastructure.\u003c/p\u003e\n\n\u003cp\u003eThe problem arises when I want to put the MesosSlave somewhere in the internet, so that MesosSlave and MesosMaster shall communicate through public IPs\u003c/p\u003e\n\n\u003cp\u003eMy conf is the following:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e Internet My Infra\n\n .----------------------. .-----------------. .-----------------. .-------------------------------------------------.\n | Mesos Slave VM | | Front Machine | | Proxy | | Tool-VM |\n | 178.22.17.248 | | 39.224.147.94 | | 10.2.0.57 | | 10.1.10.176 |\n |----------------------| | my.domain.com | |-----------------| | 192.168.5.1 (docker bridge) |\n | | |-----------------| | | |-------------------------------------------------|\n | | | | | | | |\n | __________ | | __________ | | __________ | | .-----------------------------. |\n | [_...__..5051.°]| |[_..5050.__...°] |\u0026lt;---|[_..5050.__...°] |\u0026lt;------------^| | Mesos-Master Container | |\n | | | | | | \\ __________ | 192.168.5.4 (docker bridge) | |\n | | | __________ | | __________ | |[_..5050.__...°]^|-----------------------------| |\n | | |[_..2181.__...°] |\u0026lt;---|[_..2181.__...°] |\u0026lt;------------^| \\ __________ | |\n | | | | | | \\ __________ |[_..5050.__...°] | |\n | | | | | | |[_..2181.__...°]^| __________ | |\n | | | | | | | \\[_..2181.__...°] | |\n | | | | | | | '-----------------------------' |\n '----------------------' '-----------------' '-----------------' '-------------------------------------------------'\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHowever:\u003c/p\u003e\n\n\u003cblockquote\u003e\n \u003cp\u003eMy domain infra redirect everthing that arrives from outside on ports 5050 (for Mesos) and port 2181 (zookeeper) \u003cstrong\u003eONLY\u003c/strong\u003e for requests that are addressed to the domain 'my.domain.com' (which is a virtualhost of 39.224.147.94). But not for the other requests (that are arriving on 39.224.147.94).\u003c/p\u003e\n\u003c/blockquote\u003e\n\n\u003cp\u003eSo I try to execute the service through CLI for the moment:\u003c/p\u003e\n\n\u003col\u003e\n\u003cli\u003eExecute \u003cstrong\u003eMesos Master\u003c/strong\u003e(in Mesos Master Container)\u003c/li\u003e\n\u003c/ol\u003e\n\n\u003cp\u003e\u003ccode\u003e/usr/sbin/mesos-master --ip=192.168.5.4 --work_dir=~/Mesos/mesos-0.23.0/workdir/ --zk=zk://192.168.5.4:2181/mesos --quorum=1 --log_dir=/var/log/mesos --external_log_file=/dev/stdout\u003c/code\u003e\u003c/p\u003e\n\n\u003col start=\"2\"\u003e\n\u003cli\u003eExecute \u003cstrong\u003eMarathon\u003c/strong\u003e (in Mesos Master Container)\u003c/li\u003e\n\u003c/ol\u003e\n\n\u003cp\u003e\u003ccode\u003e/usr/bin/marathon --zk zk://192.168.5.4:2181/marathon --master zk://my.domain.com:2181/mesos\u003c/code\u003e\u003c/p\u003e\n\n\u003col start=\"3\"\u003e\n\u003cli\u003eExecute \u003cstrong\u003eMesos Slave\u003c/strong\u003e (in Mesos Slave VM)\u003c/li\u003e\n\u003c/ol\u003e\n\n\u003cp\u003e\u003ccode\u003e/usr/sbin/mesos-slave --master=my.domain.com:5050 --work_dir=/var/lib/mesos/agent --port=8009 --containerizers=docker --executor_registration_timeout=3mins --log_dir=/var/log/mesos\u003c/code\u003e\u003c/p\u003e\n\n\u003cp\u003eThe Mesos Master can see the Slave resources.\nHowever, when I send a Job through Marathon, this job stay in a \u003cstrong\u003ewaiting\u003c/strong\u003e state.\u003c/p\u003e\n\n\u003cp\u003eIt seems that the slave is not able to communicate on the hostname of the Master, but only using it's public IP:\u003c/p\u003e\n\n\u003cp\u003eI have this in the Slave logs:\u003c/p\u003e\n\n\u003cblockquote\u003e\n \u003cp\u003eNew master detected at master@39.224.147.94:5050\u003c/p\u003e\n\u003c/blockquote\u003e\n\n\u003cp\u003eHowever incoming traffic on \u003cstrong\u003e39.224.147.94:5050\u003c/strong\u003e is blocked by my infra (only \u003cstrong\u003emy.domain.com:5050\u003c/strong\u003e is accepted)\u003c/p\u003e\n\n\u003cp\u003eSo, is it possible to create a connection between Master and Slaves, using domain names, but not IPs?\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2016-12-05 14:20:34.99 UTC","last_activity_date":"2016-12-06 12:25:40.17 UTC","last_edit_date":"2016-12-06 09:25:57.333 UTC","last_editor_display_name":"","last_editor_user_id":"1264339","owner_display_name":"","owner_user_id":"1264339","post_type_id":"1","score":"0","tags":"deployment|containers|mesos|marathon","view_count":"66"} +{"id":"40976405","title":"Access a mesos-cluster-manager behind a domain name (not an IP)","body":"\u003cp\u003eIs it possible to run and access a mesos cluster manager on a machine that is placed behind a proxy?\u003c/p\u003e\n\n\u003cp\u003eI have successfully succeeded to deployed a MesosClusterManager/Marathon/MesosSalve on my local infrastructure.\u003c/p\u003e\n\n\u003cp\u003eThe problem arises when I want to put the MesosSlave somewhere in the internet, so that MesosSlave and MesosClusterManager shall communicate through public IPs\u003c/p\u003e\n\n\u003cp\u003eMy conf is the following:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e Internet My Infra\n\n .----------------------. .-----------------. .-----------------. .-------------------------------------------------.\n | Mesos Slave VM | | Front Machine | | Proxy | | Tool-VM |\n | 178.22.17.248 | | 39.224.147.94 | | 10.2.0.57 | | 10.1.10.176 |\n |----------------------| | my.domain.com | |-----------------| | 192.168.5.1 (docker bridge) |\n | | |-----------------| | | |-------------------------------------------------|\n | | | | | | | |\n | __________ | | __________ | | __________ | | .-----------------------------. |\n | [_...__..5051.°]| |[_..5050.__...°] |\u0026lt;---|[_..5050.__...°] |\u0026lt;------------^| | Mesos-cluster-manager Container | |\n | | | | | | \\ __________ | 192.168.5.4 (docker bridge) | |\n | | | __________ | | __________ | |[_..5050.__...°]^|-----------------------------| |\n | | |[_..2181.__...°] |\u0026lt;---|[_..2181.__...°] |\u0026lt;------------^| \\ __________ | |\n | | | | | | \\ __________ |[_..5050.__...°] | |\n | | | | | | |[_..2181.__...°]^| __________ | |\n | | | | | | | \\[_..2181.__...°] | |\n | | | | | | | '-----------------------------' |\n '----------------------' '-----------------' '-----------------' '-------------------------------------------------'\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHowever:\u003c/p\u003e\n\n\u003cblockquote\u003e\n \u003cp\u003eMy domain infra redirect everthing that arrives from outside on ports 5050 (for Mesos) and port 2181 (zookeeper) \u003cstrong\u003eONLY\u003c/strong\u003e for requests that are addressed to the domain 'my.domain.com' (which is a virtualhost of 39.224.147.94). But not for the other requests (that are arriving on 39.224.147.94).\u003c/p\u003e\n\u003c/blockquote\u003e\n\n\u003cp\u003eSo I try to execute the service through CLI for the moment:\u003c/p\u003e\n\n\u003col\u003e\n\u003cli\u003eExecute \u003cstrong\u003eMesos Cluster Manager\u003c/strong\u003e(in Mesos Cluster Manager Container)\u003c/li\u003e\n\u003c/ol\u003e\n\n\u003cp\u003e\u003ccode\u003e/usr/sbin/mesos-cluster-manager --ip=192.168.5.4 --work_dir=~/Mesos/mesos-0.23.0/workdir/ --zk=zk://192.168.5.4:2181/mesos --quorum=1 --log_dir=/var/log/mesos --external_log_file=/dev/stdout\u003c/code\u003e\u003c/p\u003e\n\n\u003col start=\"2\"\u003e\n\u003cli\u003eExecute \u003cstrong\u003eMarathon\u003c/strong\u003e (in Mesos Cluster Manager Container)\u003c/li\u003e\n\u003c/ol\u003e\n\n\u003cp\u003e\u003ccode\u003e/usr/bin/marathon --zk zk://192.168.5.4:2181/marathon --cluster-manager zk://my.domain.com:2181/mesos\u003c/code\u003e\u003c/p\u003e\n\n\u003col start=\"3\"\u003e\n\u003cli\u003eExecute \u003cstrong\u003eMesos Slave\u003c/strong\u003e (in Mesos Slave VM)\u003c/li\u003e\n\u003c/ol\u003e\n\n\u003cp\u003e\u003ccode\u003e/usr/sbin/mesos-slave --cluster_manager=my.domain.com:5050 --work_dir=/var/lib/mesos/agent --port=8009 --containerizers=docker --executor_registration_timeout=3mins --log_dir=/var/log/mesos\u003c/code\u003e\u003c/p\u003e\n\n\u003cp\u003eThe Mesos Cluster Manager can see the Slave resources.\nHowever, when I send a Job through Marathon, this job stay in a \u003cstrong\u003ewaiting\u003c/strong\u003e state.\u003c/p\u003e\n\n\u003cp\u003eIt seems that the slave is not able to communicate on the hostname of the Cluster Manager, but only using it's public IP:\u003c/p\u003e\n\n\u003cp\u003eI have this in the Slave logs:\u003c/p\u003e\n\n\u003cblockquote\u003e\n \u003cp\u003eNew cluster_manager detected at cluster_manager@39.224.147.94:5050\u003c/p\u003e\n\u003c/blockquote\u003e\n\n\u003cp\u003eHowever incoming traffic on \u003cstrong\u003e39.224.147.94:5050\u003c/strong\u003e is blocked by my infra (only \u003cstrong\u003emy.domain.com:5050\u003c/strong\u003e is accepted)\u003c/p\u003e\n\n\u003cp\u003eSo, is it possible to create a connection between Cluster Manager and Slaves, using domain names, but not IPs?\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2016-12-05 14:20:34.99 UTC","last_activity_date":"2016-12-06 12:25:40.17 UTC","last_edit_date":"2016-12-06 09:25:57.333 UTC","last_editor_display_name":"","last_editor_user_id":"1264339","owner_display_name":"","owner_user_id":"1264339","post_type_id":"1","score":"0","tags":"deployment|containers|mesos|marathon","view_count":"66"} {"id":"41786937","title":"Color Text Only Partially Working","body":"\u003cp\u003eWhen I input something like:\u003c/p\u003e\n\n\u003cp\u003e\u003ccode\u003eprint('\\x1b[6;30;42m' + 'Success!' + '\\x1b[0m')\u003c/code\u003e\u003c/p\u003e\n\n\u003cp\u003ethe output I get is:\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"https://i.stack.imgur.com/9BKZT.png\" rel=\"nofollow noreferrer\"\u003e\u003cimg src=\"https://i.stack.imgur.com/9BKZT.png\" alt=\"enter image description here\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eWith no color.\u003c/p\u003e\n\n\u003cp\u003eI've heard you any need to enable vt100 emulation for windows, but when I search for how to do that, I haven't seen any answers.\u003c/p\u003e\n\n\u003cp\u003eAll answers are very appreciated!\u003c/p\u003e","answer_count":"1","comment_count":"1","creation_date":"2017-01-22 03:14:12.537 UTC","last_activity_date":"2017-01-22 03:39:54.217 UTC","last_edit_date":"2017-01-22 03:21:45.77 UTC","last_editor_display_name":"","last_editor_user_id":"6622587","owner_display_name":"","owner_user_id":"7423140","post_type_id":"1","score":"0","tags":"python|python-3.x","view_count":"33"} {"id":"24123585","title":"Java : image processing - how to get set of images to same standard","body":"\u003cp\u003eI need to develop the simple skin disease diagnose system using image processing and neural network. To use images in neural network, image should be same standard and, To identify the skin disease we should apply some image processing technique as well.\u003c/p\u003e\n\n\u003cp\u003eBut I don't know what image processing technique apply first and what are they? \n As I read from references I think I need to apply image filtering technique, edge detection technique , etc...\u003c/p\u003e\n\n\u003cp\u003eCan someone who is expert in this please specify the image processing technique step by step. no need coding I just want to know image processing technique names and there order.\u003c/p\u003e\n\n\u003cp\u003eThis is reference:\n\u003ca href=\"http://www.academia.edu/3131130/DERMATOLOGICAL_DISEASE_DIAGNOSIS_USING_COLOR-SKIN_IMAGES\" rel=\"nofollow\"\u003ereference\u003c/a\u003e \u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2014-06-09 15:30:51.693 UTC","last_activity_date":"2014-06-10 14:49:01.627 UTC","last_edit_date":"2014-06-10 14:49:01.627 UTC","last_editor_display_name":"","last_editor_user_id":"2420599","owner_display_name":"","owner_user_id":"3565768","post_type_id":"1","score":"0","tags":"java|image-processing|neural-network|edge-detection","view_count":"242"} {"id":"13427564","title":"Getting exceptions in dialog box having endless adapter implementation for its listview","body":"\u003cp\u003eThis is my Demo Adapter.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epublic class DemoAdapter extends EndlessAdapter {\n\n private RotateAnimation rotate = null;\n private View pendingView = null;\n private ArrayList\u0026lt;ShipTo\u0026gt; next;\n private static ArrayList\u0026lt;ShipTo\u0026gt; list;\n private int pageFrom = 1;\n private static Activity act;\n\n DemoAdapter(Context ctxt, ArrayList\u0026lt;ShipTo\u0026gt; list) {\n super(new Adapater());\n act = (Activity) ctxt;\n DemoAdapter.list = list;\n rotate = new RotateAnimation(0f, 360f, Animation.RELATIVE_TO_SELF,\n 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);\n rotate.setDuration(600);\n rotate.setRepeatMode(Animation.RESTART);\n rotate.setRepeatCount(Animation.INFINITE);\n }\n\n @Override\n protected View getPendingView(ViewGroup parent) {\n View row = LayoutInflater.from(parent.getContext()).inflate(\n R.layout.row, null);\n\n pendingView = row.findViewById(android.R.id.text1);\n pendingView.setVisibility(View.GONE);\n pendingView = row.findViewById(R.id.throbber);\n pendingView.setVisibility(View.VISIBLE);\n startProgressAnimation();\n\n return (row);\n }\n\n @Override\n protected boolean cacheInBackground() {\n // SystemClock.sleep(1000); // pretend to do work\n pageFrom += 10;\n next = ItemController.getInstance().getShipTo(pageFrom + \"\", \"10\", \"0\");\n return (ItemController.moreShipTo.equalsIgnoreCase(\"1\")) ? true : false;\n }\n\n @Override\n protected void appendCachedData() {\n if (next != null)\n list.addAll(next);\n if (!(ItemController.moreShipTo.equalsIgnoreCase(\"1\")) ? true : false)\n Toast.makeText(act, \"No More Category found\", Toast.LENGTH_SHORT)\n .show();\n\n }\n\n void startProgressAnimation() {\n if (pendingView != null) {\n pendingView.startAnimation(rotate);\n }\n }\n\n private static class Adapater extends BaseAdapter {\n\n private class ViewHolder {\n private TextView tv;\n }\n\n @Override\n public int getCount() {\n return list.size();\n }\n\n @Override\n public ShipTo getItem(int arg0) {\n return null;\n }\n\n @Override\n public long getItemId(int arg0) {\n return 0;\n }\n\n @Override\n public View getView(int arg0, View arg1, ViewGroup arg2) {\n\n try {\n ViewHolder viewHolder = null;\n ShipTo shipTo = list.get(arg0);\n LayoutInflater lf = (LayoutInflater) act\n .getSystemService(Context.LAYOUT_INFLATER_SERVICE);\n // if (arg1 == null) {\n viewHolder = new ViewHolder();\n arg1 = lf.inflate(R.layout.category_spinner_textview, null);\n viewHolder.tv = (TextView) arg1\n .findViewById(R.id.textView1_cat_spinner);\n\n arg1.setTag(viewHolder);\n /*\n * } else { viewHolder = (ViewHolder) arg1.getTag(); }\n */\n\n viewHolder.tv.setText(shipTo.getName());\n arg1.setTag(R.layout.category_spinner_textview, shipTo);\n viewHolder.tv.setPadding(5, 10, 0, 10);\n\n } catch (Exception e) {\n e.printStackTrace();\n\n }\n return arg1;\n }\n }\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThis is my activity for showing listview using endless adapter in Dialog box.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epublic class EndlessAdapterDemo extends Activity {\n public ArrayList\u0026lt;ShipTo\u0026gt; shipToList;\n\n @Override\n public void onCreate(Bundle icicle) {\n super.onCreate(icicle);\n setContentView(R.layout.main);\n Button button = (Button) findViewById(R.id.button1);\n\n button.setOnClickListener(new OnClickListener() {\n @Override\n public void onClick(View arg0) {\n new Thread(new Runnable() {\n @Override\n public void run() {\n shipToList = ItemController.getInstance().getShipTo(\n \"1\", \"10\", \"0\");\n\n runOnUiThread(new Runnable() {\n @Override\n public void run() {\n showCategoryList();\n }\n });\n }\n }).start();\n\n }\n });\n\n }\n\n private void showCategoryList() {\n final Dialog categoryDialog = new Dialog(this);\n categoryDialog.setTitle(\"Select Category\");\n categoryDialog.setContentView(R.layout.custumdialoglstview);\n ListView lv = (ListView) categoryDialog.findViewById(R.id.listView1);\n\n DemoAdapter adapter = null;\n\n if (adapter == null) {\n adapter = new DemoAdapter(EndlessAdapterDemo.this, shipToList);\n }\n lv.setAdapter(adapter);\n lv.setOnItemClickListener(new OnItemClickListener() {\n @Override\n public void onItemClick(AdapterView\u0026lt;?\u0026gt; arg0, View arg1, int arg2,\n long arg3) {\n System.out.println(arg1.getTag().getClass().getName());\n ShipTo temp = (ShipTo) arg1\n .getTag(R.layout.category_spinner_textview);\n categoryDialog.dismiss();\n\n }\n });\n categoryDialog.show();\n\n\n }\n\n }\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhen I run the above code it throws illegal state exception or null pointer exception. \u003c/p\u003e\n\n\u003cp\u003eFollowing is my logcat details\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e11-17 09:40:08.532: D/AndroidRuntime(331): Shutting down VM\n11-17 09:40:08.532: W/dalvikvm(331): threadid=1: thread exiting with uncaught exception (group=0x40015560)\n11-17 09:40:08.541: E/AndroidRuntime(331): FATAL EXCEPTION: main\n11-17 09:40:08.541: E/AndroidRuntime(331): java.lang.NullPointerException\n11-17 09:40:08.541: E/AndroidRuntime(331): at android.widget.ListView.measureScrapChild(ListView.java:1135)\n11-17 09:40:08.541: E/AndroidRuntime(331): at android.widget.ListView.measureHeightOfChildren(ListView.java:1218)\n11-17 09:40:08.541: E/AndroidRuntime(331): at android.widget.ListView.onMeasure(ListView.java:1127)\n11-17 09:40:08.541: E/AndroidRuntime(331): at android.view.View.measure(View.java:8313)\n11-17 09:40:08.541: E/AndroidRuntime(331): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)\n11-17 09:40:08.541: E/AndroidRuntime(331): at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1017)\n11-17 09:40:08.541: E/AndroidRuntime(331): at android.widget.LinearLayout.measureVertical(LinearLayout.java:386)\n11-17 09:40:08.541: E/AndroidRuntime(331): at android.widget.LinearLayout.onMeasure(LinearLayout.java:309)\n11-17 09:40:08.541: E/AndroidRuntime(331): at android.view.View.measure(View.java:8313)\n11-17 09:40:08.541: E/AndroidRuntime(331): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)\n11-17 09:40:08.541: E/AndroidRuntime(331): at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)\n11-17 09:40:08.541: E/AndroidRuntime(331): at android.view.View.measure(View.java:8313)\n11-17 09:40:08.541: E/AndroidRuntime(331): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)\n11-17 09:40:08.541: E/AndroidRuntime(331): at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)\n11-17 09:40:08.541: E/AndroidRuntime(331): at android.view.View.measure(View.java:8313)\n11-17 09:40:08.541: E/AndroidRuntime(331): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)\n11-17 09:40:08.541: E/AndroidRuntime(331): at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1017)\n11-17 09:40:08.541: E/AndroidRuntime(331): at android.widget.LinearLayout.measureVertical(LinearLayout.java:386)\n11-17 09:40:08.541: E/AndroidRuntime(331): at android.widget.LinearLayout.onMeasure(LinearLayout.java:309)\n11-17 09:40:08.541: E/AndroidRuntime(331): at android.view.View.measure(View.java:8313)\n11-17 09:40:08.541: E/AndroidRuntime(331): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)\n11-17 09:40:08.541: E/AndroidRuntime(331): at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)\n11-17 09:40:08.541: E/AndroidRuntime(331): at android.view.View.measure(View.java:8313)\n11-17 09:40:08.541: E/AndroidRuntime(331): at android.view.ViewRoot.performTraversals(ViewRoot.java:839)\n11-17 09:40:08.541: E/AndroidRuntime(331): at android.view.ViewRoot.handleMessage(ViewRoot.java:1859)\n11-17 09:40:08.541: E/AndroidRuntime(331): at android.os.Handler.dispatchMessage(Handler.java:99)\n11-17 09:40:08.541: E/AndroidRuntime(331): at android.os.Looper.loop(Looper.java:123)\n11-17 09:40:08.541: E/AndroidRuntime(331): at android.app.ActivityThread.main(ActivityThread.java:3683)\n11-17 09:40:08.541: E/AndroidRuntime(331): at java.lang.reflect.Method.invokeNative(Native Method)\n11-17 09:40:08.541: E/AndroidRuntime(331): at java.lang.reflect.Method.invoke(Method.java:507)\n11-17 09:40:08.541: E/AndroidRuntime(331): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)\n11-17 09:40:08.541: E/AndroidRuntime(331): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)\n11-17 09:40:08.541: E/AndroidRuntime(331): at dalvik.system.NativeStart.main(Native Method)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhat might be the problem?\u003c/p\u003e","accepted_answer_id":"17723143","answer_count":"1","comment_count":"5","creation_date":"2012-11-17 04:04:32.19 UTC","last_activity_date":"2014-06-16 17:39:58.937 UTC","last_edit_date":"2014-06-16 17:39:58.937 UTC","last_editor_display_name":"","last_editor_user_id":"115145","owner_display_name":"","owner_user_id":"1081355","post_type_id":"1","score":"3","tags":"android|commonsware-cwac","view_count":"342"} @@ -4641,14 +4641,14 @@ {"id":"18166543","title":"MYSQLDUMP failing. Couldn't execute 'SHOW TRIGGERS LIKE errors like (Errcode: 13) (6) and (1036)","body":"\u003cp\u003eDoes anyone know why MYSQLDUMP would only perform a partial backup of a database when run with the following instruction:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\"C:\\Program Files\\MySQL\\MySQL Server 5.5\\bin\\mysqldump\" databaseSchema -u root --password=rootPassword \u0026gt; c:\\backups\\daily\\mySchema.dump\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eSometimes a full backup is performed, at other times the backup will stop after including only a fraction of the database. This fraction is variable.\u003c/p\u003e\n\n\u003cp\u003eThe database does have several thousand tables totalling about 11Gb. But most of these tables are quite small with only about 1500 records, many only have 150 - 200 records. The column counts of these tables can be in the hundreds though because of the frequency data stored. \u003c/p\u003e\n\n\u003cp\u003eBut I am informed that the number of tables in a schema in MySQL is not an issue. There are also no performance issues during normal operation.\u003c/p\u003e\n\n\u003cp\u003eAnd the alternative of using a single table is not really viable because all of these tables have different column name signatures.\u003c/p\u003e\n\n\u003cp\u003eI should add that the database is in use during the backup.\u003c/p\u003e\n\n\u003cp\u003eWell after running the backup with instruction set:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\"C:\\Program Files\\MySQL\\MySQL Server 5.5\\bin\\mysqldump\" mySchema -u root --password=xxxxxxx -v --debug-check --log-error=c:\\backups\\daily\\mySchema_error.log \u0026gt; c:\\backups\\daily\\mySchema.dump\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI get this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003emysqldump: Couldn't execute 'SHOW TRIGGERS LIKE '\\_dm\\_10730\\_856956\\_30072013\\_1375194514706\\_keyword\\_frequencies'': Error on delete of 'C:\\Windows\\TEMP\\#sql67c_10_8c5.MYI' (Errcode: 13) (6)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWhich I think is a permissions problem.\u003c/p\u003e\n\n\u003cp\u003eI doubt any one table in my schema is in the 2GB range.\u003c/p\u003e\n\n\u003cp\u003eI am using MySQL Server 5.5 on a Windows 7 64 bit server with 8 Gb of memory.\u003c/p\u003e\n\n\u003cp\u003eAny ideas?\u003c/p\u003e\n\n\u003cp\u003eI am aware that changing the number of files which MySQL can open, the open_files_limit parameter, may cure this matter.\u003c/p\u003e\n\n\u003cp\u003eAnother possibility is interference from anti virus products as described here:\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"http://beerpla.net/2010/01/05/how-to-fix-intermittent-mysql-errcode-13-errors-on-windows/\" rel=\"nofollow\"\u003eHow To Fix Intermittent MySQL Errcode 13 Errors On Windows\u003c/a\u003e\u003c/p\u003e","answer_count":"1","comment_count":"7","creation_date":"2013-08-10 21:30:34.813 UTC","favorite_count":"1","last_activity_date":"2013-09-04 14:45:59.193 UTC","last_edit_date":"2013-09-04 14:45:59.193 UTC","last_editor_display_name":"","last_editor_user_id":"953331","owner_display_name":"","owner_user_id":"953331","post_type_id":"1","score":"6","tags":"mysql|mysqldump","view_count":"9429"} {"id":"24022737","title":"Solution for payment process required","body":"\u003cp\u003eWe have the following requirements for an online payment solution:\u003c/p\u003e\n\n\u003cul\u003e\n\u003cli\u003eThere are two types of users: Buyers and sellers.\u003c/li\u003e\n\u003cli\u003eOnly digital stuff is exchanged.\u003c/li\u003e\n\u003cli\u003eWhen a buyer buys content, money is sent to the seller immediately as well as a small fraction of the money to the website owners.\u003c/li\u003e\n\u003cli\u003eA buyer must before he can sell his offerings connect his account (that may be PayPal or any other service) to the platform to be able to receive money.\u003c/li\u003e\n\u003c/ul\u003e\n\n\u003cp\u003eNow, I'm not an expert in this field but my initial idea was to have a PayPal account with Mass Transactions enabled for this website which will receive all payments and then send money out to the sellers via API calls.\u003c/p\u003e\n\n\u003cp\u003eHowever, it would be very nice if it is possible to make this process completely external, a.k.a. use a service for payment which sends the bulk of the money to the seller but a small fraction to the shareholders (website owners). Of course, a seller must first connect his account to the platform to make sure in case one of his offerings was bought he can receive money.\u003c/p\u003e\n\n\u003cp\u003eAny ideas are well appreciated.\u003c/p\u003e","accepted_answer_id":"24023093","answer_count":"1","comment_count":"0","creation_date":"2014-06-03 18:51:07.193 UTC","last_activity_date":"2014-06-03 19:11:02.563 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"420097","post_type_id":"1","score":"1","tags":"paypal|payment|payment-processing","view_count":"79"} {"id":"14815717","title":"Multiple modules overriding same core file in Magento","body":"\u003cp\u003eHow does Magento handle multiple modules overriding the same core file? Is it possible? How is it done?\u003c/p\u003e","accepted_answer_id":"14815808","answer_count":"1","comment_count":"0","creation_date":"2013-02-11 15:52:54.083 UTC","favorite_count":"4","last_activity_date":"2013-05-19 19:40:56.093 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"821843","post_type_id":"1","score":"9","tags":"magento","view_count":"6350"} -{"id":"24812004","title":"Charfield not showing up in django form","body":"\u003cp\u003eI am creating a basic django site that uses django-userena. I am overriding the default signup form by creating a EditProfileFormExtra class on my forms.py. However, I am finding a very strange problem. The fields \"latitude\" and \"longitude\" do not show up. Changing the name of the fields seems to make them show up, but naming them \"lat\" or \"latitude\" and \"long\" or \"longitude\" makes them dissappear ?! Why is this?\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003efrom django import forms\nfrom django.utils.translation import ugettext_lazy as _\nfrom userena.forms import SignupForm\nfrom userena.forms import EditProfileForm\nfrom Couches.models import Location\nfrom django.core.validators import RegexValidator\n\n\n# Code adapted from: http://django-userena.readthedocs.org/en/latest/faq.html#how-do-i-add-extra-fields-to-forms\nclass SignupFormExtra(SignupForm):\n first_name = forms.CharField(label=_(u'First name'),\n max_length=30,\n required=True)\n last_name = forms.CharField(label=_(u'Last name'),\n max_length=30,\n required=True)\n latitude = forms.CharField(label=_(u'Latitude'),\n max_length=30,\n required=False,\n validators=[RegexValidator(regex='^[-+]?[0-9]*\\.?[0-9]+$'),])\n longitude = forms.CharField(label=_(u'Longitude'),\n max_length=30,\n required=False,\n validators=[RegexValidator(regex='^[-+]?[0-9]*\\.?[0-9]+$'),])\n\n def save(self):\n # First save the parent form and get the user.\n new_user = super(SignupFormExtra, self).save()\n new_user.first_name = self.cleaned_data['first_name']\n new_user.last_name = self.cleaned_data['last_name']\n new_user.save()\n\n Location.objects.create(available=True,\n user=new_user,\n latitude=self.cleaned_data['latitude'],\n longitude=self.cleaned_data['longitude'])\n\n return new_user\n\n\nclass EditProfileFormExtra(EditProfileForm):\n description = forms.CharField(label=_(u'Description'),\n max_length=300,\n required=False,\n widget=forms.Textarea)\n contact_information = forms.CharField(label=_(u'Contact Information'),\n max_length=300,\n required=False,\n widget=forms.Textarea)\n graduation_year = forms.CharField(label=_(u'Graduation Year'),\n max_length=4,\n required=False,\n validators=[RegexValidator(regex='^\\d{4}$'), ])\n address = forms.CharField(label=_(u'Contact Information'),\n max_length=100,\n required=False)\n # BUG: the two fields below do not appear on the form\n latitude = forms.CharField(label=_(u'Latitude'),\n max_length=30,\n required=False,\n validators=[RegexValidator(regex='^[-+]?[0-9]*\\.?[0-9]+$'), ])\n longitude = forms.CharField(label=_(u'lon'),\n max_length=30,\n required=False,\n validators=[RegexValidator(regex='^[-+]?[0-9]*\\.?[0-9]+$'), ])\n\n def save(self, force_insert=False, force_update=False, commit=True):\n profile = super(EditProfileFormExtra, self).save()\n profile.description = self.cleaned_data['description']\n profile.contact_information = self.cleaned_data['contact_information']\n profile.graduation_year = self.cleaned_data['graduation_year']\n\n location = Location.objects.get(user = profile.user)\n if(location):\n location.latitude = self.cleaned_data['latitude']\n location.longitude = self.cleaned_data['longitude']\n location.save()\n\n return profile\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThis is the template that shows the form:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e{% extends 'base.html' %}\n{% load i18n %}\n{% load url from future %}\n\n{% block title %}{% trans \"Account setup\" %}{% endblock %}\n\n{% block content_title %}\u0026lt;h2\u0026gt;{% blocktrans with profile.user.username as username %}Account \u0026amp;raquo; {{ username }}{% endblocktrans %}\u0026lt;/h2\u0026gt;{% endblock %}\n\n{% block content %}\n\nEdit your very own profile.\n\n\u0026lt;form action=\"\" enctype=\"multipart/form-data\" method=\"post\"\u0026gt;\n \u0026lt;ul id=\"box-nav\"\u0026gt;\n \u0026lt;li class=\"first\"\u0026gt;\u0026lt;a href=\"{% url 'userena_profile_detail' user.username %}\"\u0026gt;\u0026lt;span\u0026gt;{% trans 'View profile' %}\u0026lt;/span\u0026gt;\u0026lt;/a\u0026gt;\u0026lt;/li\u0026gt;\n \u0026lt;li class=\"selected\"\u0026gt;\u0026lt;a href=\"{% url 'userena_profile_edit' user.username %}\"\u0026gt;{% trans \"Edit profile\" %}\u0026lt;/a\u0026gt;\u0026lt;/li\u0026gt;\n \u0026lt;li\u0026gt;\u0026lt;a href=\"{% url 'userena_password_change' user.username %}\"\u0026gt;{% trans \"Change password\" %}\u0026lt;/a\u0026gt;\u0026lt;/li\u0026gt;\n \u0026lt;li class=\"last\"\u0026gt;\u0026lt;a href=\"{% url 'userena_email_change' user.username %}\"\u0026gt;{% trans \"Change email\" %}\u0026lt;/a\u0026gt;\u0026lt;/li\u0026gt;\n \u0026lt;/ul\u0026gt;\n {% csrf_token %}\n \u0026lt;fieldset\u0026gt;\n \u0026lt;legend\u0026gt;{% trans \"Edit Profile\" %}\u0026lt;/legend\u0026gt;\n {{ form.as_p }}\n \u0026lt;/fieldset\u0026gt;\n \u0026lt;input type=\"submit\" value=\"{% trans \"Save changes\" %}\" /\u0026gt;\n\u0026lt;/form\u0026gt;\n{% endblock %}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHere is the model:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003efrom django.db import models\nfrom django.contrib.auth.models import User\nfrom django.utils.translation import ugettext as _\nfrom userena.models import UserenaBaseProfile\nfrom django.core.validators import RegexValidator\n\n\nclass UserProfile(UserenaBaseProfile):\n user = models.OneToOneField(User,\n unique=True,\n verbose_name=_('user'),\n related_name='my_profile')\n\n first_name = models.TextField()\n last_name = models.TextField()\n description = models.CharField(max_length=300, blank=True)\n contact_information = models.CharField(max_length=300, blank=True) # extra contact information that the user wishes to include\n graduation_year = models.CharField(max_length=300, blank=True)\n address = models.CharField(max_length=100, blank=False)\n created_at = models.DateTimeField(auto_now_add=True)\n updated_at = models.DateTimeField(auto_now=True)\n\n def __unicode__(self):\n return u'%s %s' % (self.first_name, self.last_name)\n\n\nclass Location(models.Model):\n user = models.ForeignKey(User)\n available = models.BooleanField(default=True) # Is this location available to couchsurf\n\n latitude = models.CharField(max_length=30, validators=[RegexValidator(regex='^[-+]?[0-9]*\\.?[0-9]+$'),]) # floating point validator\n longitude = models.CharField(max_length=30, validators=[RegexValidator(regex='^[-+]?[0-9]*\\.?[0-9]+$'),]) # floating point validator\n\n created_at = models.DateTimeField(auto_now_add=True)\n updated_at = models.DateTimeField(auto_now=True)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThis is the view from django-userena (\u003ca href=\"https://github.com/bread-and-pepper/django-userena/blob/master/userena/views.py\" rel=\"nofollow\"\u003ehttps://github.com/bread-and-pepper/django-userena/blob/master/userena/views.py\u003c/a\u003e)\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eAdef profile_edit(request, username, edit_profile_form=EditProfileForm,\n template_name='userena/profile_form.html', success_url=None,\n extra_context=None, **kwargs):\n \"\"\"\nEdit profile.\n\nEdits a profile selected by the supplied username. First checks\npermissions if the user is allowed to edit this profile, if denied will\nshow a 404. When the profile is successfully edited will redirect to\n``success_url``.\n\n:param username:\nUsername of the user which profile should be edited.\n\n:param edit_profile_form:\n\nForm that is used to edit the profile. The :func:`EditProfileForm.save`\nmethod of this form will be called when the form\n:func:`EditProfileForm.is_valid`. Defaults to :class:`EditProfileForm`\nfrom userena.\n\n:param template_name:\nString of the template that is used to render this view. Defaults to\n``userena/edit_profile_form.html``.\n\n:param success_url:\nNamed URL which will be passed on to a django ``reverse`` function after\nthe form is successfully saved. Defaults to the ``userena_detail`` url.\n\n:param extra_context:\nDictionary containing variables that are passed on to the\n``template_name`` template. ``form`` key will always be the form used\nto edit the profile, and the ``profile`` key is always the edited\nprofile.\n\n**Context**\n\n``form``\nForm that is used to alter the profile.\n\n``profile``\nInstance of the ``Profile`` that is edited.\n\n\"\"\"\n user = get_object_or_404(get_user_model(),\n username__iexact=username)\n\n profile = user.get_profile()\n\n user_initial = {'first_name': user.first_name,\n 'last_name': user.last_name}\n\n form = edit_profile_form(instance=profile, initial=user_initial)\n\n if request.method == 'POST':\n form = edit_profile_form(request.POST, request.FILES, instance=profile,\n initial=user_initial)\n\n if form.is_valid():\n profile = form.save()\n\n if userena_settings.USERENA_USE_MESSAGES:\n messages.success(request, _('Your profile has been updated.'),\n fail_silently=True)\n\n if success_url:\n # Send a signal that the profile has changed\n userena_signals.profile_change.send(sender=None,\n user=user)\n redirect_to = success_url\n else: redirect_to = reverse('userena_profile_detail', kwargs={'username': username})\n return redirect(redirect_to)\n\n if not extra_context: extra_context = dict()\n extra_context['form'] = form\n extra_context['profile'] = profile\n return ExtraContextTemplateView.as_view(template_name=template_name,\n extra_context=extra_context)(request)\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"0","comment_count":"7","creation_date":"2014-07-17 19:33:49.62 UTC","last_activity_date":"2014-07-20 23:36:40.167 UTC","last_edit_date":"2014-07-20 23:36:40.167 UTC","last_editor_display_name":"","last_editor_user_id":"2624442","owner_display_name":"","owner_user_id":"2624442","post_type_id":"1","score":"0","tags":"python|django|forms","view_count":"227"} +{"id":"24812004","title":"Charfield not showing up in django form","body":"\u003cp\u003eI am creating a basic django site that uses django-userena. I am overriding the default signup form by creating a EditProfileFormExtra class on my forms.py. However, I am finding a very strange problem. The fields \"latitude\" and \"longitude\" do not show up. Changing the name of the fields seems to make them show up, but naming them \"lat\" or \"latitude\" and \"long\" or \"longitude\" makes them dissappear ?! Why is this?\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003efrom django import forms\nfrom django.utils.translation import ugettext_lazy as _\nfrom userena.forms import SignupForm\nfrom userena.forms import EditProfileForm\nfrom Couches.models import Location\nfrom django.core.validators import RegexValidator\n\n\n# Code adapted from: http://django-userena.readthedocs.org/en/latest/faq.html#how-do-i-add-extra-fields-to-forms\nclass SignupFormExtra(SignupForm):\n first_name = forms.CharField(label=_(u'First name'),\n max_length=30,\n required=True)\n last_name = forms.CharField(label=_(u'Last name'),\n max_length=30,\n required=True)\n latitude = forms.CharField(label=_(u'Latitude'),\n max_length=30,\n required=False,\n validators=[RegexValidator(regex='^[-+]?[0-9]*\\.?[0-9]+$'),])\n longitude = forms.CharField(label=_(u'Longitude'),\n max_length=30,\n required=False,\n validators=[RegexValidator(regex='^[-+]?[0-9]*\\.?[0-9]+$'),])\n\n def save(self):\n # First save the parent form and get the user.\n new_user = super(SignupFormExtra, self).save()\n new_user.first_name = self.cleaned_data['first_name']\n new_user.last_name = self.cleaned_data['last_name']\n new_user.save()\n\n Location.objects.create(available=True,\n user=new_user,\n latitude=self.cleaned_data['latitude'],\n longitude=self.cleaned_data['longitude'])\n\n return new_user\n\n\nclass EditProfileFormExtra(EditProfileForm):\n description = forms.CharField(label=_(u'Description'),\n max_length=300,\n required=False,\n widget=forms.Textarea)\n contact_information = forms.CharField(label=_(u'Contact Information'),\n max_length=300,\n required=False,\n widget=forms.Textarea)\n graduation_year = forms.CharField(label=_(u'Graduation Year'),\n max_length=4,\n required=False,\n validators=[RegexValidator(regex='^\\d{4}$'), ])\n address = forms.CharField(label=_(u'Contact Information'),\n max_length=100,\n required=False)\n # BUG: the two fields below do not appear on the form\n latitude = forms.CharField(label=_(u'Latitude'),\n max_length=30,\n required=False,\n validators=[RegexValidator(regex='^[-+]?[0-9]*\\.?[0-9]+$'), ])\n longitude = forms.CharField(label=_(u'lon'),\n max_length=30,\n required=False,\n validators=[RegexValidator(regex='^[-+]?[0-9]*\\.?[0-9]+$'), ])\n\n def save(self, force_insert=False, force_update=False, commit=True):\n profile = super(EditProfileFormExtra, self).save()\n profile.description = self.cleaned_data['description']\n profile.contact_information = self.cleaned_data['contact_information']\n profile.graduation_year = self.cleaned_data['graduation_year']\n\n location = Location.objects.get(user = profile.user)\n if(location):\n location.latitude = self.cleaned_data['latitude']\n location.longitude = self.cleaned_data['longitude']\n location.save()\n\n return profile\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThis is the template that shows the form:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e{% extends 'base.html' %}\n{% load i18n %}\n{% load url from future %}\n\n{% block title %}{% trans \"Account setup\" %}{% endblock %}\n\n{% block content_title %}\u0026lt;h2\u0026gt;{% blocktrans with profile.user.username as username %}Account \u0026amp;raquo; {{ username }}{% endblocktrans %}\u0026lt;/h2\u0026gt;{% endblock %}\n\n{% block content %}\n\nEdit your very own profile.\n\n\u0026lt;form action=\"\" enctype=\"multipart/form-data\" method=\"post\"\u0026gt;\n \u0026lt;ul id=\"box-nav\"\u0026gt;\n \u0026lt;li class=\"first\"\u0026gt;\u0026lt;a href=\"{% url 'userena_profile_detail' user.username %}\"\u0026gt;\u0026lt;span\u0026gt;{% trans 'View profile' %}\u0026lt;/span\u0026gt;\u0026lt;/a\u0026gt;\u0026lt;/li\u0026gt;\n \u0026lt;li class=\"selected\"\u0026gt;\u0026lt;a href=\"{% url 'userena_profile_edit' user.username %}\"\u0026gt;{% trans \"Edit profile\" %}\u0026lt;/a\u0026gt;\u0026lt;/li\u0026gt;\n \u0026lt;li\u0026gt;\u0026lt;a href=\"{% url 'userena_password_change' user.username %}\"\u0026gt;{% trans \"Change password\" %}\u0026lt;/a\u0026gt;\u0026lt;/li\u0026gt;\n \u0026lt;li class=\"last\"\u0026gt;\u0026lt;a href=\"{% url 'userena_email_change' user.username %}\"\u0026gt;{% trans \"Change email\" %}\u0026lt;/a\u0026gt;\u0026lt;/li\u0026gt;\n \u0026lt;/ul\u0026gt;\n {% csrf_token %}\n \u0026lt;fieldset\u0026gt;\n \u0026lt;legend\u0026gt;{% trans \"Edit Profile\" %}\u0026lt;/legend\u0026gt;\n {{ form.as_p }}\n \u0026lt;/fieldset\u0026gt;\n \u0026lt;input type=\"submit\" value=\"{% trans \"Save changes\" %}\" /\u0026gt;\n\u0026lt;/form\u0026gt;\n{% endblock %}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHere is the model:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003efrom django.db import models\nfrom django.contrib.auth.models import User\nfrom django.utils.translation import ugettext as _\nfrom userena.models import UserenaBaseProfile\nfrom django.core.validators import RegexValidator\n\n\nclass UserProfile(UserenaBaseProfile):\n user = models.OneToOneField(User,\n unique=True,\n verbose_name=_('user'),\n related_name='my_profile')\n\n first_name = models.TextField()\n last_name = models.TextField()\n description = models.CharField(max_length=300, blank=True)\n contact_information = models.CharField(max_length=300, blank=True) # extra contact information that the user wishes to include\n graduation_year = models.CharField(max_length=300, blank=True)\n address = models.CharField(max_length=100, blank=False)\n created_at = models.DateTimeField(auto_now_add=True)\n updated_at = models.DateTimeField(auto_now=True)\n\n def __unicode__(self):\n return u'%s %s' % (self.first_name, self.last_name)\n\n\nclass Location(models.Model):\n user = models.ForeignKey(User)\n available = models.BooleanField(default=True) # Is this location available to couchsurf\n\n latitude = models.CharField(max_length=30, validators=[RegexValidator(regex='^[-+]?[0-9]*\\.?[0-9]+$'),]) # floating point validator\n longitude = models.CharField(max_length=30, validators=[RegexValidator(regex='^[-+]?[0-9]*\\.?[0-9]+$'),]) # floating point validator\n\n created_at = models.DateTimeField(auto_now_add=True)\n updated_at = models.DateTimeField(auto_now=True)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThis is the view from django-userena (\u003ca href=\"https://github.com/bread-and-pepper/django-userena/blob/main/userena/views.py\" rel=\"nofollow\"\u003ehttps://github.com/bread-and-pepper/django-userena/blob/main/userena/views.py\u003c/a\u003e)\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eAdef profile_edit(request, username, edit_profile_form=EditProfileForm,\n template_name='userena/profile_form.html', success_url=None,\n extra_context=None, **kwargs):\n \"\"\"\nEdit profile.\n\nEdits a profile selected by the supplied username. First checks\npermissions if the user is allowed to edit this profile, if denied will\nshow a 404. When the profile is successfully edited will redirect to\n``success_url``.\n\n:param username:\nUsername of the user which profile should be edited.\n\n:param edit_profile_form:\n\nForm that is used to edit the profile. The :func:`EditProfileForm.save`\nmethod of this form will be called when the form\n:func:`EditProfileForm.is_valid`. Defaults to :class:`EditProfileForm`\nfrom userena.\n\n:param template_name:\nString of the template that is used to render this view. Defaults to\n``userena/edit_profile_form.html``.\n\n:param success_url:\nNamed URL which will be passed on to a django ``reverse`` function after\nthe form is successfully saved. Defaults to the ``userena_detail`` url.\n\n:param extra_context:\nDictionary containing variables that are passed on to the\n``template_name`` template. ``form`` key will always be the form used\nto edit the profile, and the ``profile`` key is always the edited\nprofile.\n\n**Context**\n\n``form``\nForm that is used to alter the profile.\n\n``profile``\nInstance of the ``Profile`` that is edited.\n\n\"\"\"\n user = get_object_or_404(get_user_model(),\n username__iexact=username)\n\n profile = user.get_profile()\n\n user_initial = {'first_name': user.first_name,\n 'last_name': user.last_name}\n\n form = edit_profile_form(instance=profile, initial=user_initial)\n\n if request.method == 'POST':\n form = edit_profile_form(request.POST, request.FILES, instance=profile,\n initial=user_initial)\n\n if form.is_valid():\n profile = form.save()\n\n if userena_settings.USERENA_USE_MESSAGES:\n messages.success(request, _('Your profile has been updated.'),\n fail_silently=True)\n\n if success_url:\n # Send a signal that the profile has changed\n userena_signals.profile_change.send(sender=None,\n user=user)\n redirect_to = success_url\n else: redirect_to = reverse('userena_profile_detail', kwargs={'username': username})\n return redirect(redirect_to)\n\n if not extra_context: extra_context = dict()\n extra_context['form'] = form\n extra_context['profile'] = profile\n return ExtraContextTemplateView.as_view(template_name=template_name,\n extra_context=extra_context)(request)\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"0","comment_count":"7","creation_date":"2014-07-17 19:33:49.62 UTC","last_activity_date":"2014-07-20 23:36:40.167 UTC","last_edit_date":"2014-07-20 23:36:40.167 UTC","last_editor_display_name":"","last_editor_user_id":"2624442","owner_display_name":"","owner_user_id":"2624442","post_type_id":"1","score":"0","tags":"python|django|forms","view_count":"227"} {"id":"26138958","title":"Mongo Update value, inside an array inside an array for aggregation","body":"\u003cp\u003eI have this kind of document:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e{\n \"_id\" : 1,\n \"bMeta\" : [\n \"c33b9ce5ca46075336134a8092bebbbf\"\n ],\n \"ip\" : [\n \"a17bdc3ee98c002570b032dfe67f9680\"\n ],\n \"history\" : [\n {\n \"type\" : \"pType\",\n \"name\" : \"home\",\n \"score\" : 0,\n \"seen\" : [\n {\n \"year\" : 2014,\n \"week\" : 40,\n \"score\" : 0\n },\n {\n \"year\" : 2013,\n \"week\" : 51,\n \"score\" : 0\n }\n ]\n }\n ]\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI'd like to update ($inc) the 'score' values for \u003ccode\u003ehistory.$.score\u003c/code\u003e and \u003ccode\u003ehistory.$.seen.$.score\u003c/code\u003e where \u003ccode\u003eseen.year\u003c/code\u003e = 2014.\u003c/p\u003e\n\n\u003cp\u003eOf course, I can't use more than one \u003ccode\u003e$\u003c/code\u003e so it's not working like that. It's just to show what I need to do.\u003c/p\u003e\n\n\u003cp\u003eHow would you update it? Knowing that the main goal is to be able to aggregate value with somethink like:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003edb.users.aggregate([\n {\n '$match':\n {\n '_id' : 1\n }\n },\n { '$unwind': '$history' },\n {\n '$match':\n {\n 'history.type' : 'pType',\n 'history.name' : 'home'\n }\n },\n { '$unwind': '$history.seen' },\n { '$match': { 'history.seen.year' : 2014 } },\n { '$match': { 'history.seen.week' : { $gte: 27 } } },\n { '$group': { _id: '$history.name', total_recent_score: { \"$sum\": \"$history.seen.score\" } } },\n { '$sort': { total_recent_score: -1 } },\n { '$limit': 5 }\n]).pretty();\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eDo you think of a better document structure to achieve that?\u003c/p\u003e","answer_count":"0","comment_count":"4","creation_date":"2014-10-01 10:09:33.84 UTC","favorite_count":"1","last_activity_date":"2014-10-01 17:07:15.573 UTC","last_edit_date":"2014-10-01 13:21:00.87 UTC","last_editor_display_name":"","last_editor_user_id":"2667369","owner_display_name":"","owner_user_id":"2667369","post_type_id":"1","score":"1","tags":"mongodb|mongodb-query|aggregation-framework","view_count":"114"} {"id":"15826085","title":"server side scripting in to javascript","body":"\u003cp\u003ei am try to get latitude and longitude value from ip address \u003cbr\u003e\nafter getting lat and lng value POST in to php file using AJAX and generate new xml file\u003cbr\u003e\u003c/p\u003e\n\n\u003cp\u003ethis is my html file:-\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;html xmlns=\"http://www.w3.org/1999/xhtml\"\u0026gt;\n \u0026lt;head\u0026gt;\n \u0026lt;script type=\"text/javascript\" src=\"http://j.maxmind.com/app/geoip.js\" \u0026gt;\u0026lt;/script\u0026gt;\n \u0026lt;script src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js\"\u0026gt;\u0026lt;/script\u0026gt;\n \u0026lt;script\u0026gt;\n function getlg(){\n var lan=geoip_latitude();\n var lng=geoip_longitude();\n var gen = $('#Sex').val();\n var date = $('#date').val();\n $.ajax({ \n type: \"POST\",\n url: \"http://localhost/SVN/trunk/home/url.php?lat=\"+lan+\"\u0026amp;lng=\"+lng+'\u0026amp;radius'+$('#radius1').val(),\n contentType: \"text/html\",\n success: function(token) {\n\n },\n error:function (xhr, ajaxOptions, thrownError){\n alert(xhr.statusText);\n alert(thrownError);\n } \n });\n\n }\n \u0026lt;/script\u0026gt;\n \u0026lt;body\u0026gt;\n\u0026lt;div id=\"region\"\u0026gt;\u0026lt;h5\u0026gt;\u0026lt;/h5\u0026gt;\u0026lt;/div\u0026gt;\nEnter Radius: \u0026lt;input type=\"text\" id=\"radius1\"\u0026gt;\u0026lt;/input\u0026gt;\n\u0026lt;input type=\"button\" id=\"filter\"onclick=\"getlg()\" value=\"Go\"\u0026gt;\n\u0026lt;/body\u0026gt;\n\u0026lt;/head\u0026gt;\n\u0026lt;/html\u0026gt; \n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003cbr\u003e\nthis is my php file:-\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;?php\nfunction convertNodeValueChars($node) {\n if ($node-\u0026gt;hasChildNodes()) {\n foreach ($node-\u0026gt;childNodes as $childNode) {\n if ($childNode-\u0026gt;nodeType == XML_TEXT_NODE) {\n $childNode-\u0026gt;nodeValue = iconv('utf-8', 'ascii//TRANSLIT', $childNode-\u0026gt;nodeValue);\n }\n convertNodeValueChars($childNode); \n }\n } \n } \n$url='http://services.gisgraphy.com/geoloc/search?lat='.$_GET['lat'].'\u0026amp;lng='.$_GET['lng'].'\u0026amp;radius='.$_GET['radius'];\n $doc = new DOMDocument();\n $doc-\u0026gt;load($url);\n $doc-\u0026gt;save('General.xml');\n?\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ein this file i am try to Get lat and long and radius from html ajax function and getting one new xml file with help of url.\u003cbr\u003e\nbut its take so much time if radius is biggest. \u003cbr\u003e\ni want to try this php code in java script dont like server side scripting.\u003cbr\u003e\nplease help me out with this...\u003cbr\u003e\nthanks...\u003c/p\u003e","accepted_answer_id":"15826323","answer_count":"1","comment_count":"0","creation_date":"2013-04-05 04:46:34.707 UTC","last_activity_date":"2013-05-27 10:35:30.277 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"2156869","post_type_id":"1","score":"0","tags":"javascript|jquery|xml|url","view_count":"189"} {"id":"35867030","title":"How to change reactid suffix in react component","body":"\u003cp\u003eHow to change \u003ccode\u003edata-reactid\u003c/code\u003e attributes to my custom attributes like \u003ccode\u003edata-hello=\"world\"\u003c/code\u003e in react?\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;a data-reactid=\"......\" \u0026gt;\u0026lt;/a\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"35970533","answer_count":"2","comment_count":"7","creation_date":"2016-03-08 12:10:01.163 UTC","favorite_count":"1","last_activity_date":"2016-04-27 23:14:58.92 UTC","last_edit_date":"2016-04-27 23:14:58.92 UTC","last_editor_display_name":"","last_editor_user_id":"759866","owner_display_name":"","owner_user_id":"5720647","post_type_id":"1","score":"0","tags":"javascript|reactjs","view_count":"349"} {"id":"10416752","title":"Build and reference my own local package in Go","body":"\u003cp\u003eI'm playing with Google Go and I'm having fun (!), but I'm having some problems with package subsystem.\u003c/p\u003e\n\n\u003cp\u003eI'm running \u003cstrong\u003eGo 1.0.1\u003c/strong\u003e on Mac OS X Lion. I've build also various single file programs without problems (I've also build a small webapp using html/templates without problems and it compiles and runs without any error).\u003c/p\u003e\n\n\u003cp\u003eI've defined a \"reusable\" package (even.go):\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epackage even\n\nfunc Even(i int) bool {\n return i % 2 == 0\n}\n\nfunc Odd(i int) bool {\n return i % 2 == 1\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eand a consumer program (useeven.go):\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003epackage main\n\nimport (\n \"./even\"\n \"fmt\"\n)\n\nfunc main() {\n a := 5\n b := 6\n\n fmt.Printf(\"%d is even %v?\\n\", a, even.Even(a))\n fmt.Printf(\"%d is odd %v?\\n\", b, even.Odd(b))\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eBut when I compile the \"library\" using\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ego build even.go\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI got nothing... No errors, no message... What happens?\u003c/p\u003e\n\n\u003cp\u003eHow should I do this?\u003c/p\u003e","accepted_answer_id":"10417714","answer_count":"2","comment_count":"2","creation_date":"2012-05-02 15:22:31.863 UTC","favorite_count":"1","last_activity_date":"2014-11-07 11:35:00.57 UTC","last_edit_date":"2014-11-07 11:35:00.57 UTC","last_editor_display_name":"","last_editor_user_id":"13860","owner_display_name":"","owner_user_id":"1035792","post_type_id":"1","score":"12","tags":"compilation|package|go","view_count":"12786"} {"id":"25616693","title":"Why won't this compile in VS Express 2013, though it compiles in MinGW?","body":"\u003cp\u003eHere's a compilable sample I stitched together from several header files. The code won't make sense because I gutted all the irrelevant parts, but the gist is that I'm implementing Scott Meyers' data proxy technique (mentioned \u003ca href=\"https://stackoverflow.com/questions/7410559/c-overloading-operators-based-on-the-side-of-assignment/7411385#7411385\"\u003ehere\u003c/a\u003e), though it's evolved into more of a wrapper than a temporary proxy. None of that should matter though—my question seems to be purely regarding a difference in compiler behaviors.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e#include \u0026lt;iostream\u0026gt;\n#include \u0026lt;vector\u0026gt;\n\ntemplate\u0026lt;typename T\u0026gt;\nclass Proxy\n{\npublic:\n enum class State\n {\n NEVER_SET = 0,\n SET,\n UNSET\n };\n operator const T\u0026amp; () const\n {\n if ( _state != State::SET )\n {\n std::cout \u0026lt;\u0026lt; \"EXCEPTION\" \u0026lt;\u0026lt; std::endl;\n // TODO throw exception\n }\n return _data;\n }\n Proxy\u0026lt;T\u0026gt;\u0026amp; operator=(const T\u0026amp; val)\n {\n _data = val;\n _state = State::SET;\n return (*this);\n }\n Proxy\u0026lt;T\u0026gt;\u0026amp; operator+=(const T\u0026amp; val)\n {\n _data = (*this) + val;\n _state = State::SET;\n return (*this);\n }\nprivate:\n T _data;\n State _state = State::NEVER_SET;\n};\n\nclass Tape\n{\n};\n\ntemplate\u0026lt;typename T\u0026gt;\nclass tape : public Tape\n{\npublic:\n const Proxy\u0026lt;T\u0026gt;\u0026amp; operator[](int idx) const\n {\n return operator[](idx);\n }\n Proxy\u0026lt;T\u0026gt;\u0026amp; operator[](int idx)\n {\n if ( idx \u0026gt;= data.size() )\n {\n data.resize(idx + 1);\n }\n return data[idx];\n }\nprivate:\n std::vector\u0026lt; Proxy\u0026lt;T\u0026gt; \u0026gt; data;\n};\n\nclass CRIXUS\n{\npublic:\n virtual void Go() final {};\nprotected:\n virtual void Pre() {};\n virtual void Post() {};\n virtual void Step() = 0;\n};\n\nclass CRIXUS_MA : public CRIXUS\n{\npublic:\n int window = 30;\n tape\u0026lt;double\u0026gt; input;\n tape\u0026lt;double\u0026gt; output;\nprotected:\n virtual void Step()\n {\n double sum = 0;\n for ( int j = 0; j \u0026lt; window; j++ )\n {\n sum += input[-j];\n }\n output[0] = sum / window;\n }\n};\n\nint main()\n{\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eIt compiles fine on \u003ca href=\"http://ideone.com/EC8gwB\" rel=\"nofollow noreferrer\"\u003eIdeone\u003c/a\u003e as well as via Jetbrain's CLion (Toolchain: MinGW 3.20, CMake 2.8.12.2):\u003c/p\u003e\n\n\u003cp\u003e\u003cimg src=\"https://i.stack.imgur.com/gq7ma.png\" alt=\"enter image description here\"\u003e\u003c/p\u003e\n\n\u003cp\u003eHowever it won't compile on VS Express 2013:\u003c/p\u003e\n\n\u003cp\u003e\u003cimg src=\"https://i.stack.imgur.com/d8yhg.png\" alt=\"enter image description here\"\u003e\u003c/p\u003e\n\n\u003cp\u003eRunning the full code from CLion (which involves reading a .csv file of numbers and outputting a moving average), I can verify that the output is correct. It's just that VS won't compile the code.\u003c/p\u003e\n\n\u003cp\u003eAs far as I can tell, the cast operator\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e operator const T\u0026amp; () const\n {\n if ( _state != State::SET )\n {\n std::cout \u0026lt;\u0026lt; \"EXCEPTION\" \u0026lt;\u0026lt; std::endl;\n // TODO throw exception\n }\n return _data;\n }\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eshould convert the \u003ccode\u003eProxy\u0026lt;T\u0026gt;\u003c/code\u003e to \u003ccode\u003eT\u003c/code\u003e, \u003cem\u003ei.e.\u003c/em\u003e \u003ccode\u003eProxy\u0026lt;double\u0026gt;\u003c/code\u003e to \u003ccode\u003edouble\u003c/code\u003e. And when I forcibly cast the offending line,\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e sum += (double)input[-j];\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eit works fine. Any ideas?\u003c/p\u003e","accepted_answer_id":"25617043","answer_count":"1","comment_count":"10","creation_date":"2014-09-02 05:52:47.397 UTC","last_activity_date":"2014-09-02 06:23:06.52 UTC","last_edit_date":"2017-05-23 11:57:15.46 UTC","last_editor_display_name":"","last_editor_user_id":"-1","owner_display_name":"","owner_user_id":"925913","post_type_id":"1","score":"3","tags":"c++|compiler-errors|visual-studio-2013|mingw|visual-studio-express","view_count":"136"} {"id":"18901722","title":"Temp table from two functions into a pivot table","body":"\u003cp\u003eI need to create a pivot table from two functions, because of the number of records involved in this, I want to use a temp table.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eSELECT [OrderNumber]\n ,[OrderName]\n ,[Code]\n ,[Amount1]\n INTO #TempPayment \nFROM [dbo].[fn_Reconciliation_PaymentByDateRange](@BeginDate,@EndDate) \n\nSELECT [OrderNumber]\n ,[OrderName]\n ,[Code]\n ,[Amount1]\n INTO #TempInvoice\nFROM [dbo].[fn_Reconciliation_InvoiceByDateRange](@BeginDate,@EndDate) \n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe above is what I was using for creating 2 temp tables, but I would like to see if I could condense it down into one temp table.\u003c/p\u003e\n\n\u003cp\u003eEnd result of this is that I need to be able to pull the \"Select\" portion listed above and then \u003ccode\u003epivot\u003c/code\u003e them on the \u003ccode\u003eCode\u003c/code\u003e Column. I can handle that, but I don't really want to end up generating a 3rd Temp table, but I think I might end up needing to.\u003c/p\u003e","answer_count":"1","comment_count":"0","creation_date":"2013-09-19 17:53:27.393 UTC","last_activity_date":"2013-09-19 18:36:45.003 UTC","last_edit_date":"2013-09-19 17:58:20.913 UTC","last_editor_display_name":"","last_editor_user_id":"2055998","owner_display_name":"","owner_user_id":"2217517","post_type_id":"1","score":"0","tags":"sql|sql-server|function|pivot","view_count":"48"} -{"id":"13498395","title":"Left join on character + linking value","body":"\u003cp\u003eI'll keep this simple. I need to left join 2 tables, Master \u0026amp; Child both with a PartNum field. Values for the fields are like this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eMaster\n-----\n1003\n1004\n1005\n...\n\nChild\n-----\n1003\nC1003\nK1003\npp1003\ncc1003\n1004\n...\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI only want to join on child records beginning with a single 'C', \u003c/p\u003e\n\n\u003cp\u003eso...\u003c/p\u003e\n\n\u003cp\u003e1003 would only return C1003\u003c/p\u003e\n\n\u003cp\u003eAny help for this MySql newbie would be appreciated.\u003c/p\u003e\n\n\u003cp\u003eThanks!\u003c/p\u003e","answer_count":"2","comment_count":"0","creation_date":"2012-11-21 17:07:17.453 UTC","last_activity_date":"2012-11-21 17:16:41.75 UTC","last_edit_date":"2012-11-21 17:10:23.967 UTC","last_editor_display_name":"","last_editor_user_id":"426671","owner_display_name":"","owner_user_id":"1842670","post_type_id":"1","score":"2","tags":"mysql","view_count":"77"} +{"id":"13498395","title":"Left join on character + linking value","body":"\u003cp\u003eI'll keep this simple. I need to left join 2 tables, Cluster Manager \u0026amp; Child both with a PartNum field. Values for the fields are like this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eMaster\n-----\n1003\n1004\n1005\n...\n\nChild\n-----\n1003\nC1003\nK1003\npp1003\ncc1003\n1004\n...\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI only want to join on child records beginning with a single 'C', \u003c/p\u003e\n\n\u003cp\u003eso...\u003c/p\u003e\n\n\u003cp\u003e1003 would only return C1003\u003c/p\u003e\n\n\u003cp\u003eAny help for this MySql newbie would be appreciated.\u003c/p\u003e\n\n\u003cp\u003eThanks!\u003c/p\u003e","answer_count":"2","comment_count":"0","creation_date":"2012-11-21 17:07:17.453 UTC","last_activity_date":"2012-11-21 17:16:41.75 UTC","last_edit_date":"2012-11-21 17:10:23.967 UTC","last_editor_display_name":"","last_editor_user_id":"426671","owner_display_name":"","owner_user_id":"1842670","post_type_id":"1","score":"2","tags":"mysql","view_count":"77"} {"id":"24182509","title":"Catch error messages from ksh script executed by getRuntime().exec using getErrorStream?","body":"\u003cp\u003eI need to execute ksh script from java, where I want to exit with error and provide error message.\u003c/p\u003e\n\n\u003cp\u003eexit 1 - exits with error code 1 \u003c/p\u003e\n\n\u003cp\u003eBut what should I do in script in order to catch the error message with getErrorStream?\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e proc = Runtime.getRuntime().exec(SCRIPT_PATH);\n\n int exitV = proc.waitFor();\nif(exitV !=0){\n InputStream iputStream= proc.getErrorStream();\n BufferedReader iput = new BufferedReader(new InputStreamReader(iputStream));\n while ((line = iput.readLine()) != null){\n msg.append(line);\n }\n}\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"1","comment_count":"0","creation_date":"2014-06-12 10:48:20.07 UTC","last_activity_date":"2014-06-12 10:50:36.043 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1847484","post_type_id":"1","score":"0","tags":"java|unix|ksh","view_count":"92"} {"id":"20543282","title":"accessing phonegap database in android native","body":"\u003cp\u003eI m new to phone gap platform.\nI'm facing a issue in accessing the phone gap db in android native code.\u003c/p\u003e\n\n\u003cp\u003eIn one of the application I want to do a synch mechanism\nFor every 10 minutes the alarm broadcast receiver will wake up the class and start a background service. In that service we are accessing the phone gap db . if in case the db is being used by the JavaScript code, n I start to fetch the record from the same db , I'm getting an exception SQL ITE database locked exception .. Please help me in sorting out this problem.\u003c/p\u003e\n\n\u003cp\u003eThanks.\u003c/p\u003e","answer_count":"0","comment_count":"0","creation_date":"2013-12-12 12:15:04.643 UTC","favorite_count":"1","last_activity_date":"2013-12-12 12:15:04.643 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"831051","post_type_id":"1","score":"2","tags":"cordova","view_count":"200"} {"id":"42944520","title":"Installing Wordpress in Windows Hosting Godaddy Subfolder: 500 Server Error","body":"\u003cp\u003eI have a newly purchased Windows Hosting in GoDaddy with its own domain name. Before anything else, I wanted to install a wordpress blog in the subfolder of the domain like so: \u003ccode\u003ehttp://example.com/blog\u003c/code\u003e. I followed the step by step tutorial provided by GoDaddy but when I try to browse example.com/blog it throws 500 server error. \u003c/p\u003e\n\n\u003cp\u003eI tried doing the same installation procedure but this time using the subdomain like so: \u003ccode\u003eblog.example.com\u003c/code\u003e and it worked without problem. I would like to use a subfolder in my domain instead of a subdomain. Is there a pre-configuration steps (nowhere to be found in the installation guide) I have to do in order to do so?\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eUPDATE\u003c/strong\u003e: I tried browsing for solutions and it seemed to me that my problem might be about \u003ccode\u003e.htaccess\u003c/code\u003e but I don't exactly know how to configure or where to find it (im a total newbie in web hosting esp godaddy). Please ask if you need more details. Thank you.\u003c/p\u003e","answer_count":"0","comment_count":"2","creation_date":"2017-03-22 06:46:52.933 UTC","last_activity_date":"2017-03-22 06:52:16.573 UTC","last_edit_date":"2017-03-22 06:52:16.573 UTC","last_editor_display_name":"","last_editor_user_id":"4771953","owner_display_name":"","owner_user_id":"4771953","post_type_id":"1","score":"0","tags":"wordpress","view_count":"127"} @@ -4673,7 +4673,7 @@ {"id":"12039194","title":"get a specific number in a string","body":"\u003cp\u003eI am trying to parse a text and get a value from a text like:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ePage 1 of 6\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI am looking at extracting the end number using java.\nso my out put in this case should be 6.\u003c/p\u003e\n\n\u003cp\u003eis there any java string functions I can use? (or) any other way? \u003c/p\u003e","accepted_answer_id":"12039211","answer_count":"5","comment_count":"3","creation_date":"2012-08-20 14:05:47.94 UTC","last_activity_date":"2012-08-20 14:25:49.093 UTC","last_edit_date":"2012-08-20 14:25:49.093 UTC","last_editor_display_name":"","last_editor_user_id":"1460628","owner_display_name":"","owner_user_id":"1530845","post_type_id":"1","score":"0","tags":"java|parsing","view_count":"170"} {"id":"37954429","title":"Disable next navigation link in bootstrap wizard","body":"\u003cp\u003eI have a simple bootstrap wizard. I want to disable the next navigation link based on some condition. Can someone please tell me how to do it using jQuery or CSS or any other method.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e \u0026lt;div id=\"rootwizard\"\u0026gt;\n \u0026lt;div class=\"navbar\"\u0026gt;\n \u0026lt;div class=\"navbar-inner\"\u0026gt;\n \u0026lt;div class=\"container\"\u0026gt;\n \u0026lt;ul\u0026gt;\n \u0026lt;li\u0026gt;\u0026lt;a href=\"#tab1\" data-toggle=\"tab\"\u0026gt;Item Search\u0026lt;/a\u0026gt;\u0026lt;/li\u0026gt;\n \u0026lt;li\u0026gt;\u0026lt;a href=\"#tab2\" data-toggle=\"tab\"\u0026gt;Item Details\u0026lt;/a\u0026gt;\u0026lt;/li\u0026gt;\n \u0026lt;li\u0026gt;\u0026lt;a href=\"#tab3\" data-toggle=\"tab\"\u0026gt;Add SPR\u0026lt;/a\u0026gt;\u0026lt;/li\u0026gt;\n \u0026lt;/ul\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;/div\u0026gt;\n \u0026lt;/div\u0026gt;\n\n \u0026lt;div class=\"tab-content\"\u0026gt;\n \u0026lt;ul class=\"pager wizard\"\u0026gt;\n \u0026lt;li class=\"previous first\" style=\"display: none;\"\u0026gt;\u0026lt;a href=\"#\"\u0026gt;First\u0026lt;/a\u0026gt;\u0026lt;/li\u0026gt;\n \u0026lt;li class=\"previous\"\u0026gt;\u0026lt;a href=\"#\"\u0026gt;Previous\u0026lt;/a\u0026gt;\u0026lt;/li\u0026gt;\n \u0026lt;li class=\"next last\" style=\"display: none;\"\u0026gt;\u0026lt;a href=\"#\"\u0026gt;Last\u0026lt;/a\u0026gt;\u0026lt;/li\u0026gt;\n \u0026lt;li class=\"next\"\u0026gt;\u0026lt;a href=\"#\"\u0026gt;Next\u0026lt;/a\u0026gt;\u0026lt;/li\u0026gt;\n \u0026lt;/ul\u0026gt;\n\u0026lt;/div\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThanks\u003c/p\u003e","accepted_answer_id":"37954648","answer_count":"3","comment_count":"2","creation_date":"2016-06-21 20:56:29.877 UTC","last_activity_date":"2016-06-21 21:15:08.617 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"3637345","post_type_id":"1","score":"-1","tags":"javascript|jquery|css|twitter-bootstrap","view_count":"923"} {"id":"14038619","title":"How can I create popup window by jquery to external page and get a value from it to the parent page when I click a button there?","body":"\u003cp\u003eHow can I create popup window by jquery to external page that contain a form and get a value from that external page to the parent page when I click a button there?\u003c/p\u003e","answer_count":"2","comment_count":"3","creation_date":"2012-12-26 09:38:30.803 UTC","favorite_count":"1","last_activity_date":"2012-12-26 09:42:21.757 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"1929518","post_type_id":"1","score":"1","tags":"jquery|popupwindow","view_count":"2672"} -{"id":"41540626","title":"i got 400 error in google webmaster using codeigniter3 but site works well in browser","body":"\u003cp\u003e\u003ca href=\"https://i.stack.imgur.com/OXfiB.png\" rel=\"nofollow noreferrer\"\u003e400 error found in google webmaster\u003c/a\u003e\n%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20 url problem in google webmaster area only..\ni use codeinter3 and apache2\nmy .ht-access file content is here\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;IfModule mod_rewrite.c\u0026gt;\nRewriteEngine On\nRewriteBase /\nRewriteCond %{REQUEST_URI} ^system.*\nRewriteRule ^(.*)$ /index.php?/$1 [L]\nRewriteCond %{REQUEST_URI} ^application.*\nRewriteRule ^(.*)$ /index.php?/$1 [L]\nRewriteCond %{REQUEST_FILENAME} !-f\nRewriteCond %{REQUEST_FILENAME} !-d\nRewriteRule ^(.*)$ index.php?/$1 [L]\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003c/p\u003e","answer_count":"0","comment_count":"0","creation_date":"2017-01-09 03:32:11.29 UTC","last_activity_date":"2017-01-09 03:32:11.29 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"7392621","post_type_id":"1","score":"0","tags":"apache|codeigniter-3|google-webmaster-tools|google-pagespeed","view_count":"18"} +{"id":"41540626","title":"i got 400 error in google webmaster using codeigniter3 but site works well in browser","body":"\u003cp\u003e\u003ca href=\"https://i.stack.imgur.com/OXfiB.png\" rel=\"nofollow noreferrer\"\u003e400 error found in google webmaster\u003c/a\u003e\n%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20 url problem in google webmaster area only..\ni use codeinter3 and apache2\nmy .ht-access file content is here\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;IfModule mod_rewrite.c\u0026gt;\nRewriteEngine On\nRewriteBase /\nRewriteCond %{REQUEST_URI} ^system.*\nRewriteRule ^(.*)$ /index.php?/$1 [L]\nRewriteCond %{REQUEST_URI} ^application.*\nRewriteRule ^(.*)$ /index.php?/$1 [L]\nRewriteCond %{REQUEST_FILENAME} !-f\nRewriteCond %{REQUEST_FILENAME} !-d\nRewriteRule ^(.*)$ index.php?/$1 [L]\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003c/p\u003e","answer_count":"0","comment_count":"0","creation_date":"2017-01-09 03:32:11.29 UTC","last_activity_date":"2017-01-09 03:32:11.29 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"7392621","post_type_id":"1","score":"0","tags":"apache|codeigniter-3|google-webcluster-manager-tools|google-pagespeed","view_count":"18"} {"id":"5710180","title":"how to make sure that the value in a dynamic textbox is not empty using javascript","body":"\u003cp\u003eI have nearly 80 textbox controls being created dynamically on the change of a dropdownlist item.\u003c/p\u003e\n\n\u003cp\u003eI need to make sure that none of these textboxes are empty when the user clicks on add item button.\u003c/p\u003e\n\n\u003cp\u003eI am aware of document.getElementbyid , however it does not serve my purpose as I will not know the id of the textboxes. The ids of the textboxes created start with \"txt\".\u003c/p\u003e\n\n\u003cp\u003eCan anyone paste a sample code of how to achieve this.\u003c/p\u003e\n\n\u003cp\u003eThanks in advance.\u003c/p\u003e","accepted_answer_id":"5710199","answer_count":"1","comment_count":"1","creation_date":"2011-04-19 00:02:58.657 UTC","last_activity_date":"2011-04-19 00:07:38.763 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"714330","post_type_id":"1","score":"0","tags":"asp.net","view_count":"207"} {"id":"47095293","title":"RasterLayer 64-bits into a RasterLayer 8-bits with R","body":"\u003cp\u003eI am working with R and use the following libraries: raster, sp, rgeos, rgdal\u003c/p\u003e\n\n\u003cp\u003eI created a RasterLayer from a SpatialPointsDataFrame. \nThis raster can easily be exported using \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eraster::writeRaster(ras8b,\n filename=\"filepath\", format=\"GTiff\" ,\n datatype='INT1U')\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThe problem which I run in is the following: \nI need a 8BitsPerPixel GeoTiff. But the code I use saves the raster to an 64 BitsPerPixel Raster.\u003c/p\u003e\n\n\u003cp\u003eI tried to solve the problem already following several options I found on StackOverflow. For example:\n\u003ca href=\"https://stackoverflow.com/questions/31953180/rasterlayer-16-bits-into-a-rasterlayer-8-bits\"\u003eRasterLayer 16-bits into a RasterLayer 8-bits\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eThis first option gave me a 8 BitsPerPixel raster, but no values in it, just NAs.\u003c/p\u003e\n\n\u003cp\u003eOr I converted the RasterLayer in R to integer following this post:\n\u003ca href=\"https://gis.stackexchange.com/questions/175383/round-does-not-return-an-integer-raster-in-r/175384\"\u003ehttps://gis.stackexchange.com/questions/175383/round-does-not-return-an-integer-raster-in-r/175384\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003eBut R continues to store the Raster as 64 BitsPerPixel Raster.\u003c/p\u003e\n\n\u003cp\u003eSomebody has a solution?\nIf you need more information just let me know. \nThanks a lot. Best regards.\u003c/p\u003e","answer_count":"1","comment_count":"1","creation_date":"2017-11-03 12:00:34.913 UTC","last_activity_date":"2017-11-09 06:08:08.997 UTC","last_edit_date":"2017-11-03 13:42:25.643 UTC","last_editor_display_name":"","last_editor_user_id":"8880376","owner_display_name":"","owner_user_id":"8880376","post_type_id":"1","score":"0","tags":"r|types|geotiff","view_count":"22"} {"id":"16379786","title":"Cannot unload previous swf while loading the new ones","body":"\u003cp\u003eI have made a main navigation page in adobe flash and 3 buttons in it. I have used this code in order to call some external swf's according to the button pressed. Problem is that when i press the button to load one swf i want the previous one to be unloaded. How can i do that i have tried everything\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003evar myLoader:Loader = new Loader(); \nvar myLoaderMain:URLRequest = new URLRequest(\"main1.swf\");\nvar myLoaderQuiz:URLRequest = new URLRequest(\"quiz.swf\");\nvar myLoaderAnimation:URLRequest = new URLRequest(\"athens_animation.swf\");\nvar myLoaderVideo:URLRequest = new URLRequest(\"videogallery.swf\");\n\n\nvideogallerybtn.addEventListener(MouseEvent.CLICK, videoFunc);\n\nfunction videoFunc(curEvt:MouseEvent) {\nmyLoader.load(myLoaderVideo);\naddChild(myLoader); \n }\n\n Quizbtn.addEventListener(MouseEvent.CLICK, quizFunc);\n function quizFunc(curEvt:MouseEvent) {\nmyLoader.load(myLoaderQuiz);\naddChild(myLoader);\n\n }\n\n Animationbtn.addEventListener(MouseEvent.CLICK, AnimationFunc);\n\n function AnimationFunc(curEvt:MouseEvent) {\nmyLoader.load(myLoaderAnimation);\naddChild(myLoader);\n }\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"1","comment_count":"1","creation_date":"2013-05-04 23:08:53.583 UTC","last_activity_date":"2013-05-08 16:38:22.01 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"2350878","post_type_id":"1","score":"0","tags":"flash|actionscript","view_count":"74"} @@ -4797,7 +4797,7 @@ {"id":"13515767","title":"how to change background color of selected items in multiselect dropdown box?","body":"\u003cp\u003eI want to give the yellow color to the selected items in multiselect dropdown box. By default it has gray background after selecting,\nI want to do this in \u003ccode\u003eHTML, CSS\u003c/code\u003e.\u003c/p\u003e\n\n\u003cp\u003eCan any one help in this?\u003c/p\u003e","accepted_answer_id":"17509657","answer_count":"6","comment_count":"0","creation_date":"2012-11-22 15:23:17.08 UTC","favorite_count":"1","last_activity_date":"2016-12-14 13:24:32.18 UTC","last_edit_date":"2013-02-07 13:55:08.383 UTC","last_editor_display_name":"","last_editor_user_id":"1914192","owner_display_name":"","owner_user_id":"1460692","post_type_id":"1","score":"5","tags":"css|multi-select|html.dropdownlistfor","view_count":"25063"} {"id":"41521336","title":"Android: for cycle to handle lost focus on TextEdit fields","body":"\u003cp\u003eI searched for long without success about making this piece of code in one shot by means, for instance, of a \u003cem\u003efor\u003c/em\u003e cycle rather than repeating it 10 times (D1 d1, D2 d2, ..., D10 d10):\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e //\n // -------------- DIAMETRO 1 -----------------------------------\n //\n final EditText D1 = (EditText)findViewById(R.id.d1);\n int d1 = mast.getInstance().getd1();\n Log.d(\"Diametro 1 =\", Integer.toString(d1));\n D1.setText(Integer.toString(d1));\n //\n // Perdita del focus del diametro 1\n //\n D1.setOnFocusChangeListener(new View.OnFocusChangeListener() {\n\n @Override\n public void onFocusChange(View v, boolean hasFocus) {\n /* When focus is lost check that the text field\n * has valid values.\n */\n if (!hasFocus) {\n String strD1=D1.getText().toString();\n mast.getInstance().setd1(Integer.valueOf(strD1));\n }\n }\n });\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"1","comment_count":"1","creation_date":"2017-01-07 12:15:47.323 UTC","last_activity_date":"2017-02-28 19:36:32.907 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"7387567","post_type_id":"1","score":"0","tags":"java|android|android-studio|lost-focus","view_count":"53"} {"id":"34537903","title":"Slick Carousel - How To Change Default Buttons","body":"\u003cp\u003eI'm working with \u003ca href=\"http://kenwheeler.github.io/slick/\" rel=\"nofollow\"\u003eSlick Carousel\u003c/a\u003e for the first time. The project i'm currently working on needs most of the files loaded through a CDN. How can i replace the default buttons for \"Next\" and \"Previous\" that's loaded through their hosted Jquery? \u003c/p\u003e\n\n\u003cp\u003eAs of now it's just a button with Text, i'd like to replace it with a FontAwesome icon of arrows. \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;h1\u0026gt; One Slider At a Time \u0026lt;/h1\u0026gt;\n\u0026lt;div class=\"slider\"\u0026gt;\n \u0026lt;div\u0026gt;\u0026lt;h3\u0026gt;1\u0026lt;/h3\u0026gt;\u0026lt;/div\u0026gt;\n \u0026lt;div\u0026gt;\u0026lt;h3\u0026gt;2\u0026lt;/h3\u0026gt;\u0026lt;/div\u0026gt;\n \u0026lt;div\u0026gt;\u0026lt;h3\u0026gt;3\u0026lt;/h3\u0026gt;\u0026lt;/div\u0026gt;\n \u0026lt;/div\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHere is my \u003ca href=\"http://codepen.io/stinkytofu3311/pen/JGbwOV\" rel=\"nofollow\"\u003eDemo\u003c/a\u003e\u003c/p\u003e","accepted_answer_id":"34538047","answer_count":"1","comment_count":"0","creation_date":"2015-12-30 22:01:24.807 UTC","last_activity_date":"2016-01-05 18:37:11.83 UTC","last_edit_date":"2016-01-05 18:37:11.83 UTC","last_editor_display_name":"","last_editor_user_id":"3076758","owner_display_name":"","owner_user_id":"3076758","post_type_id":"1","score":"0","tags":"javascript|jquery|css|carousel","view_count":"561"} -{"id":"24435280","title":"Composer packages, specifying package root","body":"\u003cp\u003ePerhaps I've simply missed something basic (\u003cem\u003ehopefully\u003c/em\u003e) but I can't quite figure this out.\u003c/p\u003e\n\n\u003cp\u003eI have a pair of PHP projects, each initialized as a git repo/Composer package; \u003ccode\u003efoobar/package-a\u003c/code\u003e which depends on \u003ccode\u003efoobar/package-b\u003c/code\u003e.\u003c/p\u003e\n\n\u003cp\u003e\u003ccode\u003ePackageA\u003c/code\u003e is structured as follows:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ePackageB\n +- src\n | +- PackageB\n | +- Namespace1\n | | +- \u0026lt;files\u0026gt;\n | +- Namespace2\n | | +- \u0026lt;files\u0026gt;\n | +- Namespace3\n | +- \u0026lt;files\u0026gt;\n +- docs\n +- other\n +- things\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003ccode\u003ePackageA\u003c/code\u003e is structured similarly:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e PackageA\n +- src\n | +- PackageA\n | +- \u0026lt;files\u0026gt;\n +- vendor\n +- \u0026lt;files\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAnyway, I'm targeting \u003ccode\u003epackage-b\u003c/code\u003e as a dependency from \u003ccode\u003epackage-a\u003c/code\u003e, just using the local git repository.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e# PackageA's composer.json\n\"require\": {\n \"foobar/package-b\": \"dev-master\"\n},\n\"repositories\": [\n {\n \"type\": \"vcs\",\n \"url\": \"path/to/foobar/PackageB\"\n }\n]\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHowever, from \u003ccode\u003epackage-b\u003c/code\u003e's side, I only wish to expose everything under \u003ccode\u003e/src/PackageB\u003c/code\u003e, excluding the \u003ccode\u003e/docs\u003c/code\u003e, and \u003ccode\u003e/other\u003c/code\u003e, \u003ccode\u003e/things\u003c/code\u003e.\u003c/p\u003e\n\n\u003cp\u003eI was surprised to learn that there isn't a \u003ccode\u003epackage-root\u003c/code\u003e key in the Composer schema, to indicate that I'd like dependent projects to only pull from a certain directory:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e# hypothetical in PackageB's composer.json\n\"package-root\": \"/src/PackageB\" \n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eIs there any way using Composer to indicate to consumers that the files are located somewhere other than the package's root directory?\u003c/p\u003e\n\n\u003cp\u003eCurrently, I'm ending up with \u003cem\u003eeverything\u003c/em\u003e from the \u003ccode\u003ePackageB\u003c/code\u003e root (\u003ccode\u003e/src\u003c/code\u003e, \u003ccode\u003e/docs\u003c/code\u003e, etc.) in the \u003ccode\u003evendor\u003c/code\u003e directory of \u003ccode\u003ePackageA\u003c/code\u003e.\u003c/p\u003e\n\n\u003chr\u003e\n\n\u003ch3\u003eAddendum\u003c/h3\u003e\n\n\u003cul\u003e\n\u003cli\u003eI'm now aware of the \u003ca href=\"https://getcomposer.org/doc/04-schema.md#archive\" rel=\"nofollow\"\u003e\u003ccode\u003eexclude\u003c/code\u003e\u003c/a\u003e key, though I'm looking to actually re-root the package and not just ignore the other directories. Moreover, I'm not sure if that'd apply here anyway.\u003c/li\u003e\n\u003c/ul\u003e","answer_count":"0","comment_count":"3","creation_date":"2014-06-26 16:02:48.49 UTC","last_activity_date":"2014-06-26 16:10:14.123 UTC","last_edit_date":"2014-06-26 16:10:14.123 UTC","last_editor_display_name":"","last_editor_user_id":"409279","owner_display_name":"","owner_user_id":"409279","post_type_id":"1","score":"0","tags":"php|directory|composer-php","view_count":"68"} +{"id":"24435280","title":"Composer packages, specifying package root","body":"\u003cp\u003ePerhaps I've simply missed something basic (\u003cem\u003ehopefully\u003c/em\u003e) but I can't quite figure this out.\u003c/p\u003e\n\n\u003cp\u003eI have a pair of PHP projects, each initialized as a git repo/Composer package; \u003ccode\u003efoobar/package-a\u003c/code\u003e which depends on \u003ccode\u003efoobar/package-b\u003c/code\u003e.\u003c/p\u003e\n\n\u003cp\u003e\u003ccode\u003ePackageA\u003c/code\u003e is structured as follows:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003ePackageB\n +- src\n | +- PackageB\n | +- Namespace1\n | | +- \u0026lt;files\u0026gt;\n | +- Namespace2\n | | +- \u0026lt;files\u0026gt;\n | +- Namespace3\n | +- \u0026lt;files\u0026gt;\n +- docs\n +- other\n +- things\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003ccode\u003ePackageA\u003c/code\u003e is structured similarly:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e PackageA\n +- src\n | +- PackageA\n | +- \u0026lt;files\u0026gt;\n +- vendor\n +- \u0026lt;files\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eAnyway, I'm targeting \u003ccode\u003epackage-b\u003c/code\u003e as a dependency from \u003ccode\u003epackage-a\u003c/code\u003e, just using the local git repository.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e# PackageA's composer.json\n\"require\": {\n \"foobar/package-b\": \"dev-cluster-manager\"\n},\n\"repositories\": [\n {\n \"type\": \"vcs\",\n \"url\": \"path/to/foobar/PackageB\"\n }\n]\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHowever, from \u003ccode\u003epackage-b\u003c/code\u003e's side, I only wish to expose everything under \u003ccode\u003e/src/PackageB\u003c/code\u003e, excluding the \u003ccode\u003e/docs\u003c/code\u003e, and \u003ccode\u003e/other\u003c/code\u003e, \u003ccode\u003e/things\u003c/code\u003e.\u003c/p\u003e\n\n\u003cp\u003eI was surprised to learn that there isn't a \u003ccode\u003epackage-root\u003c/code\u003e key in the Composer schema, to indicate that I'd like dependent projects to only pull from a certain directory:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e# hypothetical in PackageB's composer.json\n\"package-root\": \"/src/PackageB\" \n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eIs there any way using Composer to indicate to consumers that the files are located somewhere other than the package's root directory?\u003c/p\u003e\n\n\u003cp\u003eCurrently, I'm ending up with \u003cem\u003eeverything\u003c/em\u003e from the \u003ccode\u003ePackageB\u003c/code\u003e root (\u003ccode\u003e/src\u003c/code\u003e, \u003ccode\u003e/docs\u003c/code\u003e, etc.) in the \u003ccode\u003evendor\u003c/code\u003e directory of \u003ccode\u003ePackageA\u003c/code\u003e.\u003c/p\u003e\n\n\u003chr\u003e\n\n\u003ch3\u003eAddendum\u003c/h3\u003e\n\n\u003cul\u003e\n\u003cli\u003eI'm now aware of the \u003ca href=\"https://getcomposer.org/doc/04-schema.md#archive\" rel=\"nofollow\"\u003e\u003ccode\u003eexclude\u003c/code\u003e\u003c/a\u003e key, though I'm looking to actually re-root the package and not just ignore the other directories. Moreover, I'm not sure if that'd apply here anyway.\u003c/li\u003e\n\u003c/ul\u003e","answer_count":"0","comment_count":"3","creation_date":"2014-06-26 16:02:48.49 UTC","last_activity_date":"2014-06-26 16:10:14.123 UTC","last_edit_date":"2014-06-26 16:10:14.123 UTC","last_editor_display_name":"","last_editor_user_id":"409279","owner_display_name":"","owner_user_id":"409279","post_type_id":"1","score":"0","tags":"php|directory|composer-php","view_count":"68"} {"id":"15913154","title":"How do I add a base target=\"_self\" to my Joomla site's header?","body":"\u003cp\u003eI'm trying to add a simple base \u003ccode\u003etarget=\"_self\"\u003c/code\u003e to my Joomla! 2.5 site's head HTML file. Where do I find that? Thanks! \u003c/p\u003e","answer_count":"1","comment_count":"1","creation_date":"2013-04-09 21:44:44.72 UTC","last_activity_date":"2013-04-09 22:48:55.87 UTC","last_edit_date":"2013-04-09 21:47:58.19 UTC","last_editor_display_name":"","last_editor_user_id":"986618","owner_display_name":"","owner_user_id":"2263700","post_type_id":"1","score":"0","tags":"joomla|head","view_count":"200"} {"id":"34265768","title":"What is a tensorflow float ref?","body":"\u003cp\u003eTrying to run the following basic example to run a conditional calculation I got the following error message:\u003c/p\u003e\n\n\u003cblockquote\u003e\n \u003cp\u003e'x' was passed float incompatible with expected float_ref\u003c/p\u003e\n\u003c/blockquote\u003e\n\n\u003cp\u003ewhat is a tensorflow float_ref and how does the code have to be modified?\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eimport tensorflow as tf\nfrom tensorflow.python.ops.control_flow_ops import cond\n\na = tf.Variable(tf.constant(0.),name=\"a\")\nb = tf.Variable(tf.constant(0.),name=\"b\")\nx = tf.Variable(tf.constant(0.),name=\"x\")\n\ndef add():\n x.assign( a + b)\n return x\n\ndef last():\n return x\n\ncalculate= cond(x==0.,add,last)\n\nwith tf.Session() as s:\n val = s.run([calculate], {a: 1., b: 2., x: 0.})\n print(val) # 3\n val=s.run([calculate],{a:4.,b:5.,x:val})\n print(val) # 3\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"34269302","answer_count":"2","comment_count":"0","creation_date":"2015-12-14 11:21:11.013 UTC","favorite_count":"1","last_activity_date":"2017-11-30 12:34:56.383 UTC","last_edit_date":"2017-08-20 20:44:24.213 UTC","last_editor_display_name":"","last_editor_user_id":"249341","owner_display_name":"","owner_user_id":"2505295","post_type_id":"1","score":"4","tags":"python|tensorflow","view_count":"1423"} {"id":"44117175","title":"Is there a way to recover Visual Studio Projects after a hard drive failure?","body":"\u003cp\u003eRecently i have experienced an external hard drive failure. Unfortunately I keep all of my projects on this HDD, and I have no additional backups (this disk was THE backup, and it is three months old).\u003c/p\u003e\n\n\u003cp\u003eI know that Visual Studio have some recovery options, but I never had to use them. Is there any way to recover my projects, from some sort of Visual Studio's temporary or recovery folders? Or perhaps Windows features could help somehow? \u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eAny advice is appreciated...\u003c/strong\u003e \u003cbr\u003e\nI have lost over 80 projects...\u003c/p\u003e\n\n\u003chr\u003e\n\n\u003cp\u003e\u003cstrong\u003eAdditional info:\u003c/strong\u003e\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eDisk:\u003c/strong\u003e WD My Passport Ultra 2.0 TB USB 3.0 \u003cbr\u003e\n\u003cstrong\u003eVS IDE:\u003c/strong\u003e Visual Studio 2015 Enterprise. \u003cbr\u003e\n\u003cstrong\u003eOS:\u003c/strong\u003e Windows 10 x64 Pro. \u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eDisk failure:\u003c/strong\u003e It boots directly into \u003ccode\u003eEmergency mode\u003c/code\u003e. Someone told me it is a \u003ccode\u003eSATA -\u0026gt; USB Bridge\u003c/code\u003e failure, but i have no way of testing it. I can post some additional data. I did not post them because this question is about VS recovery options, not about disk recovery, \u003c/p\u003e\n\n\u003cp\u003eI sent this disc to a data-recovery specialist, but he estimated the recovery cost for several thousands (in my native currency) and this is a value equivalent to a new computer.\u003c/p\u003e","accepted_answer_id":"44122037","answer_count":"1","comment_count":"0","creation_date":"2017-05-22 15:51:13.91 UTC","last_activity_date":"2017-05-22 20:57:16.07 UTC","last_edit_date":"2017-05-22 20:51:24.78 UTC","last_editor_display_name":"","last_editor_user_id":"5098833","owner_display_name":"","owner_user_id":"5098833","post_type_id":"1","score":"1","tags":"visual-studio|recovery","view_count":"43"} @@ -4899,7 +4899,7 @@ {"id":"7305345","title":"String doesn’t seem to be passed by value","body":"\u003cp\u003eI use the following function to bind all members of a certain class to a function that changes the current page. Heres the function:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003efunction _bind_menu_items() {\n var menuItems = fja.getElementsByClass(\"menuItem\"),\n index,\n elementID,\n divIdToBind;\n\n for (index in menuItems) {\n elementID = menuItems[index].id;\n divIdToBind = elementID.replace(\"Item\", \"\");\n\n menuItems[index].onclick = function() {\n fja.menu.changeActivePage(divIdToBind);\n };\n }\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI’ve checked that everything works as expected down to the actual assignment of the onclick property. The error I’m getting is that every div belonging to the menuItem class seems to call the same onclick function... as if the divIdToBind string is the exact same for every onclick that is assigned... How can I fix this?\u003c/p\u003e","accepted_answer_id":"7305411","answer_count":"1","comment_count":"2","creation_date":"2011-09-05 08:03:26.373 UTC","favorite_count":"1","last_activity_date":"2011-09-05 08:11:03.817 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"636967","post_type_id":"1","score":"1","tags":"javascript","view_count":"64"} {"id":"32887454","title":"How is shell sort algorithm any better than of merge sort algorithm?","body":"\u003cp\u003eI have this small presentation about algorithms with a group of nerds and i was randomly tasked to convince them that shell sort is better than merge sort algorithm... I have been reading for almost a weak But No matter how much i read on merge sort and shell sort i find the merge sort better than shell sort.. \u003c/p\u003e\n\n\u003cp\u003eAre their any advantages of shell sort on merge sort? I mean on what circumstances is shell sort better than merge sort. I might have missed something but i dont know what.\u003c/p\u003e\n\n\u003cp\u003eAny tips would be fine or if possible can you link me to something helpful..\u003c/p\u003e","answer_count":"3","comment_count":"2","creation_date":"2015-10-01 12:19:16.07 UTC","last_activity_date":"2015-10-01 17:33:09.303 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"4966206","post_type_id":"1","score":"1","tags":"java|algorithm|shell|sorting|merge","view_count":"862"} {"id":"41084598","title":"Count number of items in pandas","body":"\u003cp\u003eI know this question is quite trivial, but this is my first day of using pandas, so please at least post a link to the document which I should read.\u003c/p\u003e\n\n\u003cp\u003eBasically, I don't know how to count the number of items of each column. Suppose I have a data frame like this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003edf = pandas.DataFrame({\n \"Grade\": [1, 2, 1, 1, 2, 1, 2, 2, 1],\n \"Major\": [\"Science\", \"Art\", \"Engineering\", \"Science\", \"Science\", \"Science\", \"Science\", \"Engineering\", \"Engineering\"]})\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI expect the following result:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eGrade Major Number\n1 Science 3\n1 Engineering 2\n1 Art 0\n2 Science 2\n2 Engineering 1\n2 Art 1\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"41084621","answer_count":"1","comment_count":"0","creation_date":"2016-12-11 09:13:23.353 UTC","last_activity_date":"2016-12-11 09:15:45.833 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"5399734","post_type_id":"1","score":"-1","tags":"python|pandas|numpy","view_count":"63"} -{"id":"43341743","title":"tensorflow distributed train worker process supervisor init twice","body":"\u003cp\u003eI'm trying to write distribued tensorflow program, But something odd for me, especially the multi-distributed-workers exported model predicted result almost 0.00003(max:0.000031, min:0.00000001, var:0.00001, mean: 0.00003, learning rate is 0.00125, model: logistic regression, sigmoid actvation as last), while it works fine when i use only one worker process(predicted result mean value: 0.478, var: 0.41, max: 0.999, min:0.00000001).\u003c/p\u003e\n\n\u003cp\u003eMy Code structure as follows:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e with K.tf.device(\n K.tf.train.replica_device_setter(\n ps_device=\"/job:servers\",\n worker_device=\"/job:%s/task:%d/cpu:0\" % (\n self.job_name + 's', self.train_id),\n cluster=self.cluster)):\n self._build_model(self.job_name)\n self._build_data_pipeline(self.job_name, role=['train'])\n self._build_monitors(self.job_name)\n self._build_algo(self.job_name)\n self._build_summaries(self.job_name)\n self._build_save_model(self.job_name)\n self._build_train_conf(self.job_name)\n self._build_supervisor(self.job_name)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eand my supervisor and managed_session codes as follows:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e logging.info('[is_chief] %s', is_chief)\n sv = K.tf.train.Supervisor(\n is_chief=is_chief,\n logdir=self.model_conf['export_dir'] + '/save',\n init_op=self.init_op,\n summary_op=self.summary_op,\n save_model_secs=0,\n save_summaries_secs=self.save_summaries_seconds,\n saver=self.saver,\n global_step=self.global_step)\n\n\n logging.info('sess target: %s', self.server.target)\n with sv.managed_session(\n master=self.server.target,\n config=threads_config,\n start_standard_services=False) as sess:\n sv.start_queue_runners(sess)\n\n do the training steps.\n when finished input data, export model manually.\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ebut I found that master session occurred twice, what does it mean?\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eI 2017-04-11 08:59:38 framework.framework:3020 ============After build model==============\nI 2017-04-11 08:59:38 framework.framework:3027 [is_chief] False\nI 2017-04-11 08:59:38 framework.framework:2077 RUNTIME CHECKING ...\nI 2017-04-11 08:59:38 framework.framework:2026 [CHECKER] ModelSize Checking ...\nI 2017-04-11 08:59:38 framework.framework:2064 [CHECKER] GraphNotNone Checking ...\nI 2017-04-11 08:59:38 framework.framework:2082 Runtime Checker result: True\nI 2017-04-11 08:59:38 framework.framework:3094 sess target: b'grpc://localhost:15926'\nI tensorflow/core/distributed_runtime/master_session.cc:928] Start master session 74d502743e860d45 with config:\nuse_per_session_threads: true\n\nI tensorflow/core/distributed_runtime/master_session.cc:928] Start master session 12114aca8d44d336 with config:\nuse_per_session_threads: true\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"0","comment_count":"1","creation_date":"2017-04-11 09:19:59.953 UTC","last_activity_date":"2017-04-11 09:19:59.953 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"5611838","post_type_id":"1","score":"2","tags":"session|tensorflow|distributed|managed|supervisor","view_count":"53"} +{"id":"43341743","title":"tensorflow distributed train worker process supervisor init twice","body":"\u003cp\u003eI'm trying to write distribued tensorflow program, But something odd for me, especially the multi-distributed-workers exported model predicted result almost 0.00003(max:0.000031, min:0.00000001, var:0.00001, mean: 0.00003, learning rate is 0.00125, model: logistic regression, sigmoid actvation as last), while it works fine when i use only one worker process(predicted result mean value: 0.478, var: 0.41, max: 0.999, min:0.00000001).\u003c/p\u003e\n\n\u003cp\u003eMy Code structure as follows:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e with K.tf.device(\n K.tf.train.replica_device_setter(\n ps_device=\"/job:servers\",\n worker_device=\"/job:%s/task:%d/cpu:0\" % (\n self.job_name + 's', self.train_id),\n cluster=self.cluster)):\n self._build_model(self.job_name)\n self._build_data_pipeline(self.job_name, role=['train'])\n self._build_monitors(self.job_name)\n self._build_algo(self.job_name)\n self._build_summaries(self.job_name)\n self._build_save_model(self.job_name)\n self._build_train_conf(self.job_name)\n self._build_supervisor(self.job_name)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eand my supervisor and managed_session codes as follows:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e logging.info('[is_chief] %s', is_chief)\n sv = K.tf.train.Supervisor(\n is_chief=is_chief,\n logdir=self.model_conf['export_dir'] + '/save',\n init_op=self.init_op,\n summary_op=self.summary_op,\n save_model_secs=0,\n save_summaries_secs=self.save_summaries_seconds,\n saver=self.saver,\n global_step=self.global_step)\n\n\n logging.info('sess target: %s', self.server.target)\n with sv.managed_session(\n cluster_manager=self.server.target,\n config=threads_config,\n start_standard_services=False) as sess:\n sv.start_queue_runners(sess)\n\n do the training steps.\n when finished input data, export model manually.\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ebut I found that main session occurred twice, what does it mean?\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eI 2017-04-11 08:59:38 framework.framework:3020 ============After build model==============\nI 2017-04-11 08:59:38 framework.framework:3027 [is_chief] False\nI 2017-04-11 08:59:38 framework.framework:2077 RUNTIME CHECKING ...\nI 2017-04-11 08:59:38 framework.framework:2026 [CHECKER] ModelSize Checking ...\nI 2017-04-11 08:59:38 framework.framework:2064 [CHECKER] GraphNotNone Checking ...\nI 2017-04-11 08:59:38 framework.framework:2082 Runtime Checker result: True\nI 2017-04-11 08:59:38 framework.framework:3094 sess target: b'grpc://localhost:15926'\nI tensorflow/core/distributed_runtime/main_session.cc:928] Start main session 74d502743e860d45 with config:\nuse_per_session_threads: true\n\nI tensorflow/core/distributed_runtime/main_session.cc:928] Start main session 12114aca8d44d336 with config:\nuse_per_session_threads: true\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"0","comment_count":"1","creation_date":"2017-04-11 09:19:59.953 UTC","last_activity_date":"2017-04-11 09:19:59.953 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"5611838","post_type_id":"1","score":"2","tags":"session|tensorflow|distributed|managed|supervisor","view_count":"53"} {"id":"47406832","title":"How to compare strings of lines from two different files using python?","body":"\u003cp\u003eI want to find the matching email in two files and sent date by comparing emails from two files. I have two files 1) maillog.txt(postfix maillog) and 2)testmail.txt(contains emails separated by newline) i have used \u003ccode\u003ere\u003c/code\u003e to extract the email and sent date from maillog.txt file which looks like below, \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eNov 3 10:08:43 server postfix/smtp[150754]: 78FA8209EDEF: to=\u0026lt;adamson@example.com\u0026gt;, relay=aspmx.l.google.com[74.125.24.26]:25, delay=3.2, delays=0.1/0/1.6/1.5, dsn=2.0.0, status=sent (250 2.0.0 OK 1509718076 m11si5060862pls.447 - gsmtp)\nNov 3 10:10:45 server postfix/smtp[150754]: 7C42A209EDEF: to=\u0026lt;addison@linux.com\u0026gt;, relay=mxa-000f9e01.gslb.pphosted.com[67.231.152.217]:25, delay=5.4, delays=0.1/0/3.8/1.5, dsn=2.0.0, status=sent (250 2.0.0 2dvkvt5tgc-1 Message accepted for delivery)\nNov 3 10:15:45 server postfix/smtp[150754]: 83533209EDE8: to=\u0026lt;johndoe@carchcoal.com\u0026gt;, relay=mxa-000f9e01.gslb.pphosted.com[67.231.144.222]:25, delay=4.8, delays=0.1/0/3.3/1.5, dsn=2.0.0, status=sent (250 2.0.0 2dvm8yww64-1 Message accepted for delivery)\nNov 3 10:16:42 server postfix/smtp[150754]: 83A5E209EDEF: to=\u0026lt;jackn@alphanr.com\u0026gt;, relay=aspmx.l.google.com[74.125.200.27]:25, delay=1.6, delays=0.1/0/0.82/0.69, dsn=2.0.0, status=sent (250 2.0.0 OK 1509718555 j186si6198120pgc.455 - gsmtp)\nNov 3 10:17:44 server postfix/smtp[150754]: 8636D209EDEF: to=\u0026lt;sbins@archcoal.com\u0026gt;, relay=mxa-000f9e01.gslb.pphosted.com[67.231.144.222]:25, delay=4.1, delays=0.11/0/2.6/1.4, dsn=2.0.0, status=sent (250 2.0.0 2dvm8ywwdh-1 Message accepted for delivery)\nNov 3 10:18:42 server postfix/smtp[150754]: 8A014209EDEF: to=\u0026lt;leo@adalphanr.com\u0026gt;, relay=aspmx.l.google.com[74.125.200.27]:25, delay=1.9, delays=0.1/0/0.72/1.1, dsn=2.0.0, status=sent (250 2.0.0 OK 1509718675 o2si6032950pgp.46 - gsmtp)\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHere is my another file \u003ccode\u003etestmail.txt\u003c/code\u003e :\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eadamson@example.com\njdswson@gmail.com\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eBelow is what i have tried and it works too but \u003cstrong\u003eI want to know if there is more efficient way to do this for large number of maillogs and email addresses\u003c/strong\u003e\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eimport re\npattern=r'(?P\u0026lt;month\u0026gt;[A-Za-z]{3})\\s{1,3}(?P\u0026lt;day\u0026gt;\\d{1,2})\\s{1,2}(?P\u0026lt;ts\u0026gt;\\d+:\\d+:\\d+).*to=\u0026lt;(?P\u0026lt;email\u0026gt;([\\w\\.-]+)@([\\w\\.-]+))'\nwith open(\"testmail.txt\") as fh1:\n for addr in fh1:\n if addr:\n with open(\"maillog.txt\") as fh:\n for line in fh:\n if line:\n match=re.finditer(pattern,line)\n for obj in match:\n addr=addr.strip()\n addr2=obj.group('email').strip()\n if addr == addr2:\n print(obj.groupdict('email'))\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003ethis will print out put like if match is found:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e{'month': 'Nov', 'day': '3', 'ts': '10:08:43', 'email': 'adamson@example.com'}\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"47409330","answer_count":"4","comment_count":"4","creation_date":"2017-11-21 06:47:11.827 UTC","last_activity_date":"2017-11-21 09:16:20.73 UTC","last_edit_date":"2017-11-21 07:03:55.707 UTC","last_editor_display_name":"","last_editor_user_id":"2136297","owner_display_name":"","owner_user_id":"2136297","post_type_id":"1","score":"0","tags":"python|python-3.x","view_count":"62"} {"id":"30298016","title":"error in python idfs implementation","body":"\u003cp\u003eI am new in python, there is this error in the if else statement \u003ccode\u003e\"unindent does not match any outer indentation level\"\u003c/code\u003e, can anyone tell me what is the problem with if else statements?\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003edef idfs(graph, start, end,limit):\n # maintain a queue of paths\n count=0\n queue = []\n\n # push the first path into the queue\n queue.append([start])\n #print queue\n\n while queue:\n count +=1\n # get the first path from the queue\n path = queue.pop(0)\n\n # get the last node from the path\n node = path[-1]\n\n # path found\n if node == end and count==2:\n return path\n elif node!=end and count==2:\n print 'goal not found'\n limit=input('Enter the limit again')\n path=idfs(graph,node,goal,limit)\n return path\n\n\n\n\n # enumerate all adjacent nodes, construct a new path and push it into the queue\n for adjacent in graph.get(node, []):\n new_path = list(path)\n print new_path\n new_path.append(adjacent)\n print new_path\n queue.append(new_path)\n print queue\n\n\n# example execution of code\nstart = input('Enter source node: ')\ngoal = input('Enter goal node: ')\nlimit=input('Enter the limit')\n\nprint(idfs(graph,start,goal,limit))\n\u003c/code\u003e\u003c/pre\u003e","answer_count":"1","comment_count":"2","creation_date":"2015-05-18 08:08:02.597 UTC","last_activity_date":"2015-05-18 08:12:15.78 UTC","last_edit_date":"2015-05-18 08:10:45.48 UTC","last_editor_display_name":"","last_editor_user_id":"637284","owner_display_name":"","owner_user_id":"4516551","post_type_id":"1","score":"-3","tags":"python","view_count":"31"} {"id":"12776936","title":"Extracting text pattern using regular expression","body":"\u003cp\u003eI want to extract a code from an input string from different pages. Sample code is \n'110-PT-0988'. \u003c/p\u003e\n\n\u003cp\u003eThis RegExp fits other possible cases \u003ccode\u003e'^\\d{3}-[A-Z]{1,6}-\\d{4}[A-Z]{0,2}$'\u003c/code\u003e.\u003c/p\u003e\n\n\u003cp\u003eI want to return a string variable containing the code within the input string e.g. for an input string \u003c/p\u003e\n\n\u003cp\u003e\u003ccode\u003e'Code part: xx Code No: 120-PXT-2234X System Process .....xyz blah blah'.\u003c/code\u003e\u003c/p\u003e\n\n\u003cp\u003eI want the return string to be \u003ccode\u003e'120-PXT-2234X'\u003c/code\u003e\u003c/p\u003e","answer_count":"2","comment_count":"8","creation_date":"2012-10-08 07:13:33.267 UTC","last_activity_date":"2012-10-09 08:55:51.133 UTC","last_edit_date":"2012-10-09 08:55:51.133 UTC","last_editor_display_name":"","last_editor_user_id":"626273","owner_display_name":"","owner_user_id":"1727936","post_type_id":"1","score":"2","tags":"regex|vb.net","view_count":"120"} @@ -4934,11 +4934,11 @@ {"id":"33925330","title":"Function in Controller not being hit","body":"\u003cp\u003eFirst time asking a q, so if I'm doing something wrong, please let me know so I can fix it as I have tried finding the answer on here, but can not, so any and all help would be greatly appreciated.\u003c/p\u003e\n\n\u003cp\u003eI'm trying to load a list of \"Countries\" using a controller and all seems to be going well, no errors, no warnings, it loads the module and hits the angular controller, but it never hits the function/goes into the code inside the function of the controller. Am I missing something? Am I doing something wrong?\u003c/p\u003e\n\n\u003cp\u003eRegister.cshtml\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;div ng-app=\"RegisterApp\" class=\"form-group\" ng-controller=\"CountriesController as CountriesCtrl\"\u0026gt;\n \u0026lt;label class=\"input-desc\"\u0026gt;Country\u0026lt;/label\u0026gt;\n \u0026lt;select ng-model=\"country\" \n ng-options=\"country.Id as country.Name for country in countries\"\u0026gt;\n \u0026lt;option value=\"{{CountriesCtrl.country.Id}}\"\u0026gt;{{CountriesCtrl.country.Name}}\u0026lt;/option\u0026gt;\n \u0026lt;/select\u0026gt;\n\u0026lt;/div\u0026gt;\u0026lt;!-- End .from-group --\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eRegisterApp.js\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003evar app = angular.module(\"RegisterApp\", []);\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eCountriesService.js\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e/// \u0026lt;reference path=\"../App.js\" /\u0026gt;\n\nangular.module(\"RegisterApp\").service(\"CountriesService\", function ($http) {\n this.getCountries = function () {\n return $http({\n method: \"Get\",\n url: \"/Account/GetCountries\"\n });\n };\n});\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eCountriesController.js\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e/// \u0026lt;reference path=\"../Services/CountriesService.js\" /\u0026gt;\n\nangular.module(\"RegisterApp\").controller(\"CountriesController\", function ($scope, CountriesService) {\n getCountries();\n\n function getCountries() {\n CountriesService.getCountries()\n .success(function (data, status, headers, config) {\n $scope.countries = data;\n $scope.country = $scope.countries[0];\n })\n .error(function (data, status, headers, config) {\n $scope.message = 'Unexpected Error';\n });\n }\n});\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eEdit: Moved the ng-app, was mistakenly copied over like that, was a change I made just to try something before posting the q, sorry for that\u003c/p\u003e","accepted_answer_id":"33942281","answer_count":"2","comment_count":"3","creation_date":"2015-11-25 19:55:53.037 UTC","last_activity_date":"2015-11-30 08:53:59.71 UTC","last_edit_date":"2015-11-26 15:41:14.137 UTC","last_editor_display_name":"","last_editor_user_id":"5584786","owner_display_name":"","owner_user_id":"5584786","post_type_id":"1","score":"0","tags":"javascript|angularjs|html5|angularjs-controller","view_count":"274"} {"id":"20795016","title":"Delete posts of deleted user wordpress","body":"\u003cp\u003eI am using buddypress with \u003ccode\u003ewordpress\u003c/code\u003e.I accidentally deleted a user directly in data base table \u003ccode\u003ewp_users\u003c/code\u003e. Therefore just the user only deleted but the posts posted by him remains in the site. How to \u003ccode\u003edelete all the posts\u003c/code\u003e related to that deleted user. Is there any way?\u003c/p\u003e","answer_count":"1","comment_count":"2","creation_date":"2013-12-27 04:58:48.077 UTC","last_activity_date":"2013-12-27 14:18:58.34 UTC","last_edit_date":"2013-12-27 14:18:58.34 UTC","last_editor_display_name":"","last_editor_user_id":"2693568","owner_display_name":"","owner_user_id":"1986080","post_type_id":"1","score":"0","tags":"database|wordpress","view_count":"100"} {"id":"27193506","title":"iOS Handle push notification when app is not running","body":"\u003cp\u003eI'm trying to use push notifications for my app. It's working when the app is running or when it's in background. But if the user \"kills\" the app and if I send a push notification, when the user taps on the notification, the app doesn't open to handle it.\u003c/p\u003e\n\n\u003cp\u003eHow can I do this? I want to call a specific view when the user taps on a notification.\u003c/p\u003e\n\n\u003cp\u003eIn my function \u003ccode\u003edidFinishLaunchingWithOptions:\u003c/code\u003e, I wrote this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eif (launchOptions != nil){\n [self callView];\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI call the same function, \u003ccode\u003e[self callView];\u003c/code\u003e, in \u003ccode\u003edidReceiveRemoteNotification:\u003c/code\u003e. But it's not working unless the app is active or in the background.\u003c/p\u003e","answer_count":"0","comment_count":"10","creation_date":"2014-11-28 17:27:09.14 UTC","last_activity_date":"2015-02-26 09:24:48.077 UTC","last_edit_date":"2014-11-28 17:51:22.753 UTC","last_editor_display_name":"","last_editor_user_id":"2274694","owner_display_name":"","owner_user_id":"3307021","post_type_id":"1","score":"0","tags":"ios|iphone|notifications|push|handle","view_count":"1237"} -{"id":"46183665","title":"excel VBA 1004 error when copying multiple tabs into one tab from a folder","body":"\u003cp\u003eI am getting a 1004 error when I try and combine workbook pages into one master document. The code works correctly on my device, but when I attempt to run the code on my friends device it throw a 1004 error. I believe he is on excel 2013, I am on excel 2016. Is there any way to convert my code into something that can be used on both devices? \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eSub CombineSheets()\nDim sPath As String\nDim sFname As String\nDim wBk As Workbook\nDim wSht As Variant\n\nApplication.EnableEvents = False\nApplication.ScreenUpdating = False\nsPath = InputBox(\"Enter a full path to workbooks\")\nChDir sPath\nsFname = InputBox(\"Enter a filename pattern\")\nsFname = Dir(sPath \u0026amp; \"\\\" \u0026amp; sFname \u0026amp; \".xl*\", vbNormal)\nwSht = InputBox(\"Enter a worksheet name to copy\")\nDo Until sFname = \"\"\n Set wBk = Workbooks.Open(sFname)\n Windows(sFname).Activate\n Sheets(wSht).Copy Before:=ThisWorkbook.Sheets(1)\n wBk.Close False\n sFname = Dir()\nLoop\nActiveWorkbook.Save\nApplication.EnableEvents = True\nApplication.ScreenUpdating = True\nEnd Sub\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThis works correctly when I run it, prompts for the folder location, asks which files it should copy from (usually *), and then copies from specifically the worksheet name entered.\u003c/p\u003e\n\n\u003cp\u003eRealistically all I need is code that can extract one worksheet from several hundred excel files and combine them into one master document. being able to pick and choose which worksheets would just be a bonus.\u003c/p\u003e\n\n\u003cp\u003eThank you!\u003c/p\u003e","answer_count":"1","comment_count":"6","creation_date":"2017-09-12 19:02:34.48 UTC","last_activity_date":"2017-09-12 20:55:02.563 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"8599517","post_type_id":"1","score":"1","tags":"excel|vba|excel-vba","view_count":"29"} +{"id":"46183665","title":"excel VBA 1004 error when copying multiple tabs into one tab from a folder","body":"\u003cp\u003eI am getting a 1004 error when I try and combine workbook pages into one single document. The code works correctly on my device, but when I attempt to run the code on my friends device it throw a 1004 error. I believe he is on excel 2013, I am on excel 2016. Is there any way to convert my code into something that can be used on both devices? \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eSub CombineSheets()\nDim sPath As String\nDim sFname As String\nDim wBk As Workbook\nDim wSht As Variant\n\nApplication.EnableEvents = False\nApplication.ScreenUpdating = False\nsPath = InputBox(\"Enter a full path to workbooks\")\nChDir sPath\nsFname = InputBox(\"Enter a filename pattern\")\nsFname = Dir(sPath \u0026amp; \"\\\" \u0026amp; sFname \u0026amp; \".xl*\", vbNormal)\nwSht = InputBox(\"Enter a worksheet name to copy\")\nDo Until sFname = \"\"\n Set wBk = Workbooks.Open(sFname)\n Windows(sFname).Activate\n Sheets(wSht).Copy Before:=ThisWorkbook.Sheets(1)\n wBk.Close False\n sFname = Dir()\nLoop\nActiveWorkbook.Save\nApplication.EnableEvents = True\nApplication.ScreenUpdating = True\nEnd Sub\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eThis works correctly when I run it, prompts for the folder location, asks which files it should copy from (usually *), and then copies from specifically the worksheet name entered.\u003c/p\u003e\n\n\u003cp\u003eRealistically all I need is code that can extract one worksheet from several hundred excel files and combine them into one single document. being able to pick and choose which worksheets would just be a bonus.\u003c/p\u003e\n\n\u003cp\u003eThank you!\u003c/p\u003e","answer_count":"1","comment_count":"6","creation_date":"2017-09-12 19:02:34.48 UTC","last_activity_date":"2017-09-12 20:55:02.563 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"8599517","post_type_id":"1","score":"1","tags":"excel|vba|excel-vba","view_count":"29"} {"id":"45181560","title":"Concourse CI windows/strict mime type checking","body":"\u003cp\u003eWhen running concourse ci v3.3.2 locally on Windows I get these errors:\u003c/p\u003e\n\n\u003cblockquote\u003e\n \u003cp\u003eRefused to execute script from\n '\u003ca href=\"http://192.168.178.29:8080/public/index.js?id=932c553753eec4ef375e1c17f4b28c10\" rel=\"nofollow noreferrer\"\u003ehttp://192.168.178.29:8080/public/index.js?id=932c553753eec4ef375e1c17f4b28c10\u003c/a\u003e' because its MIME type ('text/plain') is not executable, and strict\n MIME type checking is enabled.\n 192.168.178.29/:1 Refused to execute script from '\u003ca href=\"http://192.168.178.29:8080/public/d3.v355.min.js?id=5936da7688d010c60aaf8374f90fcc2b\" rel=\"nofollow noreferrer\"\u003ehttp://192.168.178.29:8080/public/d3.v355.min.js?id=5936da7688d010c60aaf8374f90fcc2b\u003c/a\u003e' because its MIME type ('text/plain') is not executable, and strict\n MIME type checking is enabled.\n 192.168.178.29/:1 Refused to execute script from '\u003ca href=\"http://192.168.178.29:8080/public/graph.js?id=3e2a3f561ec6c52216e80266ef0212d2\" rel=\"nofollow noreferrer\"\u003ehttp://192.168.178.29:8080/public/graph.js?id=3e2a3f561ec6c52216e80266ef0212d2\u003c/a\u003e' because its MIME type ('text/plain') is not executable, and strict\n MIME type checking is enabled.\n 192.168.178.29/:1 Refused to execute script from '\u003ca href=\"http://192.168.178.29:8080/public/jquery-2.1.1.min.js?id=e40ec2161fe7993196f23c8a07346306\" rel=\"nofollow noreferrer\"\u003ehttp://192.168.178.29:8080/public/jquery-2.1.1.min.js?id=e40ec2161fe7993196f23c8a07346306\u003c/a\u003e'\n because its MIME type ('text/plain') is not executable, and strict\n MIME type checking is enabled.\n 192.168.178.29/:1 Refused to execute script from '\u003ca href=\"http://192.168.178.29:8080/public/concourse.js?id=b4688d002041187f6c55f6e8699442ba\" rel=\"nofollow noreferrer\"\u003ehttp://192.168.178.29:8080/public/concourse.js?id=b4688d002041187f6c55f6e8699442ba\u003c/a\u003e' because its MIME type ('text/plain') is not executable, and strict\n MIME type checking is enabled. (index):1 Refused to execute script\n from\n '\u003ca href=\"http://192.168.178.29:8080/public/elm.min.js?id=d38f054604f3aaf5cd4eb0616b3cb3ef\" rel=\"nofollow noreferrer\"\u003ehttp://192.168.178.29:8080/public/elm.min.js?id=d38f054604f3aaf5cd4eb0616b3cb3ef\u003c/a\u003e' because its MIME type ('text/plain') is not executable, and strict\n MIME type checking is enabled. (index):20 Uncaught ReferenceError: Elm\n is not defined\n at (index):20\u003c/p\u003e\n\u003c/blockquote\u003e\n\n\u003cp\u003eIt's probably something obvious but couldn't find anything on google/stack overflow for these errors in combination with Concourse\u003c/p\u003e","answer_count":"0","comment_count":"4","creation_date":"2017-07-19 05:21:04.183 UTC","last_activity_date":"2017-07-19 05:26:12.667 UTC","last_edit_date":"2017-07-19 05:26:12.667 UTC","last_editor_display_name":"","last_editor_user_id":"22180","owner_display_name":"","owner_user_id":"22180","post_type_id":"1","score":"0","tags":"concourse","view_count":"28"} {"id":"17617481","title":"Android - hidden text --\u003e show text for 2 seconds --\u003e hide text again","body":"\u003cp\u003eI am developing a board game that user plays with android. Since android is quite fast, I want to fake that android is performing some tough calculations and thus needs time for its next move.\u003c/p\u003e\n\n\u003cp\u003eWhat I want to do:-\u003c/p\u003e\n\n\u003col\u003e\n\u003cli\u003eUser turn - he moves.\u003c/li\u003e\n\u003cli\u003eAndroid turn - android shows text \"I am thinking\" for 2 seconds\u003c/li\u003e\n\u003cli\u003eAndroid hides that text and \u003cstrong\u003eand only after that\u003c/strong\u003e moves his turn.\u003c/li\u003e\n\u003c/ol\u003e\n\n\u003cp\u003eI tried doing:-\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eonAndroidTurn(){\n textView1.setVisibility(View.VISIBLE);\n Thread.sleep(2000);\n textView2.setVisibility(View.GONE);\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eBut what happens is that thread sleeps but text is not shown (okay I know why).\u003c/p\u003e\n\n\u003cp\u003eThen searching on stackoverflow, I learnt a way:-\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eonAndroidTurn(){\n textView1.setVisibility(View.VISIBLE);\n new Handler().postDelayed(new Runnable(){\n void run() {\n textView1.setVisibility(View.GONE);\n }\n }, 2000);\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eNow what this does is that it runs that text in another thread and android's turn is updated on screen and after moving it's turn android showing \"Thinking\" is total stupidity.\u003c/p\u003e\n\n\u003cp\u003eWhat can I do for this?\u003c/p\u003e","accepted_answer_id":"17618131","answer_count":"3","comment_count":"6","creation_date":"2013-07-12 14:37:39.83 UTC","last_activity_date":"2017-10-08 18:10:50.23 UTC","last_edit_date":"2017-10-08 18:10:50.23 UTC","last_editor_display_name":"","last_editor_user_id":"2365197","owner_display_name":"","owner_user_id":"2365197","post_type_id":"1","score":"0","tags":"java|android|multithreading|thread-sleep","view_count":"1436"} {"id":"32579379","title":"AngularJS does not evaluate expression","body":"\u003cp\u003eI am beginner in AngularJS, so I try to run basic code. However, this simple code does not work in a way I want. The html code is the following:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;!DOCTYPE html\u0026gt;\n\u0026lt;html ng-app\u0026gt; \n\u0026lt;head\u0026gt;\n \u0026lt;script src=\"js/angular.min.js\"\u0026gt;\u0026lt;/script\u0026gt;\n \u0026lt;script\u0026gt; \n function MyFirstCtrl($scope) { \n var employees = ['Jon Doe', 'Abe Lincoln', 'Hugh Grant']; \n $scope.ourEmployees = employees;\n } \n \u0026lt;/script\u0026gt;\n\u0026lt;/head\u0026gt; \n\u0026lt;body ng-controller='MyFirstCtrl'\u0026gt; \n \u0026lt;h2\u0026gt;Number of Employees: {{ourEmployees.length}}\u0026lt;/h2\u0026gt; \n\u0026lt;/body\u0026gt;\n\u0026lt;/html\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eI'd expect that the correct result is \u003cstrong\u003eNumber of Employees: 3\u003c/strong\u003e\nInstead of this, the browser (both Firefox and Edge) shows the following: \u003cstrong\u003eNumber of Employees: {{ourEmployees.length}}\u003c/strong\u003e. Since other simple codes did work, the problem is surely not the reference to the \u003cem\u003eangular.min.js\u003c/em\u003e file.\u003c/p\u003e\n\n\u003cp\u003eThanks in advance.\u003c/p\u003e","accepted_answer_id":"32579748","answer_count":"1","comment_count":"1","creation_date":"2015-09-15 06:43:47.62 UTC","last_activity_date":"2015-09-15 07:05:10.467 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"4386646","post_type_id":"1","score":"0","tags":"javascript|angularjs","view_count":"235"} -{"id":"31582827","title":"Disable Volley logs in Android application","body":"\u003ch1\u003eThe problem\u003c/h1\u003e\n\n\u003cp\u003eI'm developing a SDK with using \u003ca href=\"http://developer.android.com/intl/zh-cn/training/volley/index.html\" rel=\"nofollow\"\u003ethe Volley library\u003c/a\u003e for http(s) calls.\u003c/p\u003e\n\n\u003cp\u003eI'm able to hide my application logs using a customize Log class wrapper, and I would like to disable every log level printing of \u003ccode\u003eVolley\u003c/code\u003e, because it might expose sensitive information sent by HTTPS.\u003c/p\u003e\n\n\u003cp\u003eI know you can use \u003ca href=\"http://sourceforge.net/projects/proguard/\" rel=\"nofollow\"\u003eproguard\u003c/a\u003e to disable logging of application, but I also want to be able to toggle logging on and off from the server side for debugging specific scenarios.\u003c/p\u003e\n\n\u003ch1\u003eWhat have I tried\u003c/h1\u003e\n\n\u003cp\u003eI took a look at the source, and it seems that the \u003ca href=\"https://github.com/google/iosched/blob/master/third_party/volley/src/com/android/volley/VolleyLog.java\" rel=\"nofollow\"\u003eDEBUG flag in the VolleyLog\u003c/a\u003e class only changes the log level, but keeps \u003ccode\u003eERROR\u003c/code\u003e calls in the log, so it isn't a solution for me.\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eIs it possible to hide all \u003ccode\u003eVolley\u003c/code\u003e logs ?\u003c/strong\u003e\u003c/p\u003e","answer_count":"1","comment_count":"2","creation_date":"2015-07-23 09:05:18.01 UTC","favorite_count":"3","last_activity_date":"2015-08-02 06:44:02.9 UTC","last_edit_date":"2015-07-27 08:15:38.233 UTC","last_editor_display_name":"","last_editor_user_id":"51197","owner_display_name":"","owner_user_id":"3979963","post_type_id":"1","score":"6","tags":"android|logging|android-volley","view_count":"2137"} +{"id":"31582827","title":"Disable Volley logs in Android application","body":"\u003ch1\u003eThe problem\u003c/h1\u003e\n\n\u003cp\u003eI'm developing a SDK with using \u003ca href=\"http://developer.android.com/intl/zh-cn/training/volley/index.html\" rel=\"nofollow\"\u003ethe Volley library\u003c/a\u003e for http(s) calls.\u003c/p\u003e\n\n\u003cp\u003eI'm able to hide my application logs using a customize Log class wrapper, and I would like to disable every log level printing of \u003ccode\u003eVolley\u003c/code\u003e, because it might expose sensitive information sent by HTTPS.\u003c/p\u003e\n\n\u003cp\u003eI know you can use \u003ca href=\"http://sourceforge.net/projects/proguard/\" rel=\"nofollow\"\u003eproguard\u003c/a\u003e to disable logging of application, but I also want to be able to toggle logging on and off from the server side for debugging specific scenarios.\u003c/p\u003e\n\n\u003ch1\u003eWhat have I tried\u003c/h1\u003e\n\n\u003cp\u003eI took a look at the source, and it seems that the \u003ca href=\"https://github.com/google/iosched/blob/main/third_party/volley/src/com/android/volley/VolleyLog.java\" rel=\"nofollow\"\u003eDEBUG flag in the VolleyLog\u003c/a\u003e class only changes the log level, but keeps \u003ccode\u003eERROR\u003c/code\u003e calls in the log, so it isn't a solution for me.\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eIs it possible to hide all \u003ccode\u003eVolley\u003c/code\u003e logs ?\u003c/strong\u003e\u003c/p\u003e","answer_count":"1","comment_count":"2","creation_date":"2015-07-23 09:05:18.01 UTC","favorite_count":"3","last_activity_date":"2015-08-02 06:44:02.9 UTC","last_edit_date":"2015-07-27 08:15:38.233 UTC","last_editor_display_name":"","last_editor_user_id":"51197","owner_display_name":"","owner_user_id":"3979963","post_type_id":"1","score":"6","tags":"android|logging|android-volley","view_count":"2137"} {"id":"13628032","title":"How to properly setup CucumberJS in a rails app with backbone front-end developed with backbone-on-rails gem","body":"\u003cp\u003eI am developing a rails 3.2 app with Cucumber/capybara/rspec and the backbone-on-rails gem for front-end dev. I would like to use CucumberJS and Jasmine for testing the front-end, but I can't manage to properly setup CucumberJS.\u003c/p\u003e","answer_count":"0","comment_count":"2","creation_date":"2012-11-29 14:33:45.507 UTC","last_activity_date":"2017-04-24 12:12:23.247 UTC","last_edit_date":"2017-04-24 12:12:23.247 UTC","last_editor_display_name":"","last_editor_user_id":"1033581","owner_display_name":"","owner_user_id":"318722","post_type_id":"1","score":"0","tags":"backbone.js|cucumber|ruby-on-rails-3.2","view_count":"101"} {"id":"5320766","title":"Why is not the MongoId 12-byte long but the 24-byte?","body":"\u003cp\u003eAccording to the official document: \u003c/p\u003e\n\n\u003cblockquote\u003e\n \u003cp\u003eA BSON ObjectID is a 12-byte value\n consisting of a 4-byte timestamp\n (seconds since epoch), a 3-byte\n machine id, a 2-byte process id, and a\n 3-byte counter\u003c/p\u003e\n\u003c/blockquote\u003e\n\n\u003cp\u003eBut actually it's a 24-byte value like 4d7f4787ac6d604009000000\u003c/p\u003e\n\n\u003cp\u003eWhy does this happen ?\u003c/p\u003e","accepted_answer_id":"5320780","answer_count":"1","comment_count":"1","creation_date":"2011-03-16 03:33:59.6 UTC","favorite_count":"1","last_activity_date":"2011-03-16 03:35:46.34 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"661747","post_type_id":"1","score":"3","tags":"php|mongodb|mongodb-php","view_count":"337"} {"id":"45649535","title":"Getting TypeError: 'NoneType' object is not iterable when sending ajax post request django views","body":"\u003cp\u003eI want to print the list of all my checked choices in my django view function,but when i send throught ajax selected data,i get the following error in my console: \u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eTraceback (most recent call last):\n File \"C:\\Users\\lislis\\DJANGO~2\\DJANGO~1.2\\lib\\site-packages\\django\\core\\handlers\\exception.py\", line 41, in inner\n response = get_response(request)\n File \"C:\\Users\\lislis\\DJANGO~2\\DJANGO~1.2\\lib\\site-packages\\django\\core\\handlers\\base.py\", line 187, in _get_response\n response = self.process_exception_by_middleware(e, request)\n File \"C:\\Users\\lislis\\DJANGO~2\\DJANGO~1.2\\lib\\site-packages\\django\\core\\handlers\\base.py\", line 185, in _get_response\n response = wrapped_callback(request, *callback_args, **callback_kwargs)\n File \"C:\\Users\\lislis\\Django-VEnvs-Projects\\django 1.11.2\\src\\rapport_sante\\papa\\views.py\", line 78, in stat_ajax\n for d in tb_ids:\nTypeError: 'NoneType' object is not iterable\n[12/Aug/2017 11:53:07] \"POST /sante/stat-ajax/ HTTP/1.1\" 500 19573\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHere is a part of my ajax post request:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e var data =[];\n $(\":checkbox:checked\").each(function() {\n data.push($(this).val());\n });\n\n if(data.length==0)\n {\n alert(\"Veuillez cocher au moins une dps\");\n alert(data.length);\n }\n else\n {\n\n $.ajax({\n url: \"{% url 'papa:stat-ajax' %}\",\n type:\"post\",\n data: {dpsID:data,csrfmiddlewaretoken: '{{ csrf_token }}'},\n success:function(data) \n {\n //Some code\n }\n });\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eHere is my view function,where i would like to display all the data contained in the \u003ccode\u003edpsID\u003c/code\u003e of my ajax POST request:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003edef stat_ajax(request):\n tb_ids=request.POST.get('dpsID')\n for d in tb_ids:\n print(d)\n\u003c/code\u003e\u003c/pre\u003e","accepted_answer_id":"45650558","answer_count":"2","comment_count":"0","creation_date":"2017-08-12 11:08:43.677 UTC","last_activity_date":"2017-08-12 12:59:18.553 UTC","last_editor_display_name":"","owner_display_name":"","owner_user_id":"8121151","post_type_id":"1","score":"1","tags":"javascript|jquery|python|ajax|django","view_count":"82"} diff --git a/test/integration/test-runner.js b/test/integration/test-runner.js index d07c6e934..e0782110f 100644 --- a/test/integration/test-runner.js +++ b/test/integration/test-runner.js @@ -158,8 +158,8 @@ function build (opts = {}) { /** * Fill the stashed values of a command - * let's say the we have stashed the `master` value, - * is_true: nodes.$master.transport.profiles + * let's say that we have stashed the `cluster_manager` value, + * is_true: nodes.$cluster_manager.transport.profiles * becomes * is_true: nodes.new_value.transport.profiles * @param {object|string} the action to update diff --git a/test/types/connection.test-d.ts b/test/types/connection.test-d.ts index 7b855afe4..9a8746866 100644 --- a/test/types/connection.test-d.ts +++ b/test/types/connection.test-d.ts @@ -41,7 +41,7 @@ import { ConnectionOptions } from '../../lib/Connection' headers: {}, agent: { keepAlive: false }, status: 'alive', - roles: { master: true }, + roles: {}, auth: { username: 'username', password: 'password' } }) diff --git a/test/unit/base-connection-pool.test.js b/test/unit/base-connection-pool.test.js index b7961ccb0..5df89f76c 100644 --- a/test/unit/base-connection-pool.test.js +++ b/test/unit/base-connection-pool.test.js @@ -133,6 +133,7 @@ test('API', t => { t.end() }) + // toDo: modify node roles when master is not supported t.test('nodesToHost', t => { t.test('publish_address as ip address (IPv4)', t => { const pool = new BaseConnectionPool({ Connection }) @@ -141,7 +142,7 @@ test('API', t => { http: { publish_address: '127.0.0.1:9200' }, - roles: ['master', 'data', 'ingest'] + roles: ['cluster_manager', 'data', 'ingest'] }, a2: { http: { @@ -155,7 +156,7 @@ test('API', t => { url: new URL('http://127.0.0.1:9200'), id: 'a1', roles: { - master: true, + cluster_manager: true, data: true, ingest: true } @@ -181,7 +182,7 @@ test('API', t => { http: { publish_address: '[::1]:9200' }, - roles: ['master', 'data', 'ingest'] + roles: ['cluster_manager', 'data', 'ingest'] }, a2: { http: { @@ -195,7 +196,7 @@ test('API', t => { url: new URL('http://[::1]:9200'), id: 'a1', roles: { - master: true, + cluster_manager: true, data: true, ingest: true } @@ -221,7 +222,7 @@ test('API', t => { http: { publish_address: 'example.com/127.0.0.1:9200' }, - roles: ['master', 'data', 'ingest'] + roles: ['cluster_manager', 'data', 'ingest'] }, a2: { http: { @@ -235,7 +236,7 @@ test('API', t => { url: new URL('http://example.com:9200'), id: 'a1', roles: { - master: true, + cluster_manager: true, data: true, ingest: true } @@ -261,7 +262,7 @@ test('API', t => { http: { publish_address: 'example.com/[::1]:9200' }, - roles: ['master', 'data', 'ingest'] + roles: ['cluster_manager', 'data', 'ingest'] }, a2: { http: { @@ -275,7 +276,7 @@ test('API', t => { url: new URL('http://example.com:9200'), id: 'a1', roles: { - master: true, + cluster_manager: true, data: true, ingest: true } @@ -301,7 +302,7 @@ test('API', t => { http: { publish_address: 'example.com/127.0.0.1:9200' }, - roles: ['master', 'data', 'ingest'] + roles: ['cluster_manager', 'data', 'ingest'] }, a2: { http: { @@ -319,6 +320,7 @@ test('API', t => { t.end() }) + // toDo: modify node roles when master is not supported t.test('update', t => { t.test('Should not update existing connections', t => { t.plan(2) @@ -327,7 +329,7 @@ test('API', t => { url: new URL('http://127.0.0.1:9200'), id: 'a1', roles: { - master: true, + cluster_manager: true, data: true, ingest: true } @@ -368,7 +370,7 @@ test('API', t => { url: new URL('http://127.0.0.1:9200'), id: 'a1', roles: { - master: true, + cluster_manager: true, data: true, ingest: true } diff --git a/test/unit/client.test.js b/test/unit/client.test.js index cc2e04c83..d7bc83f33 100644 --- a/test/unit/client.test.js +++ b/test/unit/client.test.js @@ -54,7 +54,6 @@ test('Configure host', t => { deadCount: 0, resurrectTimeout: 0, roles: { - master: true, data: true, ingest: true } @@ -74,7 +73,6 @@ test('Configure host', t => { deadCount: 0, resurrectTimeout: 0, roles: { - master: true, data: true, ingest: true } @@ -86,7 +84,6 @@ test('Configure host', t => { deadCount: 0, resurrectTimeout: 0, roles: { - master: true, data: true, ingest: true } @@ -95,7 +92,8 @@ test('Configure host', t => { t.end() }) - t.test('Single object', t => { + // toDo: modify node roles when master is not supported + t.test('Single object with master role', t => { const client = new Client({ node: { url: new URL('http://localhost:9200'), @@ -126,6 +124,38 @@ test('Configure host', t => { t.end() }) + t.test('Single object with cluster_manager role', t => { + const client = new Client({ + node: { + url: new URL('http://localhost:9200'), + id: 'node', + roles: { + cluster_manager: true, + data: false, + ingest: false + }, + ssl: 'ssl' + } + }) + const pool = client.connectionPool + t.match(pool.connections.find(c => c.id === 'node'), { + url: new URL('http://localhost:9200'), + id: 'node', + ssl: 'ssl', + deadCount: 0, + resurrectTimeout: 0 + }) + + t.same(pool.connections.find(c => c.id === 'node').roles, { + cluster_manager: true, + data: false, + ingest: false + }) + + t.end() + }) + + // toDo: modify node roles when master is not supported t.test('Array of objects', t => { const client = new Client({ nodes: [{ @@ -141,7 +171,7 @@ test('Configure host', t => { url: new URL('http://localhost:9200'), id: 'node2', roles: { - master: false, + cluster_manager: false, data: true, ingest: false }, @@ -172,7 +202,7 @@ test('Configure host', t => { }) t.same(pool.connections.find(c => c.id === 'node2').roles, { - master: false, + cluster_manager: false, data: true, ingest: false }) diff --git a/test/unit/connection-pool.test.js b/test/unit/connection-pool.test.js index a904a17fa..70c8a5337 100644 --- a/test/unit/connection-pool.test.js +++ b/test/unit/connection-pool.test.js @@ -331,6 +331,7 @@ test('API', t => { t.end() }) + // toDo: modify node roles when master is not supported t.test('nodesToHost', t => { t.test('publish_address as ip address (IPv4)', t => { const pool = new ConnectionPool({ Connection }) @@ -339,7 +340,7 @@ test('API', t => { http: { publish_address: '127.0.0.1:9200' }, - roles: ['master', 'data', 'ingest'] + roles: ['cluster_manager', 'data', 'ingest'] }, a2: { http: { @@ -353,7 +354,7 @@ test('API', t => { url: new URL('http://127.0.0.1:9200'), id: 'a1', roles: { - master: true, + cluster_manager: true, data: true, ingest: true } @@ -379,7 +380,7 @@ test('API', t => { http: { publish_address: '[::1]:9200' }, - roles: ['master', 'data', 'ingest'] + roles: ['cluster_manager', 'data', 'ingest'] }, a2: { http: { @@ -393,7 +394,7 @@ test('API', t => { url: new URL('http://[::1]:9200'), id: 'a1', roles: { - master: true, + cluster_manager: true, data: true, ingest: true } @@ -419,7 +420,7 @@ test('API', t => { http: { publish_address: 'example.com/127.0.0.1:9200' }, - roles: ['master', 'data', 'ingest'] + roles: ['cluster_manager', 'data', 'ingest'] }, a2: { http: { @@ -433,7 +434,7 @@ test('API', t => { url: new URL('http://example.com:9200'), id: 'a1', roles: { - master: true, + cluster_manager: true, data: true, ingest: true } @@ -459,7 +460,7 @@ test('API', t => { http: { publish_address: 'example.com/[::1]:9200' }, - roles: ['master', 'data', 'ingest'] + roles: ['cluster_manager', 'data', 'ingest'] }, a2: { http: { @@ -473,7 +474,7 @@ test('API', t => { url: new URL('http://example.com:9200'), id: 'a1', roles: { - master: true, + cluster_manager: true, data: true, ingest: true } @@ -499,7 +500,7 @@ test('API', t => { http: { publish_address: 'example.com/127.0.0.1:9200' }, - roles: ['master', 'data', 'ingest'] + roles: ['cluster_manager', 'data', 'ingest'] }, a2: { http: { @@ -521,7 +522,7 @@ test('API', t => { http: { publish_address: 'example.com:9200' }, - roles: ['master', 'data', 'ingest'] + roles: ['cluster_manager', 'data', 'ingest'] }, a2: { http: { @@ -534,7 +535,7 @@ test('API', t => { url: new URL('http://example.com:9200'), id: 'a1', roles: { - master: true, + cluster_manager: true, data: true, ingest: true } @@ -542,7 +543,6 @@ test('API', t => { url: new URL('http://example.com:9201'), id: 'a2', roles: { - master: false, data: false, ingest: false } @@ -554,6 +554,7 @@ test('API', t => { t.end() }) + // toDo: modify node roles when master is not supported t.test('update', t => { t.test('Should not update existing connections', t => { t.plan(2) @@ -562,7 +563,7 @@ test('API', t => { url: new URL('http://127.0.0.1:9200'), id: 'a1', roles: { - master: true, + cluster_manager: true, data: true, ingest: true } @@ -603,7 +604,7 @@ test('API', t => { url: new URL('http://127.0.0.1:9200'), id: 'a1', roles: { - master: true, + cluster_manager: true, data: true, ingest: true } @@ -678,7 +679,7 @@ test('API', t => { url: new URL('http://127.0.0.1:9200'), id: 'a1', roles: { - master: true, + cluster_manager: true, data: true, ingest: true } @@ -774,6 +775,7 @@ test('Node selector', t => { t.end() }) +// toDo: modify node roles when master is not supported test('Node filter', t => { t.test('default', t => { t.plan(1) @@ -782,6 +784,21 @@ test('Node filter', t => { t.ok(pool.getConnection({ filter: defaultNodeFilter }) instanceof Connection) }) + t.test('Should filter cluster_manager only nodes', t => { + t.plan(1) + const pool = new ConnectionPool({ Connection }) + pool.addConnection({ + url: new URL('http://localhost:9200/'), + roles: { + cluster_manager: true, + data: false, + ingest: false + } + }) + t.equal(pool.getConnection({ filter: defaultNodeFilter }), null) + }) + + // toDo: delete this test when master is not a node role t.test('Should filter master only nodes', t => { t.plan(1) const pool = new ConnectionPool({ Connection }) diff --git a/test/unit/connection.test.js b/test/unit/connection.test.js index 7dfcd7719..ff0796064 100644 --- a/test/unit/connection.test.js +++ b/test/unit/connection.test.js @@ -641,7 +641,7 @@ test('Should disallow two-byte characters in URL path', t => { }) }) -test('setRole', t => { +test('should set cluster_manager role', t => { t.test('Update the value of a role', t => { t.plan(2) @@ -650,15 +650,14 @@ test('setRole', t => { }) t.same(connection.roles, { - master: true, data: true, ingest: true }) - connection.setRole('master', false) + connection.setRole('cluster_manager', true) t.same(connection.roles, { - master: false, + cluster_manager: true, data: true, ingest: true }) @@ -680,6 +679,49 @@ test('setRole', t => { } }) + t.test('Invalid value', t => { + t.plan(2) + + const connection = new Connection({ + url: new URL('http://localhost:9200') + }) + + try { + connection.setRole('cluster_manager', 1) + t.fail('Shoud throw') + } catch (err) { + t.ok(err instanceof ConfigurationError) + t.equal(err.message, 'enabled should be a boolean') + } + }) + + t.end() +}) + +// master role is deprecated +// toDo: delete this test when maste role is completed removed +test('should set master role', t => { + t.test('Update the value of a role', t => { + t.plan(2) + + const connection = new Connection({ + url: new URL('http://localhost:9200') + }) + + t.same(connection.roles, { + data: true, + ingest: true + }) + + connection.setRole('master', false) + + t.same(connection.roles, { + master: false, + data: true, + ingest: true + }) + }) + t.test('Invalid value', t => { t.plan(2) @@ -724,7 +766,7 @@ test('Util.inspect Connection class should hide agent, ssl and auth', t => { resurrectTimeout: 0, _openRequests: 0, status: 'alive', - roles: { master: true, data: true, ingest: true }}`) + roles: { data: true, ingest: true }}`) ) }) @@ -748,7 +790,6 @@ test('connection.toJSON should hide agent, ssl and auth', t => { _openRequests: 0, status: 'alive', roles: { - master: true, data: true, ingest: true } @@ -818,7 +859,7 @@ test('Should not add agent and ssl to the serialized connection', t => { t.equal( JSON.stringify(connection), - '{"url":"http://localhost:9200/","id":"http://localhost:9200/","headers":{},"deadCount":0,"resurrectTimeout":0,"_openRequests":0,"status":"alive","roles":{"master":true,"data":true,"ingest":true}}' + '{"url":"http://localhost:9200/","id":"http://localhost:9200/","headers":{},"deadCount":0,"resurrectTimeout":0,"_openRequests":0,"status":"alive","roles":{"data":true,"ingest":true}}' ) t.end() diff --git a/test/utils/MockConnection.js b/test/utils/MockConnection.js index 5d6d967f7..0a90fc840 100644 --- a/test/utils/MockConnection.js +++ b/test/utils/MockConnection.js @@ -104,13 +104,13 @@ class MockConnectionSniff extends Connection { http: { publish_address: 'localhost:9200' }, - roles: ['master', 'data', 'ingest'] + roles: ['master', 'data', 'ingest'] || ['cluster_manager', 'data', 'ingest'] }, 'node-2': { http: { publish_address: 'localhost:9201' }, - roles: ['master', 'data', 'ingest'] + roles: ['master', 'data', 'ingest'] || ['cluster_manager', 'data', 'ingest'] } } } diff --git a/test/utils/buildCluster.js b/test/utils/buildCluster.js index 39abbefa6..6ccde4be1 100644 --- a/test/utils/buildCluster.js +++ b/test/utils/buildCluster.js @@ -73,7 +73,7 @@ function buildCluster (options, callback) { ? `localhost/127.0.0.1:${port}` : `127.0.0.1:${port}` }, - roles: ['master', 'data', 'ingest'] + roles: ['master', 'data', 'ingest'] || ['cluster_manager', 'data', 'ingest'] } debug(`Booted cluster node '${opts.id}' on port ${port} (cluster id: '${clusterId}')`) done()