Adding a radial gradient to my SVG path seems to cause weird horizontal (anti-aliasing?) lines on some iOS devices or when you zoom in/out on an iOS device. I wasn't able to replicate it anywhere else.
Here's the (isolated) code:
<svg class="componentClass__chart-svg" width="335" height="318" viewBox="0 0 335 320" xmlns="http://www.w3.org/2000/svg">
<defs>
<radialGradient id="axesGradient" cx="50%" cy="0%" fx="50%" fy="0%" r="50%">
<stop stop-color="#FFFFFF" offset="10%"></stop>
<stop stop-color="#FFFFFF" offset="100%" stop-opacity="0.2"></stop>
</radialGradient>
</defs>
<path class="componentClass__axes" stroke-width="2" stroke="url(#axesGradient)" fill="none" d="M151 12 Q167 0 183 12 L319 108 Q335 120 329 139 L276 299 Q270 318 250 318 L85 318 Q65 318 59 299 L6 139 Q0 120 16 108 Z
M151 37 Q167 25 183 37 L293 116 Q309 128 303 147 L260 275 Q254 294 234 294 L101 294 Q81 294 75 275 L32 147 Q26 128 42 116 Z
M151 62 Q167 50 183 62 L267 124 Q283 136 277 155 L244 251 Q238 270 218 270 L117 270 Q97 270 91 251 L58 155 Q52 136 68 124 Z
M151 87 Q167 75 183 87 L241 132 Q257 144 251 163 L228 227 Q222 246 202 246 L133 246 Q113 246 107 227 L84 163 Q78 144 94 132 Z
M152 113 Q167 100 183 113 L215 139 Q231 152 224 171 L213 203 Q206 222 186 222 L149 222 Q129 222 122 203 L111 171 Q104 152 119 139 Z
" />
</svg>
And the issue:
SVG showing horizontal line
Note this doesn't happen on every iPhone or iPad, but you're usually able to replicate it when you try zooming in and out.
I was able to nail down the issue to this particular use case: as soon as you add the gradient to the stroke, it starts happening. If you change stroke="url(#axesGradient) to just stroke="#FFF", it doesn't seem to happen.
Is there any way I can optimize the SVG to prevent rendering issues?
Here's a Codepen with the exact code above.
Had the same problem, but in my case these lines appeared in any browser on IOS 16, updating to IOS 16.3 fixed it
I'm trying to export a collection from mongodb using mongoexport. This works so far:
mongoexport.exe --db dataloggin --collection p1 --out myRecords.json
The problem is that the file is huge and I can not open it anymore (araound 20GB, 30 days, every half a second a document).
I just need the data between the 3. March and the 5 March, so I tried to select this date range with the query selector as following:
mongoexport.exe --db dataloggin --collection p1 -q='{"timestamp":{"$gte":{"$timestamp":"2016-03-3T00:00:00.000Z"}:},"timestamp":{"$lt":{"$timestamp":"2016-03-05T00:00:00.000Z"}}}' --out myRecords.json
But I get an error:
error validating settings: query '[39 123 116 105 109 101 115 116 97 109 112 58 123 36 103 116 101 58 123 36 116 105 109 101 115 116 97 109 112 58 50 48 49 54 45 48 49 45 48 49 84 48 48 58 48 48 58 48 48 46 48 48 48 90 125 58 125 44 116 105 109 101 115 116 97 109 112 58 123 36 108 116 58 123 36 116 105 109 101 115 116 97 109 112 58 50 48 49 54 45 48 49 45 48 49 84 48 48 58 48 48 58 48 48 46 48 48 48 90 125 125 125 39]' is not valid JSON: json: cannot unmarshal string into Go value of type map[string]interface {}
Someone have an idea?
Many Thanks and regards
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.
I am thinking this is somehow memory related, but I have done everything I can think of. I have made sure classes are disposed property. Maintained hard references at the class level instead of function scope, for things that might be getting GC'd while I am using them, etc.
Basically the app works fine in the simulator, but crashes at the same spot on a real device. Seems like I get a few different stacks, but they are all around the same place.
I am using a large amount of events in my application. Too many threads?
Stacktrace:
at Newtonsoft.Json.JsonWriter.WriteValue (object) at
Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue
(Newtonsoft.Json.JsonWriter,object,Newtonsoft.Json.Serialization.JsonContract,Newtonsoft.Json.Serialization.JsonProperty,Newtonsoft.Json.Serialization.JsonContract)
at
Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.WriteMemberInfoProperty
(Newtonsoft.Json.JsonWriter,object,Newtonsoft.Json.Serialization.JsonProperty,Newtonsoft.Json.Serialization.JsonContract)
at
Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject
(Newtonsoft.Json.JsonWriter,object,Newtonsoft.Json.Serialization.JsonObjectContract,Newtonsoft.Json.Serialization.JsonProperty,Newtonsoft.Json.Serialization.JsonContract)
at
Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue
(Newtonsoft.Json.JsonWriter,object,Newtonsoft.Json.Serialization.JsonContract,Newtonsoft.Json.Serialization.JsonProperty,Newtonsoft.Json.Serialization.JsonContract)
at
Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeList
(Newtonsoft.Json.JsonWriter,Newtonsoft.Json.Utilities.IWrappedCollection,Newtonsoft.Json.Serialization.JsonArrayContract,Newtonsoft.Json.Serialization.JsonProperty,Newtonsoft.Json.Serialization.JsonContract)
at
Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue
(Newtonsoft.Json.JsonWriter,object,Newtonsoft.Json.Serialization.JsonContract,Newtonsoft.Json.Serialization.JsonProperty,Newtonsoft.Json.Serialization.JsonContract)
at
Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.WriteMemberInfoProperty
(Newtonsoft.Json.JsonWriter,object,Newtonsoft.Json.Serialization.JsonProperty,Newtonsoft.Json.Serialization.JsonContract)
at
Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject
(Newtonsoft.Json.JsonWriter,object,Newtonsoft.Json.Serialization.JsonObjectContract,Newtonsoft.Json.Serialization.JsonProperty,Newtonsoft.Json.Serialization.JsonContract)
at
Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue
(Newtonsoft.Json.JsonWriter,object,Newtonsoft.Json.Serialization.JsonContract,Newtonsoft.Json.Serialization.JsonProperty,Newtonsoft.Json.Serialization.JsonContract)
at
Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize
(Newtonsoft.Json.JsonWriter,object) at
Newtonsoft.Json.JsonSerializer.SerializeInternal
(Newtonsoft.Json.JsonWriter,object) at
Newtonsoft.Json.JsonSerializer.Serialize
(Newtonsoft.Json.JsonWriter,object) at
RestSharp.Serializers.JsonSerializer.Serialize (object) [0x0001c] in
/Users/sonmez56/Projects/TrackAbout.Mono/RestSharp/RestSharp/Serializers/JsonSerializer.cs:64
at RestSharp.RestRequest.AddBody (object,string) [0x00019] in
/Users/sonmez56/Projects/TrackAbout.Mono/RestSharp/RestSharp/RestRequest.cs:203
at RestSharp.RestRequest.AddBody (object) [0x00000] in
/Users/sonmez56/Projects/TrackAbout.Mono/RestSharp/RestSharp/RestRequest.cs:232
at
TrackAboutMonoCore.Services.TrackAboutAPIRequestBuilder/TARestRequest.WithBody
(T) <0x00097> at
TrackAboutMonoCore.Services.ActionsService.CustomerSetVolume
(int,System.Collections.Generic.List1<TrackAboutMonoCore.Models.Asset>,System.Action1>)
[0x00000] in
/Users/sonmez56/Projects/TrackAbout.Mono/TrackAboutMonoCore/Services/ActionsService.cs:24
at TrackAboutMonoCore.Controllers.LocateController.Save
(object,System.EventArgs) [0x00055] in
/Users/sonmez56/Projects/TrackAbout.Mono/TrackAboutMonoCore/Controllers/LocateController.cs:64
at MonoTouch.UIKit.UIBarButtonItem/Callback.Call
(MonoTouch.Foundation.NSObject) [0x00010] in
/Developer/MonoTouch/Source/monotouch/src/UIKit/UIBarButtonItem.cs:23
at (wrapper runtime-invoke) object.runtime_invoke_dynamic
(intptr,intptr,intptr,intptr) <0xffffffff> at
MonoTouch.UIKit.UIApplication.Main (string[],string,string) [0x0004c]
in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:38
at TrackAboutIOS.Application.Main (string[]) [0x00000] in
/Users/sonmez56/Projects/TrackAbout.Mono/TrackAboutIOS/TrackAboutIOS/Main.cs:16
at (wrapper runtime-invoke) object.runtime_invoke_dynamic
(intptr,intptr,intptr,intptr) <0xffffffff>
Native stacktrace:
0 TrackAboutIOS 0x01d20618
mono_handle_native_sigsegv + 280 1 TrackAboutIOS
0x01d45bd4 sigabrt_signal_handler + 180 2 libsystem_c.dylib
0x376647ed _sigtramp + 48 3 libsystem_c.dylib
0x3765a20f pthread_kill + 54 4 libsystem_c.dylib
0x3765329f abort + 94 5 TrackAboutIOS
0x01e394ac monoeg_g_log + 208 6 TrackAboutIOS
0x01d11664 get_numerous_trampoline + 160 7 TrackAboutIOS
0x01d11aac mono_aot_get_imt_thunk + 56 8 TrackAboutIOS
0x01dbdc50 initialize_imt_slot + 112 9 TrackAboutIOS
0x01dbf1c4 build_imt_slots + 1124 10 TrackAboutIOS
0x01dbf32c mono_vtable_build_imt_slot + 120 11 TrackAboutIOS
0x01d236fc mono_convert_imt_slot_to_vtable_slot + 292 12
TrackAboutIOS 0x01d23974 common_call_trampoline
+ 284 13 TrackAboutIOS 0x01d21c60 mono_vcall_trampoline + 228 14 TrackAboutIOS
0x00934198 generic_trampoline_vcall + 136 15 TrackAboutIOS
0x00b9fec4
Newtonsoft_Json_Serialization_JsonSerializerInternalWriter_SerializeValue_Newtonsoft_Json_JsonWriter_object_Newtonsoft_Json_Serialization_JsonContract_Newtonsoft_Json_Serialization_JsonProperty_Newtonsoft_Json_Serialization_JsonContract + 1116 16 TrackAboutIOS 0x00ba13bc Newtonsoft_Json_Serialization_JsonSerializerInternalWriter_WriteMemberInfoProperty_Newtonsoft_Json_JsonWriter_object_Newtonsoft_Json_Serialization_JsonProperty_Newtonsoft_Json_Serialization_JsonContract + 1712 17 TrackAboutIOS 0x00ba2a70 Newtonsoft_Json_Serialization_JsonSerializerInternalWriter_SerializeObject_Newtonsoft_Json_JsonWriter_object_Newtonsoft_Json_Serialization_JsonObjectContract_Newtonsoft_Json_Serialization_JsonProperty_Newtonsoft_Json_Serialization_JsonContract + 1784 18 TrackAboutIOS 0x00ba0124 Newtonsoft_Json_Serialization_JsonSerializerInternalWriter_SerializeValue_Newtonsoft_Json_JsonWriter_object_Newtonsoft_Json_Serialization_JsonContract_Newtonsoft_Json_Serialization_JsonProperty_Newtonsoft_Json_Serialization_JsonContract + 1724 19 TrackAboutIOS 0x00ba3ec0 Newtonsoft_Json_Serialization_JsonSerializerInternalWriter_SerializeList_Newtonsoft_Json_JsonWriter_Newtonsoft_Json_Utilities_IWrappedCollection_Newtonsoft_Json_Serialization_JsonArrayContract_Newtonsoft_Json_Serialization_JsonProperty_Newtonsoft_Json_Serialization_JsonContract + 2520 20 TrackAboutIOS 0x00ba041c Newtonsoft_Json_Serialization_JsonSerializerInternalWriter_SerializeValue_Newtonsoft_Json_JsonWriter_object_Newtonsoft_Json_Serialization_JsonContract_Newtonsoft_Json_Serialization_JsonProperty_Newtonsoft_Json_Serialization_JsonContract + 2484 21 TrackAboutIOS 0x00ba13bc Newtonsoft_Json_Serialization_JsonSerializerInternalWriter_WriteMemberInfoProperty_Newtonsoft_Json_JsonWriter_object_Newtonsoft_Json_Serialization_JsonProperty_Newtonsoft_Json_Serialization_JsonContract + 1712 22 TrackAboutIOS 0x00ba2a70 Newtonsoft_Json_Serialization_JsonSerializerInternalWriter_SerializeObject_Newtonsoft_Json_JsonWriter_object_Newtonsoft_Json_Serialization_JsonObjectContract_Newtonsoft_Json_Serialization_JsonProperty_Newtonsoft_Json_Serialization_JsonContract + 1784 23 TrackAboutIOS 0x00ba0124 Newtonsoft_Json_Serialization_JsonSerializerInternalWriter_SerializeValue_Newtonsoft_Json_JsonWriter_object_Newtonsoft_Json_Serialization_JsonContract_Newtonsoft_Json_Serialization_JsonProperty_Newtonsoft_Json_Serialization_JsonContract + 1724 24 TrackAboutIOS 0x00b9f70c Newtonsoft_Json_Serialization_JsonSerializerInternalWriter_Serialize_Newtonsoft_Json_JsonWriter_object
+ 356 25 TrackAboutIOS 0x00b2c52c Newtonsoft_Json_JsonSerializer_SerializeInternal_Newtonsoft_Json_JsonWriter_object
+ 300 26 TrackAboutIOS 0x00b2c3b4 Newtonsoft_Json_JsonSerializer_Serialize_Newtonsoft_Json_JsonWriter_object
+ 156 27 TrackAboutIOS 0x012010c0 RestSharp_Serializers_JsonSerializer_Serialize_object + 452 28
TrackAboutIOS 0x011f8ad0
RestSharp_RestRequest_AddBody_object_string + 396 29 TrackAboutIOS
0x011f8e4c RestSharp_RestRequest_AddBody_object + 152 30
TrackAboutIOS 0x011d3c64
TrackAboutMonoCore_Services_TrackAboutAPIRequestBuilder_TARestRequest_WithBody_T_T
+ 152 31 TrackAboutIOS 0x011d22d4 TrackAboutMonoCore_Services_ActionsService_CustomerSetVolume_int_System_Collections_Generic_List_1_TrackAboutMonoCore_Models_Asset_System_Action_1_RestSharp_RestResponse_1_TrackAbout_Rest_Models_TARestResponse
+ 328 32 TrackAboutIOS 0x011ce3bc TrackAboutMonoCore_Controllers_LocateController_Save_object_System_EventArgs
+ 960 33 TrackAboutIOS 0x0139003c MonoTouch_UIKit_UIBarButtonItem_Callback_Call_MonoTouch_Foundation_NSObject
+ 96 34 TrackAboutIOS 0x008b0450 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr
+ 200 35 TrackAboutIOS 0x01d05834 mono_jit_runtime_invoke + 1644 36 TrackAboutIOS
0x01dbd09c mono_runtime_invoke + 128 37 TrackAboutIOS
0x01e4c054 monotouch_trampoline + 3436 38 CoreFoundation
0x30c7f3fd -[NSObject performSelector:withObject:withObject:] + 52 39
UIKit 0x3353efaf -[UIApplication
sendAction:to:from:forEvent:] + 62 40 UIKit
0x3360476b -[UIBarButtonItem(UIInternal) _sendAction:withEvent:] + 118
41 CoreFoundation 0x30c7f3fd -[NSObject
performSelector:withObject:withObject:] + 52 42 UIKit
0x3353efaf -[UIApplication sendAction:to:from:forEvent:] + 62 43
UIKit 0x3353ef6b -[UIApplication
sendAction:toTarget:fromSender:forEvent:] + 30 44 UIKit
0x3353ef49 -[UIControl sendAction:to:forEvent:] + 44 45 UIKit
0x3353ecb9 -[UIControl(Internal) _sendActionsForEvents:withEvent:] +
492 46 UIKit 0x3353f5f1 -[UIControl
touchesEnded:withEvent:] + 476 47 UIKit
0x3353dad3 -[UIWindow _sendTouchesForEvent:] + 318 48 UIKit
0x3353d4c1 -[UIWindow sendEvent:] + 380 49 UIKit
0x3352383d -[UIApplication sendEvent:] + 356 50 UIKit
0x335230e3 _UIApplicationHandleEvent + 5826 51 GraphicsServices
0x33e1322b PurpleEventCallback + 882 52 CoreFoundation
0x30cf9523 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION
+ 38 53 CoreFoundation 0x30cf94c5 CFRunLoopDoSource1 + 140 54 CoreFoundation 0x30cf8313 __CFRunLoopRun + 1370 55 CoreFoundation
0x30c7b4a5 CFRunLoopRunSpecific + 300 56 CoreFoundation
0x30c7b36d CFRunLoopRunInMode + 104 57 GraphicsServices
0x33e12439 GSEventRunModal + 136 58 UIKit
0x33551e7d UIApplicationMain + 1080 59 TrackAboutIOS
0x01696c74
wrapper_managed_to_native_MonoTouch_UIKit_UIApplication_UIApplicationMain_int_string_intptr_intptr
+ 240 60 TrackAboutIOS 0x00098420 TrackAboutIOS_Application_Main_string__ + 152 61 TrackAboutIOS
0x008b0450
wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr
+ 200 62 TrackAboutIOS 0x01d05834 mono_jit_runtime_invoke + 1644 63 TrackAboutIOS
0x01dbd09c mono_runtime_invoke + 128 64 TrackAboutIOS
0x01dc16b4 mono_runtime_exec_main + 436 65 TrackAboutIOS
0x01dc1a74 mono_runtime_run_main + 756 66 TrackAboutIOS
0x01d0c744 mono_jit_exec + 140 67 TrackAboutIOS
0x01e41110 main + 2288 68 TrackAboutIOS
0x0009826c start + 52
There's normally an exception type and message before the line:
Stacktrace:
It usually provides a good hint of the issue. Now the native stack trace also gives a clue here:
0x01e394ac monoeg_g_log + 208 6 TrackAboutIOS
0x01d11664 get_numerous_trampoline + 160 7 TrackAboutIOS
The first line tells us something was printed (or at least it tried to print) in your logs. It you check your device's log (e.g. using Xcode or mtouch --logdev) you should see the message.
The next line makes me think you're running out of trampolines (the error message will tell you which type). Here are the instructions on how to augment the number of trampolines available for your application.
Note: in case this is not trampoline-related please edit your question to add the exception type/message and the content of your device's log.
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.