I wonder if it is possible to create alias for an image in Xcode so I don't have to add it multiple times (in order to override other targets resources, e.g. n : 1). While it is possible in Android ecosystem I hoped that Xcode/iOS has something similar, so I would expect something like this to work.
Imagine: Resources > Assets > MyAssetCatalog > foo > bar.pdf
So there is folder called foo with this content:
-- foo
--|-- Content.json
--|-- bar.imageset
--|--|-- Content.json
--|--|-- bar.pdf
--|-- bar_alias.imageset
--|--|-- Content.json
where there is something like this in alias' content file:
{
"images" : [
{
"filename" : "../bar.imageset/bar.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Any idea if something like this is supposed to work, or there is another way how to achieve this?
Related
I'm trying to read multiple files from the data section of a Data asset. I'm currently prototyping and writing json files directly into the Asset Bundle folders, under a folder called "CommonData.dataset". CommonData is properly set up as a Data set within my assets catalogue.
It all works fine, EXCEPT I only ever get data for one json file, even 'tho I've listed 2 files in the data section of Contents.json, which is documented as an array of entries:
{
"data" : [
{
"filename" : "ATestFile.json",
"idiom" : "universal",
"universal-type-identifier" : "public.json"
},
{
"filename" : "AnotherTestFile.json",
"idiom" : "universal",
"universal-type-identifier" : "public.json"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
After this call, asset.data only contains the contents of the first file, the second never even gets read:
let asset = NSDataAsset(name: "CommonData", bundle: Bundle.main)
In my production code I'll have 30 or 40 json files referenced, concatenating them isn't an option. I'm sure I'm missing something simple - is there an iterator or a cast I can use, or do I need to do multiple calls to NSDataAsset?
The json for both referenced files is well formed BTW, this isn't a stray comma issue (unfortunately).
The array is there in asset json format in order to accommodate for different traits. I.e. you can have in data array two file descriptions, one for light mode, and one for dark mode, etc. You can not have access to more than one file description with the same traits, simultaneously.
Hi I check that in the blockchain.info or blockr.io or other block explorer when checking one transaction ( not my own wallet transaction ) I could see the return value of "block_height" which can be use to count the transaction confirmation using block_count - block_height.
I have my own bitcoin node with -txindex enabled and I add additional txindex=1 in the conf.
But when using "bitcoin-cli decoderawtransaction " the parameters was never there.
How do I turn on that ? Or is it a custom made code ?
Bitcoind run under Ubuntu 14.04 x64bit version 0.11.0
I disable the wallet function and install using https://github.com/spesmilo/electrum-server/blob/master/HOWTO.md
The decoderawtransaction command just decodes the transaction, that is, it makes the transaction human readable.
Any other (though useful) information which is not related to the raw structure of a transaction is not shown.
If you need further info, you might use getrawtransaction <tx hash> 1, which returns both the result of decoderawtransaction and some additional info, such as:
bitcoin-cli getrawtransaction 6263f1db6112a21771bb44f242a282d04313bbda5ed8b517489bd51aa48f7367 1
-> {
"hex" : "010000000...0b00",
"txid" : "6263f1db6112a21771bb44f242a282d04313bbda5ed8b517489bd51aa48f7367",
"version" : 1,
"locktime" : 723863,
"vin" : [
{...}
],
"vout" : [
{...}
],
"blockhash" : "0000000084b830792477a0955eee8081e8074071930f7340ff600cc48c4f724f",
"confirmations" : 4,
"time" : 1457383001,
"blocktime" : 1457383001
}
I'm using Symfony 2.5 freshly installed from the top of this page: http://symfony.com/download
I'm trying to register a mapping compiler pass following the instructions on this page: http://symfony.com/doc/current/cookbook/doctrine/mapping_model_classes.html
Note the "2.5 version" marker on top of the page.
However, the file used in the sample code:
Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\DoctrineOrmMappingsPass
does not exist in my install. Everything else is there.
Here's my composer.json:
"require" : {
"php" : ">=5.3.3",
"symfony/symfony" : "2.5.*",
"doctrine/orm" : "~2.2,>=2.2.3",
"doctrine/doctrine-bundle" : "~1.2",
"twig/extensions" : "~1.0",
"symfony/assetic-bundle" : "~2.3",
"symfony/swiftmailer-bundle" : "~2.3",
"symfony/monolog-bundle" : "~2.4",
"sensio/distribution-bundle" : "~3.0",
"sensio/framework-extra-bundle" : "~3.0",
"incenteev/composer-parameter-handler" : "~2.0"
},
"require-dev" : {
"sensio/generator-bundle" : "~2.3",
"phpunit/phpunit" : "4.2.*"
}
Any help appreciated.
I ended up opening an issue ticket at the Doctrine Bundle repository. It turns out there was a small typo in the Symfony doc, which has been fixed.
Though I'm using iOS, I don't think that's relevant here.
I need to be able to use a constant in two of the values for JSON. Reason: We're using different servers for Development and Production, and can't have the development data mixed with production Data. At build time we'll provide values based on the environment settings (development / production).
Thus, how can I use a constant value for "rsids" and server" in the JSON below:
{
"version" : "1.0",
"analytics" : {
"rsids" : "//I would like to put a Constant Here",
"server" : "",
"charset" : "UTF-8",
"ssl" : false,
"offlineEnabled" : true,
"lifecycleTimeout" : 300,
"privacyDefault" : "optedin",
"poi" : []
},
"target" : {
"clientCode" : "",
"timeout" : 5
},
"audienceManager" : {
"server" : "//I would like to put a Constant Here"
}
}
I would like to be able to do something like this:
NSStirng const *kServerURL = #"www.google.com"
"audienceManager" : {
"server" : kServerUrl
}
UPDATE
There is no Dictionary. I'm using the iOS SDK by Adobe for Site Catalyst. They have a JSON file that I have to edit and provide RSID and Server values. The JSON that you see in the question is the entire file.
The SDK has a library file (.a) also. Here are the docs: http://microsite.omniture.com/t2/help/en_US/mobile/ios/index.html#ADBMobile_Class_and_Method_Reference
If you need to change the value of the constant at build time you should be using #if/#ifdef and friends to do so.
#ifdef DEBUG
NSString const *kServerURL = #"www.google.com"
#else
NSString const *kServerURL = #"www.bing.com"
#endif
You'll have to create multiple files then. You can't have a JSON file be dynamic.
When creating your files from code, you can use constants. At the top of your .m file before the #implementation portion, defined them on multiple lines. One for development, one for QA, and one for production. Comment out the two you don't want and leave the one you do want. When using it, use the format.
"server":[NSString stringWithFormat:#"\"%#\"",kServerUrl];
It is often a good idea to have a dummy login that can safely communicate with your servers. Such a login would have an example set of data to be read, and any uploads would be ignored. This is handy for testing between the different environments, including production, and allows any apps submitted to the App Store to be fully tested with a valid login.
I had a problem with ElasticSearch and Rails, where some data was not indexed properly because of attr_protected. Where does Elastic Search store the indexed data? It would be useful to check if the actual indexed data is wrong.
Checking the mapping with Tire.index('models').mapping does not help, the field is listed.
Probably the easiest way to explore your ElasticSearch cluster is to use elasticsearch-head.
You can install it by doing:
cd elasticsearch/
./bin/plugin -install mobz/elasticsearch-head
Then (assuming ElasticSearch is already running on your local machine), open a browser window to:
http://localhost:9200/_plugin/head/
Alternatively, you can just use curl from the command line, eg:
Check the mapping for an index:
curl -XGET 'http://127.0.0.1:9200/my_index/_mapping?pretty=1'
Get some sample docs:
curl -XGET 'http://127.0.0.1:9200/my_index/_search?pretty=1'
See the actual terms stored in a particular field (ie how that field has been analyzed):
curl -XGET 'http://127.0.0.1:9200/my_index/_search?pretty=1' -d '
{
"facets" : {
"my_terms" : {
"terms" : {
"size" : 50,
"field" : "foo"
}
}
}
}
More available here: http://www.elasticsearch.org/guide
UPDATE : Sense plugin in Marvel
By far the easiest way of writing curl-style commands for Elasticsearch is the Sense plugin in Marvel.
It comes with source highlighting, pretty indenting and autocomplete.
Note: Sense was originally a standalone chrome plugin but is now part of the Marvel project.
Absolutely the easiest way to see your indexed data is to view it in your browser. No downloads or installation needed.
I'm going to assume your elasticsearch host is http://127.0.0.1:9200.
Step 1
Navigate to http://127.0.0.1:9200/_cat/indices?v to list your indices. You'll see something like this:
Step 2
Try accessing the desired index:
http://127.0.0.1:9200/products_development_20160517164519304
The output will look something like this:
Notice the aliases, meaning we can as well access the index at:
http://127.0.0.1:9200/products_development
Step 3
Navigate to http://127.0.0.1:9200/products_development/_search?pretty to see your data:
ElasticSearch data browser
Search, charts, one-click setup....
Aggregation Solution
Solving the problem by grouping the data - DrTech's answer used facets in managing this but, will be deprecated according to Elasticsearch 1.0 reference.
Warning
Facets are deprecated and will be removed in a future release. You are encouraged to
migrate to aggregations instead.
Facets are replaced by aggregates - Introduced in an accessible manner in the Elasticsearch Guide - which loads an example into sense..
Short Solution
The solution is the same except aggregations require aggs instead of facets and with a count of 0 which sets limit to max integer - the example code requires the Marvel Plugin
# Basic aggregation
GET /houses/occupier/_search?search_type=count
{
"aggs" : {
"indexed_occupier_names" : { <= Whatever you want this to be
"terms" : {
"field" : "first_name", <= Name of the field you want to aggregate
"size" : 0
}
}
}
}
Full Solution
Here is the Sense code to test it out - example of a houses index, with an occupier type, and a field first_name:
DELETE /houses
# Index example docs
POST /houses/occupier/_bulk
{ "index": {}}
{ "first_name": "john" }
{ "index": {}}
{ "first_name": "john" }
{ "index": {}}
{ "first_name": "mark" }
# Basic aggregation
GET /houses/occupier/_search?search_type=count
{
"aggs" : {
"indexed_occupier_names" : {
"terms" : {
"field" : "first_name",
"size" : 0
}
}
}
}
Response
Response showing the relevant aggregation code. With two keys in the index, John and Mark.
....
"aggregations": {
"indexed_occupier_names": {
"buckets": [
{
"key": "john",
"doc_count": 2 <= 2 documents matching
},
{
"key": "mark",
"doc_count": 1 <= 1 document matching
}
]
}
}
....
A tool that helps me a lot to debug ElasticSearch is ElasticHQ. Basically, it is an HTML file with some JavaScript. No need to install anywhere, let alone in ES itself: just download it, unzip int and open the HTML file with a browser.
Not sure it is the best tool for ES heavy users. Yet, it is really practical to whoever is in a hurry to see the entries.
Kibana is also a good solution. It is a data visualization platform for Elastic.If installed it runs by default on port 5601.
Out of the many things it provides. It has "Dev Tools" where we can do your debugging.
For example you can check your available indexes here using the command
GET /_cat/indices
If you are using Google Chrome then you can simply use this extension named as Sense it is also a tool if you use Marvel.
https://chrome.google.com/webstore/detail/sense-beta/lhjgkmllcaadmopgmanpapmpjgmfcfig
Following #JanKlimo example, on terminal all you have to do is:
to see all the Index:
$ curl -XGET 'http://127.0.0.1:9200/_cat/indices?v'
to see content of Index products_development_20160517164519304:
$ curl -XGET 'http://127.0.0.1:9200/products_development_20160517164519304/_search?pretty=1'