Dredd failing to parse apiblueprint response body - parsing

My .apib document has the following response defined:
21 + Response 200 (application/json)
22
23 + Body
24
25 {
26 "Datetime: "2017-04-23T18:25:43.700Z",
27 "UserId": "1",
28 "Goal": "25",
29 "MaxReps": "8",
30 "Workout":
31 [
32 {
33 "SequenceNo": "1",
34 "Action": "Pullups",
35 "Units": "3"
36 },
37 {
38 "SequenceNo": "2",
39 "Action": "Rest",
40 "Units": "60"
41 },
42 {
43 "SequenceNo": "3",
44 "Action": "Pullups",
45 "Units": "5"
46 },
47 {
48 "SequenceNo": "4",
49 "Action": "Rest",
50 "Units": "60"
51 },
52 {
53 "SequenceNo": "5",
54 "Action": "Pullups",
55 "Units": "4"
56 }
57 ]
58 }
However it fails when running dredd with the error:
warn: Parser warning in file '/root/pullapi/api-description.apib': (warning code 10) message-body asset is expected to be a pre-formatted cod
e block, every of its line indented by exactly 12 spaces or 3 tabs on lines 25-58
However this matches the structure in the apiblueprint examples.
Any idea of what I'm doing wrong?

Simply indented the body by 12 spaces:
21 + Response 200 (application/json)
22
23 + Body
24
25 {
26 "Datetime: "2017-04-23T18:25:43.700Z",
27 "UserId": "1",
28 "Goal": "25",
29 "MaxReps": "8",
30 "Workout":
31 [
32 {
33 "SequenceNo": "1",
34 "Action": "Pullups",
35 "Units": "3"
36 },
37 {
38 "SequenceNo": "2",
39 "Action": "Rest",
40 "Units": "60"
41 },
42 {
43 "SequenceNo": "3",
44 "Action": "Pullups",
45 "Units": "5"
46 },
47 {
48 "SequenceNo": "4",
49 "Action": "Rest",
50 "Units": "60"
51 },
52 {
53 "SequenceNo": "5",
54 "Action": "Pullups",
55 "Units": "4"
56 }
57 ]
58 }

Related

How to Convert String into bytearray(EUC-KR)?

Hello There i am using swift 5.0 and developing BLE App.
As we have android app there are using default function as below
byte nByte[] = Name.getBytes( charsetName: "EUC-KR")
Output of android
Value[0] = 32 Value[1] = 30 Value[2] = 32 Value[3] =
32 Value[4] = 31 Value[5] = 31 Value[6] = 32 Value[7] = 37 Value[8] = 2d Value[9] = c3 Value[10] =
e6 Value[11] = ba Value[12] = cf Value[13] = 38 Value[14] = 30 Value[15] = c0 Value[16] = da Value[17] =
39 Value[18] = 30 Value[19] = 31 Value[20] = 35 Value[21] = 2d Value[22] = 58 Value[23] = 2d Value[24] =
30 Value[25] = 32 Value[26] = 2d Value[27] = 31 Value[28] = 32 Value[29] = 31 Value[30] = 32 Value[31] =
31 Value[32] = 32 Value[33] = 31 Value[34] = 2e Value[35] = 54 Value[36] = 58 Value[37] = 54
We used in iOS different type of string convert as below
Code 1
let rawEncoding = CFStringConvertEncodingToNSStringEncoding(CFStringEncoding(CFStringEncodings.EUC_KR.rawValue))
let encoding = String.Encoding(rawValue: rawEncoding)
let strEUCData = "20221127-충북80자9015-X-02-1212121.TXT".data(using: encoding) ?? Data()
Output of iOS
bytes : 38 elements
0 : 50
1 : 48
2 : 50
3 : 50
4 : 49
5 : 49
6 : 50
8 : 45
9 : 195
10 : 230
11 : 186
12 : 207
13 : 56
14 : 48
15 : 192
16 : 218
17 : 57
18 : 48
19 : 49
20 : 53
21 : 45
22 : 88
23 : 45
24 : 48
25 : 50
26 : 45
27 : 49
28 : 50
29 : 49
30 : 50
31 : 49
32 : 50
33 : 49
34 : 46
35 : 84
36 : 88
37 : 84
Code 2
let strEUCData1 = "20221127-충북80자9015-X-02-1212121.TXT".data(using: String.Encoding(rawValue: 0x80000940)) ?? Data()
All above functions given wrong byte array.
Any help will be appreciated.
Thank you.
They are the same data. The Android output is in Hex (base 16) number and the iOS output is in decimal (base 10) number:
Android (Hex) iOS (Decimal)
32 50
30 48
32 50
32 50
31 49
31 49
32 50
37 55
2d 45
c3 195
e6 230
ba 186
cf 207
38 56
30 48
c0 192
da 218
39 57
30 48
31 49
35 53
2d 45
58 88
2d 45
30 48
32 50
2d 45
31 49
32 50
31 49
32 50
31 49
32 50
31 49
2e 46
54 84
58 88
54 84

react-native-share error ENSCOCOAERRORDOMAIN3072 on Save to File in iOS

I'm developing a react-native application, I use import Share from 'react-native-share'; for sharing files.
When it open share modal on iOS and I choose Save to File ( for examples a pdf file ) it thrown this execption:
{
"code": "ENSCOCOAERRORDOMAIN3072",
"message": "The operation was cancelled.",
"nativeStackIOS": [
"0 MyApp 0x0000000109361a97 RCTJSErrorFromCodeMessageAndNSError + 135",
"1 MyApp 0x00000001093619c3 RCTJSErrorFromNSError + 275",
"2 MyApp 0x00000001092e8c81 __41-[RCTModuleMethod processMethodSignature]_block_invoke_4.110 + 161",
"3 MyApp 0x0000000109242696 __48-[RNShare open:failureCallback:successCallback:]_block_invoke_2 + 214",
"4 ShareSheet 0x00007fff4310eec7 __68-[UIActivityViewController _cleanupActivityWithSuccess:items:error:]_block_invoke + 183",
"5 UIKitCore 0x00007fff46e15f25 -[UIPresentationController transitionDidFinish:] + 978",
"6 UIKitCore 0x00007fff46e1aa61 __56-[UIPresentationController runTransitionForCurrentState]_block_invoke.503 + 199",
"7 UIKitCore 0x00007fff46f32e2c -[_UIViewControllerTransitionContext completeTransition:] + 88",
"8 UIKitCore 0x00007fff47a0c180 -[UITransitionView notifyDidCompleteTransition:] + 247",
"9 UIKitCore 0x00007fff47a0be03 -[UITransitionView _didCompleteTransition:] + 1423",
"10 UIKitCore 0x00007fff47a45f20 -[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] + 671",
"11 UIKitCore 0x00007fff47a16a11 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 268",
"12 UIKitCore 0x00007fff47a16f83 -[UIViewAnimationState animationDidStop:finished:] + 259",
"13 UIKitCore 0x00007fff47a1710a -[UIViewAnimationState animationDidStop:finished:] + 650",
"14 QuartzCore 0x00007fff2b080ac2 _ZN2CA5Layer23run_animation_callbacksEPv + 306",
"15 libdispatch.dylib 0x00007fff516ad781 _dispatch_client_callout + 8",
"16 libdispatch.dylib 0x00007fff516b9caa _dispatch_main_queue_callback_4CF + 1212",
"17 CoreFoundation 0x00007fff23b0ce49 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9",
"18 CoreFoundation 0x00007fff23b07aa9 __CFRunLoopRun + 2329",
"19 CoreFoundation 0x00007fff23b06e66 CFRunLoopRunSpecific + 438",
"20 GraphicsServices 0x00007fff38346bb0 GSEventRunModal + 65",
"21 UIKitCore 0x00007fff47578dd0 UIApplicationMain + 1621",
"22 MyApp 0x0000000109117201 main + 97",
"23 libdyld.dylib 0x00007fff516ecd29 start + 1",
"24 ??? 0x0000000000000001 0x0 + 1"
],
"domain": "NSCocoaErrorDomain",
"userInfo": {}
}

Inception-v3 transfer learning 'freezing' layers

I have used the Inception-v3 network for transfer learning. The first 172 layers in the network are 'frozen'. But the Inception-v3 network only has 48 layers. Where did the 'extra' layers come from?
Thanks so much.
Actually inception module is bit more complicated. It doesn't have single branch. Later those multiple branches are concatenated into single branch. If you list all layers in keras you get this:
[ 1 ] <keras.engine.topology.InputLayer object at 0x7f94c6b95750>
[ 2 ] <keras.layers.convolutional.Conv2D object at 0x7f94c6577610>
[ 3 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c65778d0>
[ 4 ] <keras.layers.core.Activation object at 0x7f94c6577a90>
[ 5 ] <keras.layers.convolutional.Conv2D object at 0x7f94c6900f50>
[ 6 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c6878bd0>
[ 7 ] <keras.layers.core.Activation object at 0x7f94c690e750>
[ 8 ] <keras.layers.convolutional.Conv2D object at 0x7f94c68d1e10>
[ 9 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c68d1f10>
[ 10 ] <keras.layers.core.Activation object at 0x7f94c6652b90>
[ 11 ] <keras.layers.pooling.MaxPooling2D object at 0x7f94c6319390>
[ 12 ] <keras.layers.convolutional.Conv2D object at 0x7f94c6309490>
[ 13 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c62cea50>
[ 14 ] <keras.layers.core.Activation object at 0x7f94c628b890>
[ 15 ] <keras.layers.convolutional.Conv2D object at 0x7f94c62a4490>
[ 16 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c62b7750>
[ 17 ] <keras.layers.core.Activation object at 0x7f94c626ac50>
[ 18 ] <keras.layers.pooling.MaxPooling2D object at 0x7f94c6226a10>
[ 19 ] <keras.layers.convolutional.Conv2D object at 0x7f94c6064850>
[ 20 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c6076b10>
[ 21 ] <keras.layers.core.Activation object at 0x7f94c602bf10>
[ 22 ] <keras.layers.convolutional.Conv2D object at 0x7f94c6146ad0>
[ 23 ] <keras.layers.convolutional.Conv2D object at 0x7f94c5ff7710>
[ 24 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c6155d90>
[ 25 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c5f889d0>
[ 26 ] <keras.layers.core.Activation object at 0x7f94c6119e90>
[ 27 ] <keras.layers.core.Activation object at 0x7f94c5fbaed0>
[ 28 ] <keras.layers.pooling.AveragePooling2D object at 0x7f94c5e88850>
[ 29 ] <keras.layers.convolutional.Conv2D object at 0x7f94c62329d0>
[ 30 ] <keras.layers.convolutional.Conv2D object at 0x7f94c60d4990>
[ 31 ] <keras.layers.convolutional.Conv2D object at 0x7f94c5f77b50>
[ 32 ] <keras.layers.convolutional.Conv2D object at 0x7f94c5e962d0>
[ 33 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c6232350>
[ 34 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c60e6c50>
[ 35 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c5f77750>
[ 36 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c5e5a890>
[ 37 ] <keras.layers.core.Activation object at 0x7f94c619cf90>
[ 38 ] <keras.layers.core.Activation object at 0x7f94c60ac8d0>
[ 39 ] <keras.layers.core.Activation object at 0x7f94c5ec8b10>
[ 40 ] <keras.layers.core.Activation object at 0x7f94c5e0ca90>
[ 41 ] <keras.layers.merge.Concatenate object at 0x7f94c5e24890>
[ 42 ] <keras.layers.convolutional.Conv2D object at 0x7f94c5c4f990>
[ 43 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c5c4f590>
[ 44 ] <keras.layers.core.Activation object at 0x7f94c5c22310>
[ 45 ] <keras.layers.convolutional.Conv2D object at 0x7f94c5db9910>
[ 46 ] <keras.layers.convolutional.Conv2D object at 0x7f94c5bde710>
[ 47 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c5d49ad0>
[ 48 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c5bde310>
[ 49 ] <keras.layers.core.Activation object at 0x7f94c5d0df10>
[ 50 ] <keras.layers.core.Activation object at 0x7f94c5bb3750>
[ 51 ] <keras.layers.pooling.AveragePooling2D object at 0x7f94c5a81c50>
[ 52 ] <keras.layers.convolutional.Conv2D object at 0x7f94c5e39a50>
[ 53 ] <keras.layers.convolutional.Conv2D object at 0x7f94c5cc9690>
[ 54 ] <keras.layers.convolutional.Conv2D object at 0x7f94c5b6fe90>
[ 55 ] <keras.layers.convolutional.Conv2D object at 0x7f94c5af5dd0>
[ 56 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c5e19a10>
[ 57 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c5cdd850>
[ 58 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c5b6fed0>
[ 59 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c5a44850>
[ 60 ] <keras.layers.core.Activation object at 0x7f94c5d9eb10>
[ 61 ] <keras.layers.core.Activation object at 0x7f94c5c90c50>
[ 62 ] <keras.layers.core.Activation object at 0x7f94c5ac54d0>
[ 63 ] <keras.layers.core.Activation object at 0x7f94c5a66710>
[ 64 ] <keras.layers.merge.Concatenate object at 0x7f94c5a157d0>
[ 65 ] <keras.layers.convolutional.Conv2D object at 0x7f94c589aad0>
[ 66 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c5854350>
[ 67 ] <keras.layers.core.Activation object at 0x7f94c581b390>
[ 68 ] <keras.layers.convolutional.Conv2D object at 0x7f94c59a4850>
[ 69 ] <keras.layers.convolutional.Conv2D object at 0x7f94c57d5b10>
[ 70 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c59a4450>
[ 71 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c57e9cd0>
[ 72 ] <keras.layers.core.Activation object at 0x7f94c596ae90>
[ 73 ] <keras.layers.core.Activation object at 0x7f94c57aed90>
[ 74 ] <keras.layers.pooling.AveragePooling2D object at 0x7f94c56fb610>
[ 75 ] <keras.layers.convolutional.Conv2D object at 0x7f94c5a153d0>
[ 76 ] <keras.layers.convolutional.Conv2D object at 0x7f94c59365d0>
[ 77 ] <keras.layers.convolutional.Conv2D object at 0x7f94c5769890>
[ 78 ] <keras.layers.convolutional.Conv2D object at 0x7f94c56eec50>
[ 79 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c5a237d0>
[ 80 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c59361d0>
[ 81 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c577aa50>
[ 82 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c56bd210>
[ 83 ] <keras.layers.core.Activation object at 0x7f94c5995090>
[ 84 ] <keras.layers.core.Activation object at 0x7f94c588b610>
[ 85 ] <keras.layers.core.Activation object at 0x7f94c56c1e90>
[ 86 ] <keras.layers.core.Activation object at 0x7f94c566edd0>
[ 87 ] <keras.layers.merge.Concatenate object at 0x7f94c560dbd0>
[ 88 ] <keras.layers.convolutional.Conv2D object at 0x7f94c559ec50>
[ 89 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c55ae7d0>
[ 90 ] <keras.layers.core.Activation object at 0x7f94c5573250>
[ 91 ] <keras.layers.convolutional.Conv2D object at 0x7f94c552d9d0>
[ 92 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c54c0b90>
[ 93 ] <keras.layers.core.Activation object at 0x7f94c5484fd0>
[ 94 ] <keras.layers.convolutional.Conv2D object at 0x7f94c561dd90>
[ 95 ] <keras.layers.convolutional.Conv2D object at 0x7f94c5441750>
[ 96 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c567fd50>
[ 97 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c5452910>
[ 98 ] <keras.layers.core.Activation object at 0x7f94c5581e50>
[ 99 ] <keras.layers.core.Activation object at 0x7f94c5408d10>
[ 100 ] <keras.layers.pooling.MaxPooling2D object at 0x7f94c53c6a50>
[ 101 ] <keras.layers.merge.Concatenate object at 0x7f94c53d5a50>
[ 102 ] <keras.layers.convolutional.Conv2D object at 0x7f94c5196690>
[ 103 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c51ab850>
[ 104 ] <keras.layers.core.Activation object at 0x7f94c515dc50>
[ 105 ] <keras.layers.convolutional.Conv2D object at 0x7f94c511b990>
[ 106 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c511b590>
[ 107 ] <keras.layers.core.Activation object at 0x7f94c50ee310>
[ 108 ] <keras.layers.convolutional.Conv2D object at 0x7f94c53743d0>
[ 109 ] <keras.layers.convolutional.Conv2D object at 0x7f94c50ae710>
[ 110 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c5366e10>
[ 111 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c50ae310>
[ 112 ] <keras.layers.core.Activation object at 0x7f94c5337410>
[ 113 ] <keras.layers.core.Activation object at 0x7f94c5001750>
[ 114 ] <keras.layers.convolutional.Conv2D object at 0x7f94c52f4b90>
[ 115 ] <keras.layers.convolutional.Conv2D object at 0x7f94c4fc2e90>
[ 116 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c5284d50>
[ 117 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c4fc2ed0>
[ 118 ] <keras.layers.core.Activation object at 0x7f94c524b190>
[ 119 ] <keras.layers.core.Activation object at 0x7f94c4f924d0>
[ 120 ] <keras.layers.pooling.AveragePooling2D object at 0x7f94c4ed3f50>
[ 121 ] <keras.layers.convolutional.Conv2D object at 0x7f94c53d54d0>
[ 122 ] <keras.layers.convolutional.Conv2D object at 0x7f94c5204910>
[ 123 ] <keras.layers.convolutional.Conv2D object at 0x7f94c4f50c50>
[ 124 ] <keras.layers.convolutional.Conv2D object at 0x7f94c4ede9d0>
[ 125 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c53983d0>
[ 126 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c5217ad0>
[ 127 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c4f5f7d0>
[ 128 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c4ea6550>
[ 129 ] <keras.layers.core.Activation object at 0x7f94c5348290>
[ 130 ] <keras.layers.core.Activation object at 0x7f94c51dbf10>
[ 131 ] <keras.layers.core.Activation object at 0x7f94c4f23250>
[ 132 ] <keras.layers.core.Activation object at 0x7f94c4e47450>
[ 133 ] <keras.layers.merge.Concatenate object at 0x7f94c4e73550>
[ 134 ] <keras.layers.convolutional.Conv2D object at 0x7f94c4c388d0>
[ 135 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c4bcaa90>
[ 136 ] <keras.layers.core.Activation object at 0x7f94c4b8eed0>
[ 137 ] <keras.layers.convolutional.Conv2D object at 0x7f94c4b47650>
[ 138 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c4b5d810>
[ 139 ] <keras.layers.core.Activation object at 0x7f94c4b0cc10>
[ 140 ] <keras.layers.convolutional.Conv2D object at 0x7f94c4d85610>
[ 141 ] <keras.layers.convolutional.Conv2D object at 0x7f94c4ace950>
[ 142 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c4d85210>
[ 143 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c4ace550>
[ 144 ] <keras.layers.core.Activation object at 0x7f94c4d4ac50>
[ 145 ] <keras.layers.core.Activation object at 0x7f94c4aa02d0>
[ 146 ] <keras.layers.convolutional.Conv2D object at 0x7f94c4d25390>
[ 147 ] <keras.layers.convolutional.Conv2D object at 0x7f94c4a5c6d0>
[ 148 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c4d16dd0>
[ 149 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c4a5c2d0>
[ 150 ] <keras.layers.core.Activation object at 0x7f94c4ced3d0>
[ 151 ] <keras.layers.core.Activation object at 0x7f94c4a31710>
[ 152 ] <keras.layers.pooling.AveragePooling2D object at 0x7f94c4904c10>
[ 153 ] <keras.layers.convolutional.Conv2D object at 0x7f94c4e03290>
[ 154 ] <keras.layers.convolutional.Conv2D object at 0x7f94c4ca9b50>
[ 155 ] <keras.layers.convolutional.Conv2D object at 0x7f94c49fe450>
[ 156 ] <keras.layers.convolutional.Conv2D object at 0x7f94c4973f90>
[ 157 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c4e36e90>
[ 158 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c4cb9d10>
[ 159 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c49eee90>
[ 160 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c48c6810>
[ 161 ] <keras.layers.core.Activation object at 0x7f94c4de8a10>
[ 162 ] <keras.layers.core.Activation object at 0x7f94c4c76dd0>
[ 163 ] <keras.layers.core.Activation object at 0x7f94c4944490>
[ 164 ] <keras.layers.core.Activation object at 0x7f94c48e66d0>
[ 165 ] <keras.layers.merge.Concatenate object at 0x7f94c4893790>
[ 166 ] <keras.layers.convolutional.Conv2D object at 0x7f94c465aad0>
[ 167 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c466ac90>
[ 168 ] <keras.layers.core.Activation object at 0x7f94c462ed50>
[ 169 ] <keras.layers.convolutional.Conv2D object at 0x7f94c45e7850>
[ 170 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c45fba10>
[ 171 ] <keras.layers.core.Activation object at 0x7f94c45aee10>
[ 172 ] <keras.layers.convolutional.Conv2D object at 0x7f94c4824810>
[ 173 ] <keras.layers.convolutional.Conv2D object at 0x7f94c457b5d0>
[ 174 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c4824410>
[ 175 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c450f790>
[ 176 ] <keras.layers.core.Activation object at 0x7f94c47e9e50>
[ 177 ] <keras.layers.core.Activation object at 0x7f94c453eb90>
[ 178 ] <keras.layers.convolutional.Conv2D object at 0x7f94c47b8590>
[ 179 ] <keras.layers.convolutional.Conv2D object at 0x7f94c44fd8d0>
[ 180 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c47b8190>
[ 181 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c44fd4d0>
[ 182 ] <keras.layers.core.Activation object at 0x7f94c470a5d0>
[ 183 ] <keras.layers.core.Activation object at 0x7f94c4451250>
[ 184 ] <keras.layers.pooling.AveragePooling2D object at 0x7f94c43b03d0>
[ 185 ] <keras.layers.convolutional.Conv2D object at 0x7f94c4893390>
[ 186 ] <keras.layers.convolutional.Conv2D object at 0x7f94c4719a90>
[ 187 ] <keras.layers.convolutional.Conv2D object at 0x7f94c4411650>
[ 188 ] <keras.layers.convolutional.Conv2D object at 0x7f94c43a0490>
[ 189 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c48a1790>
[ 190 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c46d2310>
[ 191 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c4411250>
[ 192 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c4375410>
[ 193 ] <keras.layers.core.Activation object at 0x7f94c4815050>
[ 194 ] <keras.layers.core.Activation object at 0x7f94c469c350>
[ 195 ] <keras.layers.core.Activation object at 0x7f94c43d6c90>
[ 196 ] <keras.layers.core.Activation object at 0x7f94c43220d0>
[ 197 ] <keras.layers.merge.Concatenate object at 0x7f94c4331990>
[ 198 ] <keras.layers.convolutional.Conv2D object at 0x7f94c40fbc90>
[ 199 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c4089810>
[ 200 ] <keras.layers.core.Activation object at 0x7f94c404c290>
[ 201 ] <keras.layers.convolutional.Conv2D object at 0x7f94c400aa10>
[ 202 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c401bbd0>
[ 203 ] <keras.layers.core.Activation object at 0x7f94c3fdff90>
[ 204 ] <keras.layers.convolutional.Conv2D object at 0x7f94c42429d0>
[ 205 ] <keras.layers.convolutional.Conv2D object at 0x7f94c3f99790>
[ 206 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c42425d0>
[ 207 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c3fac950>
[ 208 ] <keras.layers.core.Activation object at 0x7f94c4215050>
[ 209 ] <keras.layers.core.Activation object at 0x7f94c3f60d50>
[ 210 ] <keras.layers.convolutional.Conv2D object at 0x7f94c41d3750>
[ 211 ] <keras.layers.convolutional.Conv2D object at 0x7f94c3f1ea90>
[ 212 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c41d3350>
[ 213 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c3f1e690>
[ 214 ] <keras.layers.core.Activation object at 0x7f94c41a8790>
[ 215 ] <keras.layers.core.Activation object at 0x7f94c3eefad0>
[ 216 ] <keras.layers.pooling.AveragePooling2D object at 0x7f94c3dc1590>
[ 217 ] <keras.layers.convolutional.Conv2D object at 0x7f94c4e73150>
[ 218 ] <keras.layers.convolutional.Conv2D object at 0x7f94c41674d0>
[ 219 ] <keras.layers.convolutional.Conv2D object at 0x7f94c3ead810>
[ 220 ] <keras.layers.convolutional.Conv2D object at 0x7f94c3dd0110>
[ 221 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c4331590>
[ 222 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c41670d0>
[ 223 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c3ead410>
[ 224 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c3d955d0>
[ 225 ] <keras.layers.core.Activation object at 0x7f94c4294190>
[ 226 ] <keras.layers.core.Activation object at 0x7f94c413d510>
[ 227 ] <keras.layers.core.Activation object at 0x7f94c3e74e50>
[ 228 ] <keras.layers.core.Activation object at 0x7f94c3d44290>
[ 229 ] <keras.layers.merge.Concatenate object at 0x7f94c3d5f5d0>
[ 230 ] <keras.layers.convolutional.Conv2D object at 0x7f94c3c76950>
[ 231 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c3c76550>
[ 232 ] <keras.layers.core.Activation object at 0x7f94c3bcb2d0>
[ 233 ] <keras.layers.convolutional.Conv2D object at 0x7f94c3b886d0>
[ 234 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c3b882d0>
[ 235 ] <keras.layers.core.Activation object at 0x7f94c3b57710>
[ 236 ] <keras.layers.convolutional.Conv2D object at 0x7f94c3d71790>
[ 237 ] <keras.layers.convolutional.Conv2D object at 0x7f94c3b28450>
[ 238 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c3d53750>
[ 239 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c3b19e90>
[ 240 ] <keras.layers.core.Activation object at 0x7f94c3cd4150>
[ 241 ] <keras.layers.core.Activation object at 0x7f94c3aea490>
[ 242 ] <keras.layers.convolutional.Conv2D object at 0x7f94c3cf0650>
[ 243 ] <keras.layers.convolutional.Conv2D object at 0x7f94c3aa6c10>
[ 244 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c3c85810>
[ 245 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c3ab6dd0>
[ 246 ] <keras.layers.core.Activation object at 0x7f94c3cb6c10>
[ 247 ] <keras.layers.core.Activation object at 0x7f94c3a00210>
[ 248 ] <keras.layers.pooling.MaxPooling2D object at 0x7f94c3a39990>
[ 249 ] <keras.layers.merge.Concatenate object at 0x7f94c3a2dfd0>
[ 250 ] <keras.layers.convolutional.Conv2D object at 0x7f94c3790d50>
[ 251 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c37f4d10>
[ 252 ] <keras.layers.core.Activation object at 0x7f94c3775e50>
[ 253 ] <keras.layers.convolutional.Conv2D object at 0x7f94c394c8d0>
[ 254 ] <keras.layers.convolutional.Conv2D object at 0x7f94c3711c50>
[ 255 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c394c4d0>
[ 256 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c37217d0>
[ 257 ] <keras.layers.core.Activation object at 0x7f94c3920250>
[ 258 ] <keras.layers.core.Activation object at 0x7f94c36e5250>
[ 259 ] <keras.layers.convolutional.Conv2D object at 0x7f94c38df650>
[ 260 ] <keras.layers.convolutional.Conv2D object at 0x7f94c387e3d0>
[ 261 ] <keras.layers.convolutional.Conv2D object at 0x7f94c36a29d0>
[ 262 ] <keras.layers.convolutional.Conv2D object at 0x7f94c3633750>
[ 263 ] <keras.layers.pooling.AveragePooling2D object at 0x7f94c35b7650>
[ 264 ] <keras.layers.convolutional.Conv2D object at 0x7f94c3983890>
[ 265 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c38df250>
[ 266 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c3870e10>
[ 267 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c36b4b90>
[ 268 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c35c6910>
[ 269 ] <keras.layers.convolutional.Conv2D object at 0x7f94c3545050>
[ 270 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c3992750>
[ 271 ] <keras.layers.core.Activation object at 0x7f94c38a2c90>
[ 272 ] <keras.layers.core.Activation object at 0x7f94c37c2410>
[ 273 ] <keras.layers.core.Activation object at 0x7f94c367afd0>
[ 274 ] <keras.layers.core.Activation object at 0x7f94c35f8d10>
[ 275 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c3508a90>
[ 276 ] <keras.layers.core.Activation object at 0x7f94c39bfdd0>
[ 277 ] <keras.layers.merge.Concatenate object at 0x7f94c3780b90>
[ 278 ] <keras.layers.merge.Concatenate object at 0x7f94c35b7a50>
[ 279 ] <keras.layers.core.Activation object at 0x7f94c353c110>
[ 280 ] <keras.layers.merge.Concatenate object at 0x7f94c34e9390>
[ 281 ] <keras.layers.convolutional.Conv2D object at 0x7f94c32b2890>
[ 282 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c3294850>
[ 283 ] <keras.layers.core.Activation object at 0x7f94c3211990>
[ 284 ] <keras.layers.convolutional.Conv2D object at 0x7f94c3479410>
[ 285 ] <keras.layers.convolutional.Conv2D object at 0x7f94c322d790>
[ 286 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c3466e50>
[ 287 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c323f950>
[ 288 ] <keras.layers.core.Activation object at 0x7f94c343c450>
[ 289 ] <keras.layers.core.Activation object at 0x7f94c31f6d50>
[ 290 ] <keras.layers.convolutional.Conv2D object at 0x7f94c33f9bd0>
[ 291 ] <keras.layers.convolutional.Conv2D object at 0x7f94c330c950>
[ 292 ] <keras.layers.convolutional.Conv2D object at 0x7f94c31b3a90>
[ 293 ] <keras.layers.convolutional.Conv2D object at 0x7f94c30c6810>
[ 294 ] <keras.layers.pooling.AveragePooling2D object at 0x7f94c3055190>
[ 295 ] <keras.layers.convolutional.Conv2D object at 0x7f94c34dadd0>
[ 296 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c3389d90>
[ 297 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c331fb10>
[ 298 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c31b3690>
[ 299 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c30c6410>
[ 300 ] <keras.layers.convolutional.Conv2D object at 0x7f94c303c110>
[ 301 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c34da050>
[ 302 ] <keras.layers.core.Activation object at 0x7f94c33501d0>
[ 303 ] <keras.layers.core.Activation object at 0x7f94c32e1f50>
[ 304 ] <keras.layers.core.Activation object at 0x7f94c3106ad0>
[ 305 ] <keras.layers.core.Activation object at 0x7f94c308be50>
[ 306 ] <keras.layers.normalization.BatchNormalization object at 0x7f94c303ca90>
[ 307 ] <keras.layers.core.Activation object at 0x7f94c344eed0>
[ 308 ] <keras.layers.merge.Concatenate object at 0x7f94c329e6d0>
[ 309 ] <keras.layers.merge.Concatenate object at 0x7f94c3055590>
[ 310 ] <keras.layers.core.Activation object at 0x7f94c2fdd5d0>
[ 311 ] <keras.layers.merge.Concatenate object at 0x7f94c2ff7910>
[ 312 ] <keras.layers.pooling.GlobalAveragePooling2D object at 0x7f94c2e41a10>
[ 313 ] <keras.layers.core.Dense object at 0x7f94c2e41a90>
[ 314 ] <keras.layers.core.Dense object at 0x7f94c2e41110>

Unable to parse only the imageURL from JSON in iOS

{
"restaurants" : [
{
"name": "Hopdoddy Burger Bar",
"backgroundImageURL": "http://sandbox.bottlerocketapps.com/BR_iOS_CodingExam_2015_Server/Images/hopdoddy.png",
"category" : "Burgers",
"contact": {
"phone": "9723872337",
"formattedPhone": "(972) 387-2337",
"twitter": "hopdoddy"
},
"location": {
"address": "5100 Belt Line Road, STE 502",
"crossStreet": "Dallas North Tollway",
"lat": 32.950787,
"lng": -96.821118,
"postalCode": "75254",
"cc": "US",
"city": "Addison",
"state": "TX",
"country": "United States",
"formattedAddress": [
"5100 Belt Line Road, STE 502 (Dallas North Tollway)",
"Addison, TX 75254",
"United States"
]
}
},
{
"name": "Pappadeaux Seafood Kitchen",
"backgroundImageURL": "http://sandbox.bottlerocketapps.com/BR_iOS_CodingExam_2015_Server/Images/pappadeaux.png",
"category": "Seafood",
"contact": {
"phone": "9724479616",
"formattedPhone": "(972) 447-9616",
"twitter": "pappadeaux"
},
"location": {
"address": "18349 Dallas Pkwy",
"crossStreet": "at Frankford Rd.",
"lat": 32.99908456526653,
"lng": -96.83018780592823,
"postalCode": "75287",
"cc": "US",
"city": "Dallas",
"state": "TX",
"country": "United States",
"formattedAddress": [
"18349 Dallas Pkwy (at Frankford Rd.)",
"Dallas, TX 75287",
"United States"
]
}
},
{
"name": "Buffalo Wild Wings",
"backgroundImageURL": "http://sandbox.bottlerocketapps.com/BR_iOS_CodingExam_2015_Server/Images/buffalo_wild_wings.png",
"category": "Wing Joint",
"contact": {
"phone": "9727019464",
"formattedPhone": "(972) 701-9464",
"twitter": "bwwings"
},
"location": {
"address": "5000 Belt Line Rd Ste 100",
"crossStreet": "at Quorum Dr",
"lat": 32.95347617827522,
"lng": -96.82554602622986,
"postalCode": "75254-6752",
"cc": "US",
"city": "Dallas",
"state": "TX",
"country": "United States",
"formattedAddress": [
"5000 Belt Line Rd Ste 100 (at Quorum Dr)",
"Dallas, TX 75254-6752",
"United States"
]
}
}
]
}
This is the JSON I am trying to parse in iOS. I have created my Model objects with all the required parameters. I am able to parse and fetch all the data except for the backgroundImageURL. I get a NSUnknownKeyException. Can someone help me with this?
Below is the code used for creating the Model objects and adding them to an array.
[self.restaurantsArray enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
Restaurant *restaurant = [[Restaurant alloc]init];
restaurant.name = [obj objectForKey:#"name"];
restaurant.imageURL = [obj objectForKey:#"backgroundImageURL"];
restaurant.category = [obj objectForKey:#"category"];
restaurant.contact = [obj objectForKey:#"contact"];
restaurant.location = [obj objectForKey:#"location"];
[self.parsedRestaurantArray addObject:restaurant];
}];
This is the Restaurant class:
#interface Restaurant : NSObject
#property (nonatomic, strong)NSString *name;
#property (nonatomic, strong)NSString *imageURL;
#property (nonatomic, strong)NSString *category;
#property (nonatomic, strong)Contact *contact;
#property (nonatomic, strong)Location *location;
#end
Here is the track trace:
Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ valueForUndefinedKey:]: this class is not key value coding-compliant for the key backgroundImageURL.'
*** First throw call stack:
(
0 CoreFoundation 0x000000010e631e65 exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010e0aadeb objc_exception_throw + 48
2 CoreFoundation 0x000000010e631aa9 -[NSException raise] + 9
3 Foundation 0x000000010dd0a888 -[NSObject(NSKeyValueCoding) valueForUndefinedKey:] + 226
4 Foundation 0x000000010dc60997 -[NSObject(NSKeyValueCoding) valueForKey:] + 280
5 Foundation 0x000000010dc60758 -[NSArray(NSKeyValueCoding) valueForKey:] + 437
6 BottleRocketExercise 0x000000010cd8692a -[LunchesViewController collectionView:cellForItemAtIndexPath:] + 282
7 UIKit 0x000000010f2335ba -[UICollectionView _createPreparedCellForItemAtIndexPath:withLayoutAttributes:applyAttributes:isFocused:] + 483
8 UIKit 0x000000010f235ae0 -[UICollectionView _updateVisibleCellsNow:] + 4431
9 UIKit 0x000000010f23a23b -[UICollectionView layoutSubviews] + 247
10 UIKit 0x000000010ea954a3 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 703
11 QuartzCore 0x00000001129a759a -[CALayer layoutSublayers] + 146
12 QuartzCore 0x000000011299be70 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 366
13 QuartzCore 0x000000011299bcee _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
14 QuartzCore 0x0000000112990475 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 277
15 QuartzCore 0x00000001129bdc0a _ZN2CA11Transaction6commitEv + 486
16 QuartzCore 0x00000001129be37c _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 92
17 CoreFoundation 0x000000010e55d367 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION + 23
18 CoreFoundation 0x000000010e55d2d7 __CFRunLoopDoObservers + 391
19 CoreFoundation 0x000000010e552f2b __CFRunLoopRun + 1147
20 CoreFoundation 0x000000010e552828 CFRunLoopRunSpecific + 488
21 GraphicsServices 0x000000011245cad2 GSEventRunModal + 161
22 UIKit 0x000000010e9de610 UIApplicationMain + 171
23 BottleRocketExercise 0x000000010cd85f5f main + 111
24 libdyld.dylib 0x00000001106f192d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
I think the problem with your code is that you have and array of restaurants and not just one restaurant. Your obj has not the keys because it has arrays of restaurants. You can only get the keys of each restaurant.

parsing using awk

how to parse a file based on data from another file using awk.
i made a script:
BEGIN{ FS="\t" ; OFS="\t"
while((getline<"headfpkm")>0) {
++a
id[a]=$1
fpkm[a]=$2
print id[a],fpkm[a]
}
lastid=id[a]
print lastid
close("headfpkm")
}
/$lastid/{
print $2,$3,$5,$7,$8,$14,fpkm[a]
a--
lastid=id[a]
}
END{ print "total lines=",FNR,"\n\nfile 1 index: ",a}
when i run it :
/$ awk -f testawk.awk file2
it runs the BEGIN section properly but doesnt give any output.
NM_000014 5.04503
NM_000015 0.586677
NM_000016 1.138332278
NM_000017 0.64386
NM_000018 3.61746
NM_000019 2.8793
NM_000020 10.846
NM_000021 0.685098
NM_000022 46388.6
NM_000026 0.257471
NM_000026
total lines= 10
file 1 index: 10
Is anything wrong with the searching section??
file 2 looks like this:
34 ACADM NM_000016 9606 hsa-miR-3148 3 80 87 0.003 -0.016 -0.094 0.082 0.112 -0.160 97
34 ACADM NM_000016 9606 hsa-miR-3163 1 623 629 0.001 -0.022 -0.020 0.065 0.125 -0.01 57
35 ACADS NM_000017 9606 hsa-miR-3921 3 68 75 0.013 0.192 -0.097 0.031 -0.039 -0.147 82
35 ACADS NM_000017 9606 hsa-miR-4303 2 67 73 0.012 0.150 -0.052 0.013 -0.039 -0.036 31
35 ACADS NM_000017 9606 hsa-miR-4653-5p 3 68 75 0.003 0.192 -0.097 0.031 -0.039 -0.157 84
37 ACADVL NM_000018 9606 hsa-miR-124 2 31 37 0.003 0.023 -0.057 0.012 -0.032 -0.171 76
37 ACADVL NM_000018 9606 hsa-miR-1827 2 135 141 -0.007 -0.043 -0.058 0.039 -0.069 -0.258 91
37 ACADVL NM_000018 9606 hsa-miR-2682 2 134 140 0.003 -0.014 -0.058 0.004 -0.047 -0.232 87
37 ACADVL NM_000018 9606 hsa-miR-449c 2 134 140 -0.035 -0.014 -0.058 0.004 -0.047 -0.270 92
37 ACADVL NM_000018 9606 hsa-miR-506 2 31 37 -0.016 0.023 -0.057 0.012 -0.032 -0.190 80
This is going to be a bit of guess, because I'm not 100% sure as to what you're trying to accomplish. The better way to solve your problem, would be to do something like this:
BEGIN {
FS=OFS="\t"
}
FNR==NR {
c++
a[$1]=$2
next
}
$3 in a {
print $2,$3,$5,$7,$8,$14,a[$3]
}
END {
printf "total lines=%s\n\nfile 1 index: %s\n", FNR, c
}
Run like:
awk -f script.awk headfpkm file2
Results:
ACADM NM_000016 hsa-miR-3148 80 87 -0.160 1.138332278
ACADM NM_000016 hsa-miR-3163 623 629 -0.01 1.138332278
ACADS NM_000017 hsa-miR-3921 68 75 -0.147 0.64386
ACADS NM_000017 hsa-miR-4303 67 73 -0.036 0.64386
ACADS NM_000017 hsa-miR-4653-5p 68 75 -0.157 0.64386
ACADVL NM_000018 hsa-miR-124 31 37 -0.171 3.61746
ACADVL NM_000018 hsa-miR-1827 135 141 -0.258 3.61746
ACADVL NM_000018 hsa-miR-2682 134 140 -0.232 3.61746
ACADVL NM_000018 hsa-miR-449c 134 140 -0.270 3.61746
ACADVL NM_000018 hsa-miR-506 31 37 -0.190 3.61746
total lines=10
file 1 index: 10

Resources