Defining attributes with .arff file in Weka - machine-learning

I have a problem in Weka library.I am trying to convert txt file to .arff file.But I got some error.My txt file like below:
Atlanta.txt
0000000 Tanner's 100 253 250 178 174 063 059 036 008 074 204 052 163
0000001 Frijoleros 250 062 132 174 063 197 071 142 234 243 075 204 052 162
0000002 Indian Delights 253 250 150 174 083 059 036 117 243 076 205 051 162
0000003 Great Wall 253 191 192 174 036 039 075 204 052 163
0000004 The Brickery 100 253 086 231 250 191 192 059 036 215 005 008 075 205 052 163
0000005 Lawrence's Cafe 250 191 192 174 063 197 071 057 036 140 143 075 204 052 163
0000006 Harold's Barbecue 253 174 010 221 036 017 076 205 051 162
0000007 Zab-E-Lee 011 174 235 076 208 051 164
0000008 The Dessert Place 100 086 150 174 036 042 061 076 204 053 162
0000009 Cafe Diem 250 196 174 063 197 005 042 061 068 074 204 053 162
0000010 El Charro 100 253 250 191 192 174 001 142 234 075 204 051 162
0000011 Kurt's at River Manor 253 231 191 192 174 063 248 036 098 076 205 054 165
0000012 Peggy Sue's Diner 100 253 086 250 191 192 174 063 036 042 061 074 204 053 163
0000013 Pars 253 250 174 071 059 057 036 143 075 205 053 164
0000014 Le Rendez-Vous 253 231 250 200 191 192 174 059 036 091 076 205 053 164
0000015 Rockbridge Diner 253 231 136 191 192 059 045 076 206 053 164
0000016 Chefs' Grill 100 080 253 231 102 191 192 174 083 036 024 025 005 076 206 053 165
0000017 Jonathan Lee's 253 231 245 191 192 174 059 036 039 235 075 205 052 163
0000018 The Country Place 253 099 231 250 062 132 191 192 174 071 083 024 215 005 076 206 054 165
0000019 Hama's 253 250 245 174 128 075 205 052 164
0000020 Raja Indian Restaurant 250 191 192 174 197 036 117 075 205 051 164
0000021 PRICCI 080 253 250 245 189 102 174 114 024 215 121 076 206 054 166
0000022 Pittypat's Porch 100 253 099 250 191 192 174 071 221 083 024 220 217 074 204 052 165
0000023 Houston's 026 253 086 250 174 063 215 005 008 107 076 206 053 164
0000024 Azio 253 086 231 250 102 063 114 248 215 121 182 075 205 053 164
0000026 ABRUZZI RISTORANTE 253 099 200 245 196 189 191 192 174 146 097 036 024 123 076 206 053 167
0000027 Rio Bravo Cantina 100 253 086 250 191 192 174 063 215 138 142 234 075 205 053 163
0000028 Savannah Fish Company 250 191 192 174 040 025 212 075 205 053 165
0000029 Lombardi's 253 231 250 174 024 121 075 205 053 164
0000030 Johnny Rockets 026 100 086 250 174 063 008 107 075 205 053 162
0000031 Opus 099 150 200 196 191 192 174 063 040 071 024 025 005 243 076 206 054 167
0000032 La Paz 100 253 250 191 192 174 063 197 083 036 215 025 142 234 222 076 205 053 163
I need to attribute value as Restaurant Id,Restaurant Name,Cuisine,Price,Style,Atmosphere and Occasion(Restaurant Features).But as you can see,number of columns and number of attributes don't exactly match each other.How can i delete some noise data and how can i group all of these features in this situation.I am planning to make a .arff file like that:
Atlanta.arff
#RELATION 'Atlanta'
#ATTRIBUTE Restaurant Id NUMERIC
#ATTRIBUTE Restaurant Name String
#ATTRIBUTE Restaurant Features NUMERIC
#DATA
0000000 Tanner's {100 253 250 178 174 063 059 036 008 074 204 052 163}
0000001 Frijoleros {250 062 132 174 063 197 071 142 234 243 075 204 052 162}
0000002 Indian Delights {253 250 150 174 083 059 036 117 243 076 205 051 162}
0000003 Great Wall {253 191 192 174 036 039 075 204 052 163}
0000004 The Brickery {100 253 086 231 250 191 192 059 036 215 005 008 075 205 052 163}
0000005 Lawrence's Cafe {250 191 192 174 063 197 071 057 036 140 143 075 204 052 163}
0000006 Harold's Barbecue {253 174 010 221 036 017 076 205 051 162}
0000007 Zab-E-Lee {011 174 235 076 208 051 164}
0000008 The Dessert Place {100 086 150 174 036 042 061 076 204 053 162}
0000009 Cafe Diem {250 196 174 063 197 005 042 061 068 074 204 053 162}
0000010 El Charro {100 253 250 191 192 174 001 142 234 075 204 051 162}
0000011 Kurt's at River Manor {253 231 191 192 174 063 248 036 098 076 205 054 165}
0000012 Peggy Sue's Diner {100 253 086 250 191 192 174 063 036 042 061 074 204 053 163}
0000013 Pars {253 250 174 071 059 057 036 143 075 205 053 164}
0000014 Le Rendez-Vous {253 231 250 200 191 192 174 059 036 091 076 205 053 164}
0000015 Rockbridge Diner {253 231 136 191 192 059 045 076 206 053 164}
0000016 Chefs' Grill {100 080 253 231 102 191 192 174 083 036 024 025 005 076 206 053 165}
0000017 Jonathan Lee's {253 231 245 191 192 174 059 036 039 235 075 205 052 163}
0000018 The Country Place {253 099 231 250 062 132 191 192 174 071 083 024 215 005 076 206 054 165}
0000019 Hama's {253 250 245 174 128 075 205 052 164}
0000020 Raja Indian Restaurant {250 191 192 174 197 036 117 075 205 051 164}
0000021 PRICCI {080 253 250 245 189 102 174 114 024 215 121 076 206 054 166}
0000022 Pittypat's Porch {100 253 099 250 191 192 174 071 221 083 024 220 217 074 204 052 165}
0000023 Houston's {026 253 086 250 174 063 215 005 008 107 076 206 053 164}
0000024 Azio {253 086 231 250 102 063 114 248 215 121 182 075 205 053 164}
0000025 Banks {136 005 045 076 206 054 166}
0000026 ABRUZZI RISTORANTE {253 099 200 245 196 189 191 192 174 146 097 036 024 123 076 206 053 167}
0000027 Rio Bravo Cantina {100 253 086 250 191 192 174 063 215 138 142 234 075 205 053 163}
0000028 Savannah Fish Company {250 191 192 174 040 025 212 075 205 053 165}
0000029 Lombardi's {253 231 250 174 024 121 075 205 053 164}
0000030 Johnny Rockets {026 100 086 250 174 063 008 107 075 205 053 162}
0000031 Opus {099 150 200 196 191 192 174 063 040 071 024 025 005 243 076 206 054 167}
0000032 La Paz {100 253 250 191 192 174 063 197 083 036 215 025 142 234 222 076 205 053 163}
Thank you for your helping.Happy coding:)

If you are using the Weka GUI, I would recommend the following:
Open your data file in Excel (import the data as tab separated values)
Add the headers you want, and fill in missing data. Every row must have all column values filled in for Weka to read the data properly.
Save your file as a .csv
Open the Weka GUI, go to Explorer, then Open file, set the format as csv (see image), and open the csv file you just saved.
After you've loaded your data, you can save it to arff using the Save... button.

Related

AudioCookBook: pesky problem: IsFormatSampleRateAndChannelCountValid(format) error in IOS simulator

Apologies for the 'almost' duplicate question. AudioCookBook sample app crashes in my IOS simulator when I choose Channel/Device routing. The error is 'IsFormatSampleRateAndChannelCountValid(format). Here is the entire log. Please help
Adding more info. Below is the code related to crash and the crash log
Error shows up here:
private func createEngineMixer() {
guard mainMixerNode == nil else { return }
let mixer = Mixer(name: "AudioKit Engine Mixer")
avEngine.attach(mixer.avAudioNode)
avEngine.connect(mixer.avAudioNode, to: avEngine.outputNode, format: Settings.audioFormat) <------ crash is from here
mainMixerNode = mixer
}
---- log ---------
0 18:30:45.519218-0800 Cookbook[2216:8171322] [plugin] AddInstanceForFactory: No factory registered for id <CFUUID 0x6000031e15a0> F8BB1C28-BAE8-11D6-9C31-00039315CD46
2022-02-20 18:30:45.520038-0800 Cookbook[2216:8171322] AudioObjectSetPropertyData: no object with given ID 0
2022-02-20 18:30:45.520222-0800 Cookbook[2216:8171322] AudioSessionSimulatorClientManager.cpp:83 Failed to set processVolumeScalar on device. Error: 560947818
2022-02-20 18:30:45.652544-0800 Cookbook[2216:8171322] [UIFocus] Focus system enabled
2022-02-20 18:30:48.166409-0800 Cookbook[2216:8171322] [general] AVAudioFile+Utilities.swift:toAVAudioPCMBuffer():39:Created buffer with format <AVAudioFormat 0x6000012ee260: 2 ch, 44100 Hz, Float32, non-inter> (AVAudioFile+Utilities.swift:toAVAudioPCMBuffer():39)
2022-02-20 18:30:48.781631-0800 Cookbook[2216:8171322] throwing -10878
2022-02-20 18:30:48.787880-0800 Cookbook[2216:8171527] [ddagg] AggregateDevice.mm:878 couldn't get default output device, ID = 0, err = 0!
2022-02-20 18:30:48.788269-0800 Cookbook[2216:8171527] [ddagg] AggregateDevice.mm:878 couldn't get default input device, ID = 0, err = 0!
2022-02-20 18:30:48.788446-0800 Cookbook[2216:8171527] AudioDeviceStop: no device with given ID
2022-02-20 18:30:48.788680-0800 Cookbook[2216:8171527] [aqme] AQMEIO.cpp:377 error -66680 finding/initializing Default-InputOutput
2022-02-20 18:30:48.788809-0800 Cookbook[2216:8171322] [aurioc] AURemoteIO.cpp:1128 failed: -10851 (enable 2, outf< 2 ch, 0 Hz, Int16, interleaved> inf< 2 ch, 0 Hz, Int16, interleaved>)
2022-02-20 18:30:48.788839-0800 Cookbook[2216:8171519] [aqme] AQMEIO.cpp:377 error -66680 finding/initializing Default-InputOutput
2022-02-20 18:30:48.789037-0800 Cookbook[2216:8171519] CA_UISoundClient.cpp:123 * * * NULL AQIONode object
2022-02-20 18:30:48.789281-0800 Cookbook[2216:8171519] CA_UISoundClient.cpp:880 Can't make UISound Renderer
2022-02-20 18:30:48.809033-0800 Cookbook[2216:8171527] AudioDeviceStop: no device with given ID
2022-02-20 18:30:48.809312-0800 Cookbook[2216:8171527] [aqme] AQMEIO.cpp:377 error -66680 finding/initializing Default-InputOutput
2022-02-20 18:30:48.809461-0800 Cookbook[2216:8171322] [aurioc] AURemoteIO.cpp:1128 failed: -10851 (enable 2, outf< 2 ch, 0 Hz, Int16, interleaved> inf< 2 ch, 0 Hz, Int16, interleaved>)
2022-02-20 18:30:58.880400-0800 Cookbook[2216:8171673] AudioDeviceStop: no device with given ID
2022-02-20 18:30:58.880765-0800 Cookbook[2216:8171673] [aqme] AQMEIO.cpp:377 error -66680 finding/initializing Default-InputOutput
2022-02-20 18:30:58.881015-0800 Cookbook[2216:8171322] [aurioc] AURemoteIO.cpp:1128 failed: -10851 (enable 1, outf< 2 ch, 0 Hz, Int16, interleaved> inf< 2 ch, 0 Hz, Int16, interleaved>)
2022-02-20 18:30:58.882141-0800 Cookbook[2216:8171673] AudioDeviceStop: no device with given ID
2022-02-20 18:30:58.882738-0800 Cookbook[2216:8171673] [aqme] AQMEIO.cpp:377 error -66680 finding/initializing Default-InputOutput
2022-02-20 18:30:58.882903-0800 Cookbook[2216:8171322] [aurioc] AURemoteIO.cpp:1128 failed: -10851 (enable 1, outf< 2 ch, 0 Hz, Int16, interleaved> inf< 2 ch, 0 Hz, Int16, interleaved>)
2022-02-20 18:30:58.883414-0800 Cookbook[2216:8171322] throwing -10878
2022-02-20 18:30:58.934781-0800 Cookbook[2216:8171519] [aqme] AQMEIO.cpp:377 error -66680 finding/initializing Default-InputOutput
2022-02-20 18:30:58.934920-0800 Cookbook[2216:8171519] AudioDeviceStop: no device with given ID
2022-02-20 18:30:58.935184-0800 Cookbook[2216:8171519] [aqme] AQMEIO.cpp:377 error -66680 finding/initializing Default-InputOutput
2022-02-20 18:30:58.935341-0800 Cookbook[2216:8171322] [aurioc] AURemoteIO.cpp:1128 failed: -10851 (enable 3, outf< 2 ch, 0 Hz, Int16, interleaved> inf< 2 ch, 0 Hz, Int16, interleaved>)
2022-02-20 18:30:58.935824-0800 Cookbook[2216:8171322] [avae] AVAEInternal.h:76 required condition is false: [AVAudioEngineGraph.mm:2128:_Connect: (IsFormatSampleRateAndChannelCountValid(format))]
2022-02-20 18:30:59.019001-0800 Cookbook[2216:8171322] *** Terminating app due to uncaught exception 'com.apple.coreaudio.avfaudio', reason: 'required condition is false: IsFormatSampleRateAndChannelCountValid(format)'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff203feba4 __exceptionPreprocess + 242
1 libobjc.A.dylib 0x00007fff201a1be7 objc_exception_throw + 48
2 CoreFoundation 0x00007fff203fe9cd +[NSException raise:format:] + 0
3 AVFAudio 0x00007fff5a59254e _Z19AVAE_RaiseExceptionP8NSStringz + 156
4 AVFAudio 0x00007fff5a5dd543 _ZN18AVAudioEngineGraph8_ConnectEP19AVAudioNodeImplBaseS1_jjP13AVAudioFormat + 323
5 AVFAudio 0x00007fff5a5e4cf8 _ZN18AVAudioEngineGraph7ConnectEP11AVAudioNodeS1_mmP13AVAudioFormat + 586
6 AVFAudio 0x00007fff5a65b37f _ZN17AVAudioEngineImpl7ConnectEP11AVAudioNodeS1_mmP13AVAudioFormat + 1041
7 AVFAudio 0x00007fff5a655ae0 -[AVAudioEngine connect:to:format:] + 114
8 Cookbook 0x000000010b4c28ac $s8AudioKit0A6EngineC06createC5Mixer33_BBA7C59B6014A6A2181272B002E0697ELLyyF + 524
9 Cookbook 0x000000010b4c227a $s8AudioKit0A6EngineC6outputAA4Node_pSgvW + 1770
10 Cookbook 0x000000010b4c2559 $s8AudioKit0A6EngineC6outputAA4Node_pSgvs + 233
11 Cookbook 0x000000010b37277b $s8Cookbook29ChannelDeviceRoutingConductorCACycfc + 1499
12 Cookbook 0x000000010b372191 $s8Cookbook29ChannelDeviceRoutingConductorCACycfC + 33
13 Cookbook 0x000000010b373898 $s8Cookbook24ChannelDeviceRoutingViewV10_conductor33_AF54AAB306277EF7AAE12FA1F3DA8269LL7SwiftUI11StateObjectVyAA0bcD9ConductorCGvpfiAJycfu_AJycfu0_ + 24
14 SwiftUI 0x00007fff5cbc26f2 $s7SwiftUI11StateObjectV3Box33_26399901AD247149EF526863F9AAF7C4LLV6update8property5phaseSbACyxGz_AA12_GraphInputsV5PhaseVtF + 74
15 SwiftUI 0x00007fff5d177bb5 $s7SwiftUI9BoxVTable33_68550FF604D39F05971FE35A26EE75B0LLC6update3ptr8property5phaseSbSv_SvAA12_GraphInputsV5PhaseVtFZ + 207
16 SwiftUI 0x00007fff5d176fe4 $s7SwiftUI22_DynamicPropertyBufferV6update9container5phaseSbSv_AA12_GraphInputsV5PhaseVtF + 72
17 SwiftUI 0x00007fff5ce5da31 $s7SwiftUI11DynamicBody33_49D2A32E637CD497C6DE29B8E060A506LLV11updateValueyyF + 296
18 SwiftUI 0x00007fff5d04f428 $s14AttributeGraph0A0VyACyxGqd__c5ValueQyd__RszAA12StatefulRuleRd__lufcADSPyqd__GXEfU_ySv_So11AGAttributeatcyXEfU_ySv_AJtcqd__mcfu_ySv_AJtcfu0_TA + 26
19 AttributeGraph 0x00007fff4ff9b37b _ZN2AG5Graph11UpdateStack6updateEv + 553
20 AttributeGraph 0x00007fff4ff9b971 _ZN2AG5Graph16update_attributeENS_4data3ptrINS_4NodeEEEj + 411
21 AttributeGraph 0x00007fff4ffa1d18 _ZN2AG5Graph20input_value_ref_slowENS_4data3ptrINS_4NodeEEENS_11AttributeIDEjPK15AGSwiftMetadataRhl + 554
22 AttributeGraph 0x00007fff4ffb8729 AGGraphGetValue + 210
23 SwiftUI 0x00007fff5ce5d5b1 $s7SwiftUI10StaticBody33_49D2A32E637CD497C6DE29B8E060A506LLV9container9ContainerQzvg + 67
24 SwiftUI 0x00007fff5ce5d675 $s7SwiftUI10StaticBody33_49D2A32E637CD497C6DE29B8E060A506LLV11updateValueyyF + 142
25 SwiftUI 0x00007fff5d04f428 $s14AttributeGraph0A0VyACyxGqd__c5ValueQyd__RszAA12StatefulRuleRd__lufcADSPyqd__GXEfU_ySv_So11AGAttributeatcyXEfU_ySv_AJtcqd__mcfu_ySv_AJtcfu0_TA + 26
26 AttributeGraph 0x00007fff4ff9b37b _ZN2AG5Graph11UpdateStack6updateEv + 553
27 AttributeGraph 0x00007fff4ff9b971 _ZN2AG5Graph16update_attributeENS_4data3ptrINS_4NodeEEEj + 411
28 AttributeGraph 0x00007fff4ffa1d18 _ZN2AG5Graph20input_value_ref_slowENS_4data3ptrINS_4NodeEEENS_11AttributeIDEjPK15AGSwiftMetadataRhl + 554
29 AttributeGraph 0x00007fff4ffb8729 AGGraphGetValue + 210
30 SwiftUI 0x00007fff5c761be4 $s7SwiftUI26MakeResolvedRepresentation33_AC03956538119E2820390436C305EBF1LLV5value4BodyQzvgAA0D11ButtonStyleV_Tg5 + 30
31 SwiftUI 0x00007fff5c7eab41 $s14AttributeGraph0A0VyACyxGqd__c5ValueQyd__RszAA4RuleRd__lufcADSPyqd__GXEfU_ySv_So11AGAttributeatcyXEfU_ySv_AJtcqd__mcfu_ySv_AJtcfu0_7SwiftUI19ResolvedButtonStyleV4bodyQrvpQOy_Qo__AK04MakeH14Representation33_AC03956538119E2820390436C305EBF1LLVyAMGTg5 + 37
32 AttributeGraph 0x00007fff4ff9b37b _ZN2AG5Graph11UpdateStack6updateEv + 553
33 AttributeGraph 0x00007fff4ff9b971 _ZN2AG5Graph16update_attributeENS_4data3ptrINS_4NodeEEEj + 411
34 AttributeGraph 0x00007fff4ffa1d18 _ZN2AG5Graph20input_value_ref_slowENS_4data3ptrINS_4NodeEEENS_11AttributeIDEjPK15AGSwiftMetadataRhl + 554
35 AttributeGraph 0x00007fff4ffb8729 AGGraphGetValue + 210
36 SwiftUI 0x00007fff5c79b315 $s7SwiftUI10StaticBody33_49D2A32E637CD497C6DE29B8E060A506LLV11updateValueyyFAA04ViewD8AccessorVyAA6ButtonVyAA09PrimitiveR18StyleConfigurationV5LabelVGG_AA15MainThreadFlagsACLLVTg5 + 64
37 SwiftUI 0x00007fff5c814510 $s14AttributeGraph0A0VyACyxGqd__c5ValueQyd__RszAA12StatefulRuleRd__lufcADSPyqd__GXEfU_ySv_So11AGAttributeatcyXEfU_ySv_AJtcqd__mcfu_ySv_AJtcfu0_7SwiftUI6ButtonV4bodyQrvpQOyAK09PrimitiveI18StyleConfigurationV5LabelV_Qo__AK10StaticBody33_49D2A32E637CD497C6DE29B8E060A506LLVyAK04ViewP8AccessorVyAMyARGGAK15MainThreadFlagsAULLVGTg5TA + 15
38 AttributeGraph 0x00007fff4ff9b37b _ZN2AG5Graph11UpdateStack6updateEv + 553
39 AttributeGraph 0x00007fff4ff9b971 _ZN2AG5Graph16update_attributeENS_4data3ptrINS_4NodeEEEj + 411
40 AttributeGraph 0x00007fff4ffa1d18 _ZN2AG5Graph20input_value_ref_slowENS_4data3ptrINS_4NodeEEENS_11AttributeIDEjPK15AGSwiftMetadataRhl + 554
41 AttributeGraph 0x00007fff4ffb8729 AGGraphGetValue + 210
42 SwiftUI 0x00007fff5c7eaacb $s14AttributeGraph0A0VyACyxGqd__c5ValueQyd__RszAA4RuleRd__lufcADSPyqd__GXEfU_ySv_So11AGAttributeatcyXEfU_ySv_AJtcqd__mcfu_ySv_AJtcfu0_7SwiftUI15ModifiedContentVyAK19ResolvedButtonStyleVAK0kL8ModifierVyAK07DefaultkL0VGG_AK04MakeN14Representation33_AC03956538119E2820390436C305EBF1LLVyAOGTg5 + 29
43 AttributeGraph 0x00007fff4ff9b37b _ZN2AG5Graph11UpdateStack6updateEv + 553
44 AttributeGraph 0x00007fff4ff9b971 _ZN2AG5Graph16update_attributeENS_4data3ptrINS_4NodeEEEj + 411
45 AttributeGraph 0x00007fff4ffa1d18 _ZN2AG5Graph20input_value_ref_slowENS_4data3ptrINS_4NodeEEENS_11AttributeIDEjPK15AGSwiftMetadataRhl + 554
46 AttributeGraph 0x00007fff4ffb8729 AGGraphGetValue + 210
47 SwiftUI 0x00007fff5ce5d5b1 $s7SwiftUI10StaticBody33_49D2A32E637CD497C6DE29B8E060A506LLV9container9ContainerQzvg + 67
48 SwiftUI 0x00007fff5ce5d675 $s7SwiftUI10StaticBody33_49D2A32E637CD497C6DE29B8E060A506LLV11updateValueyyF + 142
49 SwiftUI 0x00007fff5d04f428 $s14AttributeGraph0A0VyACyxGqd__c5ValueQyd__RszAA12StatefulRuleRd__lufcADSPyqd__GXEfU_ySv_So11AGAttributeatcyXEfU_ySv_AJtcqd__mcfu_ySv_AJtcfu0_TA + 26
50 AttributeGraph 0x00007fff4ff9b37b _ZN2AG5Graph11UpdateStack6updateEv + 553
51 AttributeGraph 0x00007fff4ff9b971 _ZN2AG5Graph16update_attributeENS_4data3ptrINS_4NodeEEEj + 411
52 AttributeGraph 0x00007fff4ffa1d18 _ZN2AG5Graph20input_value_ref_slowENS_4data3ptrINS_4NodeEEENS_11AttributeIDEjPK15AGSwiftMetadataRhl + 554
53 AttributeGraph 0x00007fff4ffb8729 AGGraphGetValue + 210
54 SwiftUI 0x00007fff5ce5d9eb $s7SwiftUI11DynamicBody33_49D2A32E637CD497C6DE29B8E060A506LLV11updateValueyyF + 226
55 SwiftUI 0x00007fff5d04f428 $s14AttributeGraph0A0VyACyxGqd__c5ValueQyd__RszAA12StatefulRuleRd__lufcADSPyqd__GXEfU_ySv_So11AGAttributeatcyXEfU_ySv_AJtcqd__mcfu_ySv_AJtcfu0_TA + 26
56 AttributeGraph 0x00007fff4ff9b37b _ZN2AG5Graph11UpdateStack6updateEv + 553
57 AttributeGraph 0x00007fff4ff9b971 _ZN2AG5Graph16update_attributeENS_4data3ptrINS_4NodeEEEj + 411
58 AttributeGraph 0x00007fff4ffa1d18 _ZN2AG5Graph20input_value_ref_slowENS_4data3ptrINS_4NodeEEENS_11AttributeIDEjPK15AGSwiftMetadataRhl + 554
59 AttributeGraph 0x00007fff4ffb8729 AGGraphGetValue + 210
60 SwiftUI 0x00007fff5ce5d9eb $s7SwiftUI11DynamicBody33_49D2A32E637CD497C6DE29B8E060A506LLV11updateValueyyF + 226
61 SwiftUI 0x00007fff5d04f428 $s14AttributeGraph0A0VyACyxGqd__c5ValueQyd__RszAA12StatefulRuleRd__lufcADSPyqd__GXEfU_ySv_So11AGAttributeatcyXEfU_ySv_AJtcqd__mcfu_ySv_AJtcfu0_TA + 26
62 AttributeGraph 0x00007fff4ff9b37b _ZN2AG5Graph11UpdateStack6updateEv + 553
63 AttributeGraph 0x00007fff4ff9b971 _ZN2AG5Graph16update_attributeENS_4data3ptrINS_4NodeEEEj + 411
64 AttributeGraph 0x00007fff4ffa1d18 _ZN2AG5Graph20input_value_ref_slowENS_4data3ptrINS_4NodeEEENS_11AttributeIDEjPK15AGSwiftMetadataRhl + 554
82 AttributeGraph 0x00007fff4ff9b37b _ZN2AG5Graph11UpdateStack6updateEv + 553
83 AttributeGraph 0x00007fff4ff9b971 _ZN2AG5Graph16update_attributeENS_4data3ptrINS_4NodeEEEj + 411
84 AttributeGraph 0x00007fff4ffa1d18 _ZN2AG5Graph20input_value_ref_slowENS_4data3ptrINS_4NodeEEENS_11AttributeIDEjPK15AGSwiftMetadataRhl + 554
85 AttributeGraph 0x00007fff4ffb8729 AGGraphGetValue + 210
86 SwiftUI 0x00007fff5d0bc11a $s7SwiftUI15_ViewList_GroupV4InitV5valueAA0cD0_pvg + 183
87 SwiftUI 0x00007fff5c7e717a $s14AttributeGraph0A0VyACyxGqd__c5ValueQyd__RszAA4RuleRd__lufcADSPyqd__GXEfU_ySv_So11AGAttributeatcyXEfU_ySv_AJtcqd__mcfu_ySv_AJtcfu0_7SwiftUI8ViewList_p_AK01_hI6_GroupV4InitVTg5 + 37
88 AttributeGraph 0x00007fff4ff9b37b _ZN2AG5Graph11UpdateStack6updateEv + 553
89 AttributeGraph 0x00007fff4ff9b971 _ZN2AG5Graph16update_attributeENS_4data3ptrINS_4NodeEEEj + 411
90 AttributeGraph 0x00007fff4ffa1d18 _ZN2AG5Graph20input_value_ref_slowENS_4data3ptrINS_4NodeEEENS_11AttributeIDEjPK15AGSwiftMetadataRhl + 554
91 AttributeGraph 0x00007fff4ffb8729 AGGraphGetValue + 210
92 SwiftUI 0x00007fff5cb91711 $s7SwiftUI24DynamicLayoutViewAdaptor33_8B9C7F39264416187A895085215951BCLLV12updatedItemsAA0E4List_pSgyF + 59
93 SwiftUI 0x00007fff5c6f4d91 $s7SwiftUI20DynamicContainerInfoV11updateItems33_023AA827B8A8D39774F7A0C281455FEELL18disableTransitionsSb7changed_Sb8hasDepthtSb_tFAA0C17LayoutViewAdaptor33_8B9C7F39264416187A895085215951BCLLV_Tg5 + 53
94 SwiftUI 0x00007fff5c6f3453 $s7SwiftUI20DynamicContainerInfoV11updateValueyyFAA0C17LayoutViewAdaptor33_8B9C7F39264416187A895085215951BCLLV_Tg5 + 460
95 SwiftUI 0x00007fff5c80a7a5 $s14AttributeGraph0A0VyACyxGqd__c5ValueQyd__RszAA12StatefulRuleRd__lufcADSPyqd__GXEfU_ySv_So11AGAttributeatcyXEfU_ySv_AJtcqd__mcfu_ySv_AJtcfu0_7SwiftUI16DynamicContainerV4InfoV_AK0ijK0VyAK0I17LayoutViewAdaptor33_8B9C7F39264416187A895085215951BCLLVGTg5TA + 15
96 AttributeGraph 0x00007fff4ff9b37b _ZN2AG5Graph11UpdateStack6updateEv + 553
97 AttributeGraph 0x00007fff4ff9b971 _ZN2AG5Graph16update_attributeENS_4data3ptrINS_4NodeEEEj + 411
98 AttributeGraph 0x00007fff4ffa1d18 _ZN2AG5Graph20input_value_ref_slowENS_4data3ptrINS_4NodeEEENS_11AttributeIDEjPK15AGSwiftMetadataRhl + 554
99 AttributeGraph 0x00007fff4ffb8729 AGGraphGetValue + 210
100 SwiftUI 0x00007fff5c961b29 $s7SwiftUI25DynamicPreferenceCombiner33_023AA827B8A8D39774F7A0C281455FEELLV4infoAA0C9ContainerV4InfoVSgvg + 62
101 SwiftUI 0x00007fff5c961cae $s7SwiftUI25DynamicPreferenceCombiner33_023AA827B8A8D39774F7A0C281455FEELLV5value5ValueQzvg + 128
102 SwiftUI 0x00007fff5c962105 $s7SwiftUI25DynamicPreferenceCombiner33_023AA827B8A8D39774F7A0C281455FEELLVyxG14AttributeGraph4RuleAafGP5value5ValueQzvgTW + 23
103 AttributeGraph 0x00007fff4ffbbbe7 $s14AttributeGraph4RuleP5value5ValueQzvgTj + 7
104 SwiftUI 0x00007fff5c885800 $s14AttributeGraph0A0VyACyxGqd__c5ValueQyd__RszAA4RuleRd__lufcADSPyqd__GXEfU_ySv_So11AGAttributeatcyXEfU_ySv_AJtcqd__mcfu_ySv_AJtcfu0_ + 109
105 AttributeGraph 0x00007fff4ff9b37b _ZN2AG5Graph11UpdateStack6updateEv + 553
106 AttributeGraph 0x00007fff4ff9b971 _ZN2AG5Graph16update_attributeENS_4data3ptrINS_4NodeEEEj + 411
107 AttributeGraph 0x00007fff4ffa1d18 _ZN2AG5Graph20input_value_ref_slowENS_4data3ptrINS_4NodeEEENS_11AttributeIDEjPK15AGSwiftMetadataRhl + 554
108 AttributeGraph 0x00007fff4ffb8729 AGGraphGetValue + 210
109 SwiftUI 0x00007fff5cdb0e7b $s7SwiftUI24HostPreferencesTransform33_5EC2B8E51282B711F818D51701767C64LLV11updateValueyyF + 83
110 SwiftUI 0x00007fff5d04f428 $s14AttributeGraph0A0VyACyxGqd__c5ValueQyd__RszAA12StatefulRuleRd__lufcADSPyqd__GXEfU_ySv_So11AGAttributeatcyXEfU_ySv_AJtcqd__mcfu_ySv_AJtcfu0_TA + 26
111 AttributeGraph 0x00007fff4ff9b37b _ZN2AG5Graph11UpdateStack6updateEv + 553
112 AttributeGraph 0x00007fff4ff9b971 _ZN2AG5Graph16update_attributeENS_4data3ptrINS_4NodeEEEj + 411
113 AttributeGraph 0x00007fff4ffa1d18 _ZN2AG5Graph20input_value_ref_slowENS_4data3ptrINS_4NodeEEENS_11AttributeIDEjPK15AGSwiftMetadataRhl + 554
114 AttributeGraph 0x00007fff4ffb8729 AGGraphGetValue + 210
115 SwiftUI 0x00007fff5cdb0e7b $s7SwiftUI24HostPreferencesTransform33_5EC2B8E51282B711F818D51701767C64LLV11updateValueyyF + 83
116 SwiftUI 0x00007fff5d04f428 $s14AttributeGraph0A0VyACyxGqd__c5ValueQyd__RszAA12StatefulRuleRd__lufcADSPyqd__GXEfU_ySv_So11AGAttributeatcyXEfU_ySv_AJtcqd__mcfu_ySv_AJtcfu0_TA + 26
117 AttributeGraph 0x00007fff4ff9b37b _ZN2AG5Graph11UpdateStack6updateEv + 553
118 AttributeGraph 0x00007fff4ff9b971 _ZN2AG5Graph16update_attributeENS_4data3ptrINS_4NodeEEEj + 411
119 AttributeGraph 0x00007fff4ffa1d18 _ZN2AG5Graph20input_value_ref_slowENS_4data3ptrINS_4NodeEEENS_11AttributeIDEjPK15AGSwiftMetadataRhl + 554
120 AttributeGraph 0x00007fff4ffb8729 AGGraphGetValue + 210
121 SwiftUI 0x00007fff5cdb0e7b $s7SwiftUI24HostPreferencesTransform33_5EC2B8E51282B711F818D51701767C64LLV11updateValueyyF + 83
122 SwiftUI 0x00007fff5d04f428 $s14AttributeGraph0A0VyACyxGqd__c5ValueQyd__RszAA12StatefulRuleRd__lufcADSPyqd__GXEfU_ySv_So11AGAttributeatcyXEfU_ySv_AJtcqd__mcfu_ySv_AJtcfu0_TA + 26
123 AttributeGraph 0x00007fff4ff9b37b _ZN2AG5Graph11UpdateStack6updateEv + 553
124 AttributeGraph 0x00007fff4ff9b971 _ZN2AG5Graph16update_attributeENS_4data3ptrINS_4NodeEEEj + 411
125 AttributeGraph 0x00007fff4ffa1d18 _ZN2AG5Graph20input_value_ref_slowENS_4data3ptrINS_4NodeEEENS_11AttributeIDEjPK15AGSwiftMetadataRhl + 554
126 AttributeGraph 0x00007fff4ffb8729 AGGraphGetValue + 210
127 SwiftUI 0x00007fff5c961f49 $s7SwiftUI25DynamicPreferenceCombiner33_023AA827B8A8D39774F7A0C281455FEELLV5value5ValueQzvg + 795
128 SwiftUI 0x00007fff5c962105 $s7SwiftUI25DynamicPreferenceCombiner33_023AA827B8A8D39774F7A0C281455FEELLVyxG14AttributeGraph4RuleAafGP5value5ValueQzvgTW + 23
129 AttributeGraph 0x00007fff4ffbbbe7 $s14AttributeGraph4RuleP5value5ValueQzvgTj + 7
130 SwiftUI 0x00007fff5c885800 $s14AttributeGraph0A0VyACyxGqd__c5ValueQyd__RszAA4RuleRd__lufcADSPyqd__GXEfU_ySv_So11AGAttributeatcyXEfU_ySv_AJtcqd__mcfu_ySv_AJtcfu0_ + 109
131 AttributeGraph 0x00007fff4ff9b37b _ZN2AG5Graph11UpdateStack6updateEv + 553
132 AttributeGraph 0x00007fff4ff9b971 _ZN2AG5Graph16update_attributeENS_4data3ptrINS_4NodeEEEj + 411
133 AttributeGraph 0x00007fff4ffa1656 _ZN2AG5Graph9value_refENS_11AttributeIDEPK15AGSwiftMetadataRh + 128
134 AttributeGraph 0x00007fff4ffb877a AGGraphGetValue + 291
135 SwiftUI 0x00007fff5d16cd4e $s7SwiftUI9GraphHostC17updatePreferencesSbyF + 39
136 SwiftUI 0x00007fff5cac8448 $s7SwiftUI9ViewGraphC13updateOutputs33_D63C4EB7F2B205694B6515509E76E98BLLyyF + 293
137 SwiftUI 0x00007fff5c7c72cb $s7SwiftUI16ViewRendererHostPAAE6render8interval17updateDisplayListySd_SbtFyyXEfU_AA010_UIHostingC0CyAA15ModifiedContentVyAA01_cj1_C0VAA0J17TableCellModifierVGG_Tg5Tm + 2021
138 SwiftUI 0x00007fff5c6b9499 $s7SwiftUI16ViewRendererHostPAAE6render8interval17updateDisplayListySd_SbtFAA010_UIHostingC0CyAA15ModifiedContentVyAA03AnyC0VAA24NavigationColumnModifierVGG_Tg5 + 491
139 SwiftUI 0x00007fff5cc04546 $s7SwiftUI24NavigationBridge_PhoneTVC4push_4onto8animatedyAA0C18DestinationContentV_AA10PushTargetVSbtF011withUpdatedC3BarL_7performyyyc_tAA4ViewRzlFyycfU_ + 625
140 SwiftUI 0x00007fff5cc05c15 $s7SwiftUI24NavigationBridge_PhoneTVC4push_4onto8animatedyAA0C18DestinationContentV_AA10PushTargetVSbtF011withUpdatedC3BarL_7performyyyc_tAA4ViewRzlFyycfU_TA + 66
141 SwiftUI 0x00007fff5cb3575b $sIeg_ytIegr_TR + 12
142 SwiftUI 0x00007fff5cc0599c $sIeg_ytIegr_TRTA + 17
143 SwiftUI 0x00007fff5cc05f5a $sIeg_ytIegr_TRTA.34 + 9
144 SwiftUI 0x00007fff5d07620b $s7SwiftUI16ViewRendererHostPAAE6render8interval17updateDisplayListySd_SbtFyyXEfU_ + 2368
145 SwiftUI 0x00007fff5d06d9d8 $s7SwiftUI16ViewRendererHostPAAE6render8interval17updateDisplayListySd_SbtF + 345
146 SwiftUI 0x00007fff5d2cad1b $s7SwiftUI14_UIHostingViewC14layoutSubviewsyyF + 296
147 SwiftUI 0x00007fff5d2cad61 $s7SwiftUI14_UIHostingViewC14layoutSubviewsyyFTo + 21
148 UIKitCore 0x00007fff2561d2b1 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 2962
149 QuartzCore 0x00007fff289e2d2e _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 548
150 QuartzCore 0x00007fff289edebf _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 65
151 QuartzCore 0x00007fff28929c86 _ZN2CA7Context18commit_transactionEPNS_11TransactionEdPd + 700
152 QuartzCore 0x00007fff28961853 _ZN2CA11Transaction6commitEv + 699
153 UIKitCore 0x00007fff2508c831 _afterCACommitHandler + 105
154 CoreFoundation 0x00007fff2036bc67 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
155 CoreFoundation 0x00007fff2036648c __CFRunLoopDoObservers + 541
156 CoreFoundation 0x00007fff20366a3c __CFRunLoopRun + 1126
157 CoreFoundation 0x00007fff203660f3 CFRunLoopRunSpecific + 567
158 GraphicsServices 0x00007fff2c995cd3 GSEventRunModal + 139
159 UIKitCore 0x00007fff25059f42 -[UIApplication _run] + 928
160 UIKitCore 0x00007fff2505eb5e UIApplicationMain + 101
161 Cookbook 0x000000010b239b7f main + 63
162 dyld 0x000000010ca96ee9 start_sim + 10
163 ??? 0x00000001166c84fe 0x0 + 4671177982
)
libc++abi: terminating with uncaught exception of type NSException
dyld4 config: DYLD_ROOT_PATH=/Users/vittalk/Documents/Vittal/Xcode/XCode_Versions/13.2/Xcode_13_2.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot DYLD_LIBRARY_PATH=/Users/vittalk/Library/Developer/Xcode/DerivedData/Cookbook-dsisqbaepepfucghbmspweyxdwqi/Build/Products/Debug-iphonesimulator:/Users/vittalk/Documents/Vittal/Xcode/XCode_Versions/13.2/Xcode_13_2.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/introspection DYLD_INSERT_LIBRARIES=/Users/vittalk/Documents/Vittal/Xcode/XCode_Versions/13.2/Xcode_13_2.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libBacktraceRecording.dylib:/Users/vittalk/Documents/Vittal/Xcode/XCode_Versions/13.2/Xcode_13_2.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib:/Users/vittalk/Documents/Vittal/Xcode/XCode_Versions/13.2/Xcode_13_2.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libMTLCapture.dylib DYLD_FRAMEWORK_PATH=/Users/vittalk/Library/Developer/Xcode/DerivedData/Cookbook-dsisqbaepepfucghbmspweyxdwqi/Build/Products/Debug-iphonesimulator:/Users/vittalk/Library/Developer/Xcode/DerivedData/Cookbook-dsisqbaepepfucghbmspweyxdwqi/Build/Products/Debug-iphonesimulator/PackageFrameworks
*** Terminating app due to uncaught exception 'com.apple.coreaudio.avfaudio', reason: 'required condition is false: IsFormatSampleRateAndChannelCountValid(format)'
terminating with uncaught exception of type NSException
CoreSimulator 783.5 - Device: iPad Pro (9.7-inch) (473C9914-33AC-43B0-BA02-F18081906489) - Runtime: iOS 15.2 (19C51) - DeviceType: iPad Pro (9.7-inch)

How to overcome with this error when using Networkx's kernighan_lin_bisection

I want to use kernighan_lin_bisection from Networkx to separate a network data.
But the error below showed up and I'm stuck.
It would be highly appreciated if you could help me overcome this error.
QT-------------------------------------------------------------------------
IndexError Traceback (most recent call last)
in ()
17 for c in init_partition:
18 for n in c:
---> 19 color_map_i[n]=colors[counter]
20 counter=counter+1
21
IndexError: list assignment index out of range
UNQT---------------------------------------------------------------------------
The coding I used and data source"200224_04_act.prn" are below.
QT---------------------------------------------------
G=nx.read_edgelist("200224_04_act.prn",nodetype=int)
colors=["red","blue","green"]
pos=nx.spring_layout(G)
init_nodes=np.array_split(G.nodes(),2)
init_partition=[set(init_nodes[0]),set(init_nodes[1])]
print(init_partition)
from networkx.algorithms.community import kernighan_lin_bisection
color_map_i=["black"]*nx.number_of_nodes(G)
print(color_map_i)
counter=0
for c in init_partition:
for n in c:
color_map_i[n]=colors[counter]
counter=counter+1
print(color_map_i)
nx.draw_networkx_edges(G,pos)
nx.draw_networkx_nodes(G,pos,node_color=color_map_i)
nx.draw_networkx_labels(G,pos)
plt.axis("off")
plt.show()
lst_b=kernighan_lin_bisection(G,partition=init_partition)
color_map_b=["black"]*nx.number_of_nodes(G)
counter=0
for c in lst_b:
for n in c:
color_map_b[n]=colors[counter]
counter=counter+1
nx.draw_networkx_edges(G,pos)
nx.draw_networkx_nodes(G,pos,node_color=color_map_b)
nx.draw_networkx_labels(G,pos)
plt.axis("off")
plt.show()
UNQT--------------------------------------------------------------
"200224_04_act.prn" below.(Number of nodes is around 2000 but I made it
small due to the limit of number of character)
1 415
2 415
3 415
3 1350
4 1351
5 1352
6 383
7 993
8 1353
9 887
10 887
11 887
12 887
13 887
14 1185
15 1185
16 1185
17 1185
18 1185
19 1146
20 1146
21 1146
22 1146
21 776
23 776
24 707
25 707
26 707
27 707
28 707
29 754
21 754
30 754
31 754
32 754
33 778
34 778
35 778
36 778
37 778
38 859
39 859
40 1354
41 563
42 563
43 563
44 563
45 563
46 1209
47 1209
48 1209
49 1209
50 1209
51 715
52 715
53 715
54 715
55 715
56 1048
57 1048
58 1047
59 1047
60 1047
61 1047
62 1047
63 718
64 718
65 718
66 718
67 718
68 947
17 947
69 947
70 889
71 744
72 744
73 744
74 744
75 744
76 1137
77 1137
78 1137
79 1137
80 612
81 612
82 612
83 612
17 612
84 790
85 790
86 790
87 790
88 790
89 922
90 922
91 922
92 922
93 922
21 738
94 738
95 738
96 738
97 738
98 1355
81 807
99 807
17 807
100 725
101 725
17 725
102 725
103 725
23 1046
104 661
105 661
106 661
107 661
108 661
109 907
110 907
111 907
112 907
113 907
114 840
115 840
116 840
117 840
17 840
118 759
23 759
119 759
23 761
120 761
121 761
122 761
123 1356
124 1265
125 1265
126 1265
127 1265
128 1265
129 894
29 894
130 894
131 894
132 667
133 667
124 758
134 758
135 758
122 758
136 758
137 471
138 471
You've got
for c in init_partition:
for n in c:
color_map_i[n]=colors[counter]
counter=counter+1
It looks to me like n will loop over all of the nodes of the graph. I do not see any entries in the graph that are 0. So probably the nodes are numbered 1 to N, while color_map_i is indexed from 0 to N-1. So it would break when n=N.
A good way to hunt for bugs like this in general would be to print n right before the line giving the error. This would give a hint to what the problem is.

Postgres performance issue in my Rails app

I'm using derailed_benchmark gem to track my app performance:
$ PATH_TO_HIT="/api/v2/feed.json?per_page=30&page=1&category_name=Feed" USER_SERVER=webrick TEST_COUNT=20 bundle exec derailed exec perf:stackprof
==================================
Mode: cpu(1000)
Samples: 20708 (0.42% miss rate)
GC: 3219 (15.54%)
==================================
TOTAL (pct) SAMPLES (pct) FRAME
4720 (22.8%) 4694 (22.7%) block in ActiveRecord::ConnectionAdapters::PostgreSQLAdapter#exec_cache
542 (2.6%) 502 (2.4%) ActiveSupport::Inflector#underscore
413 (2.0%) 413 (2.0%) ActiveSupport::PerThreadRegistry#instance
364 (1.8%) 364 (1.8%) ActiveRecord::QueryMethods#validate_order_args
309 (1.5%) 309 (1.5%) block in ActiveSupport::Inflector#apply_inflections
282 (1.4%) 282 (1.4%) ThreadSafe::NonConcurrentCacheBackend#[]
257 (1.2%) 257 (1.2%) ActiveRecord::Relation#initialize
410 (2.0%) 235 (1.1%) ActiveRecord::Relation#initialize_copy
229 (1.1%) 229 (1.1%) ActiveRecord::Delegation::DelegateCache#relation_delegate_class
212 (1.0%) 212 (1.0%) block in ActiveRecord::Relation::Merger#merge
562 (2.7%) 198 (1.0%) ActiveRecord::QueryMethods#preprocess_order_args
190 (0.9%) 189 (0.9%) ActiveRecord::Core::ClassMethods#arel_table
181 (0.9%) 181 (0.9%) JSON#parse
175 (0.8%) 175 (0.8%) ActiveRecord::Relation#reset
165 (0.8%) 165 (0.8%) ActiveRecord::Attribute#initialize
153 (0.7%) 153 (0.7%) ActiveRecord::Relation#values
151 (0.7%) 151 (0.7%) ActiveRecord::Inheritance::ClassMethods#base_class
333 (1.6%) 151 (0.7%) ActiveRecord::Scoping::Default::ClassMethods#build_default_scope
144 (0.7%) 144 (0.7%) Skylight::Normalizers::ActiveRecord::SQL#extract_rust
142 (0.7%) 142 (0.7%) ActiveRecord::QueryMethods#joins_values
138 (0.7%) 138 (0.7%) block (4 levels) in Class#class_attribute
195 (0.9%) 133 (0.6%) ActiveRecord::DynamicMatchers#respond_to?
158 (0.8%) 121 (0.6%) ActiveRecord::QueryMethods#where_values=
125 (0.6%) 115 (0.6%) ActiveRecord::Reflection::AssociationReflection#klass
113 (0.5%) 113 (0.5%) ActiveRecord::Result#initialize_copy
110 (0.5%) 110 (0.5%) Arel::Table#initialize
193 (0.9%) 109 (0.5%) ActiveRecord::ConnectionAdapters::PostgreSQL::Utils#extract_schema_qualified_name
114 (0.6%) 106 (0.5%) Arel::Nodes::Binary#hash
104 (0.5%) 104 (0.5%) ActiveRecord::QueryMethods#extending_values
99 (0.5%) 99 (0.5%) ActiveRecord::QueryMethods#order_values
How can I fix the "block in ActiveRecord::ConnectionAdapters::PostgreSQLAdapter#exec_cache" performance issue?
UPDATE
After running same command with "config.middleware.delete "ActiveRecord::QueryCache" in my config/application.rb
the results are:
==================================
Mode: cpu(1000)
Samples: 21116 (0.42% miss rate)
GC: 2213 (10.48%)
==================================
TOTAL (pct) SAMPLES (pct) FRAME
5619 (26.6%) 5600 (26.5%) block in ActiveRecord::ConnectionAdapters::PostgreSQLAdapter#exec_cache
2268 (10.7%) 2268 (10.7%) block in ActiveRecord::ConnectionAdapters::PostgreSQLAdapter#exec_no_cache
421 (2.0%) 383 (1.8%) ActiveSupport::Inflector#underscore
304 (1.4%) 304 (1.4%) ActiveSupport::PerThreadRegistry#instance
294 (1.4%) 294 (1.4%) block in ActiveSupport::Inflector#apply_inflections
270 (1.3%) 270 (1.3%) ThreadSafe::NonConcurrentCacheBackend#[]
245 (1.2%) 245 (1.2%) ActiveRecord::Relation#initialize
229 (1.1%) 229 (1.1%) ActiveRecord::QueryMethods#validate_order_args
219 (1.0%) 219 (1.0%) ActiveRecord::Delegation::DelegateCache#relation_delegate_class
207 (1.0%) 207 (1.0%) ActiveRecord::Inheritance::ClassMethods#base_class
285 (1.3%) 188 (0.9%) ActiveRecord::Relation#initialize_copy
184 (0.9%) 184 (0.9%) ActiveRecord::Attribute#initialize
181 (0.9%) 179 (0.8%) ActiveRecord::Core::ClassMethods#arel_table
175 (0.8%) 175 (0.8%) Skylight::Normalizers::ActiveRecord::SQL#extract_rust
165 (0.8%) 165 (0.8%) block in ActiveRecord::Relation::Merger#merge
147 (0.7%) 147 (0.7%) block (4 levels) in Class#class_attribute
374 (1.8%) 145 (0.7%) ActiveRecord::QueryMethods#preprocess_order_args
113 (0.5%) 113 (0.5%) ActiveRecord::Relation#values
112 (0.5%) 112 (0.5%) ActiveRecord::QueryMethods#joins_values
171 (0.8%) 109 (0.5%) ActiveRecord::ConnectionAdapters::PostgreSQL::Utils#extract_schema_qualified_name
99 (0.5%) 99 (0.5%) Arel::Table#initialize
97 (0.5%) 97 (0.5%) ActiveRecord::Relation#reset
271 (1.3%) 96 (0.5%) ActiveRecord::Scoping::Default::ClassMethods#build_default_scope
107 (0.5%) 95 (0.4%) ActiveRecord::Reflection::AssociationReflection#klass
93 (0.4%) 93 (0.4%) ActiveRecord::QueryMethods#order_values
125 (0.6%) 93 (0.4%) ActiveRecord::QueryMethods#where_values=
88 (0.4%) 88 (0.4%) ActiveRecord::Reflection::ThroughReflection#active_record
106 (0.5%) 87 (0.4%) Skylight::Trace#start
81 (0.4%) 81 (0.4%) ActiveRecord::QueryMethods#check_cached_relation
80 (0.4%) 80 (0.4%) ActiveRecord::QueryMethods#where_values
UDPATE 2
After running the query with "wall time" mode and not "cpu time" mode, this is the results:
==================================
Mode: wall(1000)
Samples: 41424 (1.92% miss rate)
GC: 3648 (8.81%)
==================================
TOTAL (pct) SAMPLES (pct) FRAME
4780 (11.5%) 4718 (11.4%) block in ActiveRecord::ConnectionAdapters::PostgreSQLAdapter#exec_cache
2783 (6.7%) 2783 (6.7%) block in ActiveRecord::ConnectionAdapters::PostgreSQLAdapter#exec_no_cache
1088 (2.6%) 1088 (2.6%) ActiveSupport::PerThreadRegistry#instance
934 (2.3%) 934 (2.3%) ThreadSafe::NonConcurrentCacheBackend#[]
1031 (2.5%) 926 (2.2%) ActiveSupport::Inflector#underscore
739 (1.8%) 739 (1.8%) block in ActiveSupport::Inflector#apply_inflections
626 (1.5%) 626 (1.5%) ActiveRecord::Relation#initialize
589 (1.4%) 589 (1.4%) ActiveRecord::Delegation::DelegateCache#relation_delegate_class
577 (1.4%) 577 (1.4%) ThreadSafe::NonConcurrentCacheBackend#get_or_default
549 (1.3%) 549 (1.3%) ActiveRecord::Attribute#initialize
497 (1.2%) 497 (1.2%) block in ActiveRecord::Relation::Merger#merge
497 (1.2%) 497 (1.2%) ActiveRecord::QueryMethods#validate_order_args
702 (1.7%) 424 (1.0%) ActiveRecord::Relation#initialize_copy
419 (1.0%) 417 (1.0%) ActiveRecord::Core::ClassMethods#arel_table
384 (0.9%) 384 (0.9%) ActiveRecord::Inheritance::ClassMethods#base_class
383 (0.9%) 383 (0.9%) block (4 levels) in Class#class_attribute
358 (0.9%) 358 (0.9%) Skylight::Normalizers::ActiveRecord::SQL#extract_rust
329 (0.8%) 329 (0.8%) ActiveRecord::Base.logger
321 (0.8%) 321 (0.8%) rescue in Net::BufferedIO#rbuf_fill
315 (0.8%) 315 (0.8%) ActiveRecord::Core#update_attributes_from_transaction_state
314 (0.8%) 314 (0.8%) ActiveRecord::ConnectionAdapters::AbstractAdapter#type_map
795 (1.9%) 298 (0.7%) ActiveRecord::QueryMethods#preprocess_order_args
284 (0.7%) 284 (0.7%) Arel::Table#initialize
279 (0.7%) 279 (0.7%) ActiveRecord::Relation#values
278 (0.7%) 278 (0.7%) ActiveRecord::Relation#reset
734 (1.8%) 264 (0.6%) ActiveRecord::Scoping::Default::ClassMethods#build_default_scope
263 (0.6%) 263 (0.6%) ActiveRecord::QueryMethods#joins_values
394 (1.0%) 258 (0.6%) ActiveRecord::ConnectionAdapters::PostgreSQL::Utils#extract_schema_qualified_name
15323 (37.0%) 249 (0.6%) ActiveRecord::Querying#find_by_sql
257 (0.6%) 246 (0.6%) ActiveRecord::Reflection::AssociationReflection#klass
I'm building my feed.json using index.json.jbuilder, this is how it looks:
json.battles #battles do |battle|
if (battle.products.size == 2)
battle_results = battle.calculate_results
json.(battle, :id)
vote = battle.votes.find_by(user_id: current_user.id)
json.voted vote.present?
if vote
json.product_voted vote.product.id == battle.products[0].id ? "first" : "second"
end
json.mybattle battle.try(:user).try(:id) == current_user.id
json.user do
username = ""
if (battle.try(:user).try(:nickname).present?)
username = battle.try(:user).try(:nickname)
else
username = battle.try(:user).try(:name).try(:downcase).try(:delete,' ')
end
json.username username
json.user_id battle.try(:user_id)
json.profile_image battle.try(:user).try(:image) || ""
json.full_name battle.try(:user).try(:name) || ""
end
json.votes battle_results[:votes]
json.created_at time_ago_in_words(battle.created_at) + " ago"
json.title battle.title
json.first_product do
first_product = battle.products[0]
json.id first_product.id
json.voted first_product.votes.find_by(user_id: current_user.id).present?
json.percentage battle_results[:percentage_product_one]
# json.percentage_after_voting battle_results[:percentage_after_voting_product_one]
json.name first_product.name
json.price SearchFunctions.convert_currency(first_product.price.to_s, current_user.currency_code, 'USD')
# json.price first_product.price.to_s
json.url first_product.url
if first_product.images["sub"] && first_product.images["sub"].kind_of?(Array)
first_product.images["sub"] = first_product.images["sub"].first(10)
end
json.images first_product.images
json.manufacturer first_product.manufacturer
json.description first_product.description
json.is_user_saved first_product.saved_products.find_by(user_id: current_user.id).present?
json.saved_count first_product.saved_products.length
end
json.second_product do
second_product = battle.products[1]
json.id second_product.id
json.voted second_product.votes.find_by(user_id: current_user.id).present?
json.percentage battle_results[:percentage_product_two]
# json.percentage_after_voting battle_results[:percentage_after_voting_product_two]
json.name second_product.name
json.price SearchFunctions.convert_currency(second_product.price.to_s, current_user.currency_code, 'USD')
# json.price second_product.price.to_s
json.url second_product.url
if second_product.images["sub"] && second_product.images["sub"].kind_of?(Array)
second_product.images["sub"] = second_product.images["sub"].first(10)
end
json.images second_product.images
json.manufacturer second_product.manufacturer
json.description second_product.description
json.is_user_saved second_product.saved_products.find_by(user_id: current_user.id).present?
json.saved_count second_product.saved_products.length
end
end
end
Well, this may be silly answer, but you probably should decrease or optimise number of queries executed during building feed.json. Check for N+1 queries, for example maybe you are loading author for each feed item or something like that.
You can use bullet gem to help you find N+1 queries. And you can fix those by adding includes to your queries.
Update Based on json view.
It is pretty big json and it looks like you use a lot of models from your application. BY looking at this it is impossible to give you any clear guidelines on how to optimise this. You should probably paste your whole app here, but I think that's not appropriate for SO.
For sure there is a lot space for improvement on database side, but I think your best and easiest way is to just cache this view. By caching I mean using fragment caching for each separate battle.
json.battles #battles do |battle|
if (battle.products.size == 2)
json.cache! "#{battle.id}/#{battle.updated_at}" do
battle_results = battle.calculate_results
json.(battle, :id)
vote = battle.votes.find_by(user_id: current_user.id)
json.voted vote.present?
if vote
json.product_voted vote.product.id == battle.products[0].id ? "first" : "second"
end
json.mybattle battle.try(:user).try(:id) == current_user.id
json.user do
username = ""
if (battle.try(:user).try(:nickname).present?)
username = battle.try(:user).try(:nickname)
else
username = battle.try(:user).try(:name).try(:downcase).try(:delete,' ')
end
json.username username
json.user_id battle.try(:user_id)
json.profile_image battle.try(:user).try(:image) || ""
json.full_name battle.try(:user).try(:name) || ""
end
json.votes battle_results[:votes]
json.created_at time_ago_in_words(battle.created_at) + " ago"
json.title battle.title
json.first_product do
first_product = battle.products[0]
json.id first_product.id
json.voted first_product.votes.find_by(user_id: current_user.id).present?
json.percentage battle_results[:percentage_product_one]
# json.percentage_after_voting battle_results[:percentage_after_voting_product_one]
json.name first_product.name
json.price SearchFunctions.convert_currency(first_product.price.to_s, current_user.currency_code, 'USD')
# json.price first_product.price.to_s
json.url first_product.url
if first_product.images["sub"] && first_product.images["sub"].kind_of?(Array)
first_product.images["sub"] = first_product.images["sub"].first(10)
end
json.images first_product.images
json.manufacturer first_product.manufacturer
json.description first_product.description
json.is_user_saved first_product.saved_products.find_by(user_id: current_user.id).present?
json.saved_count first_product.saved_products.length
end
json.second_product do
second_product = battle.products[1]
json.id second_product.id
json.voted second_product.votes.find_by(user_id: current_user.id).present?
json.percentage battle_results[:percentage_product_two]
# json.percentage_after_voting battle_results[:percentage_after_voting_product_two]
json.name second_product.name
json.price SearchFunctions.convert_currency(second_product.price.to_s, current_user.currency_code, 'USD')
# json.price second_product.price.to_s
json.url second_product.url
if second_product.images["sub"] && second_product.images["sub"].kind_of?(Array)
second_product.images["sub"] = second_product.images["sub"].first(10)
end
json.images second_product.images
json.manufacturer second_product.manufacturer
json.description second_product.description
json.is_user_saved second_product.saved_products.find_by(user_id: current_user.id).present?
json.saved_count second_product.saved_products.length
end
end
end
end
I added some code at line 3. I just wrote this out of my head, I am not exactly sure if syntax is 100% correct, but it should give you a hint. Also remember that caching is not enabled in development environment. To enable it you need to set config.action_controller.perform_caching = true in config/environments/developement.rb

can't run "rails server" on windows 7

I am just One hour new to ROR. I am getting trained by the "Lynda.com Ruby on Rails 4 Essential Training". And after installing all the components, I am unable to start the web server. What I do is the following:-
////////////////////////This is what i get after i type "rails server" in command prompt /////////////
port/descendants_tracker.rb
415 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-4.1.5/lib/active_sup
port/callbacks.rb
416 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activerecord-4.1.5/lib/active_reco
rd/connection_adapters/abstract_adapter.rb
417 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activerecord-4.1.5/lib/active_reco
rd/scoping.rb
418 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activerecord-4.1.5/lib/active_reco
rd.rb
419 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activemodel-4.1.5/lib/active_model
/railtie.rb
420 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-4.1.5/lib/active_sup
port/core_ext/module/attr_internal.rb
421 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-4.1.5/lib/active_sup
port/core_ext/module/anonymous.rb
422 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionpack-4.1.5/lib/abstract_cont
roller.rb
423 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionpack-4.1.5/lib/action_dispat
ch/http/filter_redirect.rb
424 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/request.rb
425 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/response.rb
426 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionpack-4.1.5/lib/action_dispat
ch/http/cache.rb
427 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionpack-4.1.5/lib/action_dispat
ch/http/response.rb
428 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-4.1.5/lib/active_sup
port/json/decoding.rb
429 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-4.1.5/lib/active_sup
port/json/encoding.rb
430 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-4.1.5/lib/active_sup
port/json.rb
431 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionpack-4.1.5/lib/action_contro
ller/metal/live.rb
432 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-4.1.5/lib/active_sup
port/hash_with_indifferent_access.rb
433 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-4.1.5/lib/active_sup
port/core_ext/hash/indifferent_access.rb
434 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-4.1.5/lib/active_sup
port/rescuable.rb
435 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionpack-4.1.5/lib/action_dispat
ch/http/upload.rb
436 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rack-test-0.6.2/lib/rack/mock_sess
ion.rb
437 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rack-test-0.6.2/lib/rack/test/cook
ie_jar.rb
438 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rack-test-0.6.2/lib/rack/test/mock
_digest_request.rb
439 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rack-test-0.6.2/lib/rack/test/util
s.rb
440 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rack-test-0.6.2/lib/rack/test/meth
ods.rb
441 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rack-test-0.6.2/lib/rack/test/uplo
aded_file.rb
442 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rack-test-0.6.2/lib/rack/test.rb
443 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionpack-4.1.5/lib/action_contro
ller/metal/strong_parameters.rb
444 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-4.1.5/lib/active_sup
port/core_ext/load_error.rb
445 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-4.1.5/lib/active_sup
port/core_ext/name_error.rb
446 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-4.1.5/lib/active_sup
port/core_ext/uri.rb
447 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionpack-4.1.5/lib/action_contro
ller.rb
448 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionpack-4.1.5/lib/abstract_cont
roller/railties/routes_helpers.rb
449 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionpack-4.1.5/lib/action_contro
ller/railties/helpers.rb
450 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionview-4.1.5/lib/action_view/g
em_version.rb
451 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionview-4.1.5/lib/action_view/v
ersion.rb
452 C:/Ruby200-x64/lib/ruby/2.0.0/erb.rb
453 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-4.1.5/lib/active_sup
port/core_ext/string/output_safety.rb
454 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionview-4.1.5/lib/action_view.r
b
455 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionview-4.1.5/lib/action_view/r
ailtie.rb
456 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionpack-4.1.5/lib/action_contro
ller/railtie.rb
457 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activerecord-4.1.5/lib/active_reco
rd/railtie.rb
458 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionmailer-4.1.5/lib/action_mail
er/gem_version.rb
459 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionmailer-4.1.5/lib/action_mail
er/version.rb
460 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-4.1.5/lib/active_sup
port/core_ext/class/delegating_attributes.rb
461 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-4.1.5/lib/active_sup
port/core_ext/module/reachable.rb
462 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-4.1.5/lib/active_sup
port/core_ext/class/subclasses.rb
463 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-4.1.5/lib/active_sup
port/core_ext/class.rb
464 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionmailer-4.1.5/lib/action_mail
er.rb
465 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionmailer-4.1.5/lib/action_mail
er/railtie.rb
466 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.1.5/lib/rails/test_unit
/railtie.rb
467 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sprockets-2.11.0/lib/sprockets/ver
sion.rb
468 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/hike-1.2.3/lib/hike.rb
469 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/tilt-1.4.1/lib/tilt/template.rb
470 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/tilt-1.4.1/lib/tilt/string.rb
471 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/tilt-1.4.1/lib/tilt/erb.rb
472 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/tilt-1.4.1/lib/tilt/etanni.rb
473 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/tilt-1.4.1/lib/tilt/haml.rb
474 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/tilt-1.4.1/lib/tilt/css.rb
475 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/tilt-1.4.1/lib/tilt/csv.rb
476 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/tilt-1.4.1/lib/tilt/coffee.rb
477 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/tilt-1.4.1/lib/tilt/nokogiri.rb
478 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/tilt-1.4.1/lib/tilt/builder.rb
479 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/tilt-1.4.1/lib/tilt/markaby.rb
480 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/tilt-1.4.1/lib/tilt/liquid.rb
481 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/tilt-1.4.1/lib/tilt/radius.rb
482 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/tilt-1.4.1/lib/tilt/markdown.rb
483 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/tilt-1.4.1/lib/tilt/textile.rb
484 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/tilt-1.4.1/lib/tilt/rdoc.rb
485 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/tilt-1.4.1/lib/tilt/wiki.rb
486 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/tilt-1.4.1/lib/tilt/yajl.rb
487 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/tilt-1.4.1/lib/tilt/asciidoc.rb
488 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/tilt-1.4.1/lib/tilt/plain.rb
489 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/tilt-1.4.1/lib/tilt.rb
490 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sprockets-2.11.0/lib/sprockets/eco
_template.rb
491 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sprockets-2.11.0/lib/sprockets/ejs
_template.rb
492 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sprockets-2.11.0/lib/sprockets/jst
_processor.rb
493 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sprockets-2.11.0/lib/sprockets/uti
ls.rb
494 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sprockets-2.11.0/lib/sprockets/eng
ines.rb
495 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/mime.rb
496 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sprockets-2.11.0/lib/sprockets/mim
e.rb
497 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sprockets-2.11.0/lib/sprockets/pro
cessor.rb
498 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sprockets-2.11.0/lib/sprockets/pro
cessing.rb
499 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sprockets-2.11.0/lib/sprockets/com
pressing.rb
500 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sprockets-2.11.0/lib/sprockets/pat
hs.rb
501 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/hike-1.2.3/lib/hike/normalized_arr
ay.rb
502 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/hike-1.2.3/lib/hike/extensions.rb
503 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/hike-1.2.3/lib/hike/index.rb
504 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/hike-1.2.3/lib/hike/paths.rb
505 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/hike-1.2.3/lib/hike/trail.rb
506 C:/Ruby200-x64/lib/ruby/2.0.0/shellwords.rb
507 C:/Ruby200-x64/lib/ruby/2.0.0/psych/syntax_error.rb
508 C:/Ruby200-x64/lib/ruby/2.0.0/x64-mingw32/psych.so
509 C:/Ruby200-x64/lib/ruby/2.0.0/psych/nodes/node.rb
510 C:/Ruby200-x64/lib/ruby/2.0.0/psych/nodes/stream.rb
511 C:/Ruby200-x64/lib/ruby/2.0.0/psych/nodes/document.rb
512 C:/Ruby200-x64/lib/ruby/2.0.0/psych/nodes/sequence.rb
513 C:/Ruby200-x64/lib/ruby/2.0.0/psych/nodes/scalar.rb
514 C:/Ruby200-x64/lib/ruby/2.0.0/psych/nodes/mapping.rb
515 C:/Ruby200-x64/lib/ruby/2.0.0/psych/nodes/alias.rb
516 C:/Ruby200-x64/lib/ruby/2.0.0/psych/nodes.rb
517 C:/Ruby200-x64/lib/ruby/2.0.0/psych/streaming.rb
518 C:/Ruby200-x64/lib/ruby/2.0.0/psych/visitors/visitor.rb
519 C:/Ruby200-x64/lib/ruby/2.0.0/psych/scalar_scanner.rb
520 C:/Ruby200-x64/lib/ruby/2.0.0/psych/visitors/to_ruby.rb
521 C:/Ruby200-x64/lib/ruby/2.0.0/psych/visitors/emitter.rb
522 C:/Ruby200-x64/lib/ruby/2.0.0/psych/visitors/yaml_tree.rb
523 C:/Ruby200-x64/lib/ruby/2.0.0/psych/json/ruby_events.rb
524 C:/Ruby200-x64/lib/ruby/2.0.0/psych/visitors/json_tree.rb
525 C:/Ruby200-x64/lib/ruby/2.0.0/psych/visitors/depth_first.rb
526 C:/Ruby200-x64/lib/ruby/2.0.0/psych/visitors.rb
527 C:/Ruby200-x64/lib/ruby/2.0.0/psych/handler.rb
528 C:/Ruby200-x64/lib/ruby/2.0.0/psych/tree_builder.rb
529 C:/Ruby200-x64/lib/ruby/2.0.0/psych/parser.rb
530 C:/Ruby200-x64/lib/ruby/2.0.0/psych/omap.rb
531 C:/Ruby200-x64/lib/ruby/2.0.0/psych/set.rb
532 C:/Ruby200-x64/lib/ruby/2.0.0/psych/coder.rb
533 C:/Ruby200-x64/lib/ruby/2.0.0/psych/core_ext.rb
534 C:/Ruby200-x64/lib/ruby/2.0.0/psych/deprecated.rb
535 C:/Ruby200-x64/lib/ruby/2.0.0/psych/stream.rb
536 C:/Ruby200-x64/lib/ruby/2.0.0/psych/json/yaml_events.rb
537 C:/Ruby200-x64/lib/ruby/2.0.0/psych/json/tree_builder.rb
538 C:/Ruby200-x64/lib/ruby/2.0.0/psych/json/stream.rb
539 C:/Ruby200-x64/lib/ruby/2.0.0/psych/handlers/document_stream.rb
540 C:/Ruby200-x64/lib/ruby/2.0.0/psych.rb
541 C:/Ruby200-x64/lib/ruby/2.0.0/yaml.rb
542 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sprockets-2.11.0/lib/sprockets/dir
ective_processor.rb
543 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sprockets-2.11.0/lib/sprockets/saf
ety_colons.rb
544 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sprockets-2.11.0/lib/sprockets/cha
rset_normalizer.rb
545 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sprockets-2.11.0/lib/sprockets/sas
s_compressor.rb
546 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sprockets-2.11.0/lib/sprockets/yui
_compressor.rb
547 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sprockets-2.11.0/lib/sprockets/clo
sure_compressor.rb
548 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sprockets-2.11.0/lib/sprockets/ugl
ifier_compressor.rb
549 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sprockets-2.11.0/lib/sprockets/sas
s_template.rb
550 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sprockets-2.11.0/lib/sprockets/scs
s_template.rb
551 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sprockets-2.11.0/lib/sprockets.rb
552 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-4.1.5/lib/active_sup
port/benchmarkable.rb
553 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionview-4.1.5/lib/action_view/h
elpers/active_model_helper.rb
554 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionview-4.1.5/lib/action_view/h
elpers/asset_url_helper.rb
555 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionview-4.1.5/lib/action_view/h
elpers/capture_helper.rb
556 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionview-4.1.5/lib/action_view/h
elpers/tag_helper.rb
557 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionview-4.1.5/lib/action_view/h
elpers/asset_tag_helper.rb
558 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionview-4.1.5/lib/action_view/h
elpers/atom_feed_helper.rb
559 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionview-4.1.5/lib/action_view/h
elpers/cache_helper.rb
560 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionview-4.1.5/lib/action_view/h
elpers/controller_helper.rb
561 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionview-4.1.5/lib/action_view/h
elpers/csrf_helper.rb
562 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionview-4.1.5/lib/action_view/h
elpers/date_helper.rb
563 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionview-4.1.5/lib/action_view/h
elpers/debug_helper.rb
564 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionview-4.1.5/lib/action_view/h
elpers/javascript_helper.rb
565 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-4.1.5/lib/active_sup
port/core_ext/array/access.rb
566 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionview-4.1.5/lib/action_view/h
elpers/url_helper.rb
567 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-4.1.5/lib/active_sup
port/core_ext/string/filters.rb
568 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionview-4.1.5/lib/action_view/v
endor/html-scanner.rb
569 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionview-4.1.5/lib/action_view/h
elpers/sanitize_helper.rb
570 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionview-4.1.5/lib/action_view/h
elpers/output_safety_helper.rb
571 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionview-4.1.5/lib/action_view/h
elpers/text_helper.rb
572 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionview-4.1.5/lib/action_view/h
elpers/form_tag_helper.rb
573 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionview-4.1.5/lib/action_view/m
odel_naming.rb
574 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionview-4.1.5/lib/action_view/h
elpers/form_helper.rb
575 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionview-4.1.5/lib/action_view/h
elpers/form_options_helper.rb
576 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-4.1.5/lib/active_sup
port/number_helper.rb
577 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionview-4.1.5/lib/action_view/h
elpers/number_helper.rb
578 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-4.1.5/lib/active_sup
port/core_ext/module/concerning.rb
579 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-4.1.5/lib/active_sup
port/core_ext/module/qualified_const.rb
580 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-4.1.5/lib/active_sup
port/core_ext/module.rb
581 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionview-4.1.5/lib/action_view/r
ecord_identifier.rb
582 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionview-4.1.5/lib/action_view/h
elpers/record_tag_helper.rb
583 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionview-4.1.5/lib/action_view/h
elpers/rendering_helper.rb
584 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionview-4.1.5/lib/action_view/h
elpers/translation_helper.rb
585 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionview-4.1.5/lib/action_view/h
elpers.rb
586 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sprockets-rails-2.1.3/lib/sprocket
s/rails/helper.rb
587 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sprockets-rails-2.1.3/lib/sprocket
s/rails/version.rb
588 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.1.5/lib/rails/engine/co
nfiguration.rb
589 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.1.5/lib/rails/applicati
on/configuration.rb
590 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sprockets-rails-2.1.3/lib/sprocket
s/railtie.rb
591 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.1.5/lib/rails/all.rb
592 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mysql2-0.3.16/lib/mysql2/version.r
b
593 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mysql2-0.3.16/lib/mysql2/error.rb
[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
C:\Users\bestacademyonline\Sites\simple_cms>
//////////////////////////////////////////////End//////////////////////////////////////////
Please Help me guys, waiting for you guys!
check your cofig/database.yml file. your user and password for mysql installation should match with mentioned in database.yml.
If this is correct can you show me your gem file details.

Convert PNG images to pixel gray-level values feature vectors

I am a newbie in MATLAB and I have a set of bmp images which I need to convert into pixel gray-level values as feature vectors of image. Can anyone suggest me the way how I can do that?
I need to use these pixel gray-level values as features and then perform operations like PCA/LDA.
I tried imread() but it returns me a matrix.. I feel feature vector will be just one row vector.
Regards,
imread() is the correct way to do it. Then just convert from a matrix into a vector. For example:
>> X = randi(255, 10)
X =
208 41 168 181 112 71 192 215 90 20
231 248 10 9 98 174 66 65 212 14
33 245 217 71 196 168 130 208 150 136
233 124 239 12 203 42 179 63 141 199
162 205 174 25 48 31 228 237 234 239
25 37 194 210 125 128 245 90 73 34
72 108 190 178 114 245 140 51 194 146
140 234 101 81 165 87 36 65 193 120
245 203 168 243 181 150 39 158 98 4
247 245 44 9 193 58 66 121 145 86
>> X(:)
ans =
208
231
33
233
162
25
72
140
245
247
...
Then you can just stack your different observations together with [] and do PCA.

Resources