How can i divide a snapshot into pieces with xcode so that i can make the user interact with each of the pieces?
Date : March 29 2020, 07:55 AM
this one helps. Well, for dividing image into pieces you should use the following code (place it in UIImage category): - (UIImage *)imageCroppedWithRect:(CGRect)rect
{
if (self.scale > 1.0f) {
rect = CGRectMake(rect.origin.x * self.scale,
rect.origin.y * self.scale,
rect.size.width * self.scale,
rect.size.height * self.scale);
}
CGImageRef imageRef = CGImageCreateWithImageInRect(self.CGImage, rect);
UIImage *result = [UIImage imageWithCGImage:imageRef scale:self.scale orientation:self.imageOrientation];
CGImageRelease(imageRef);
return result;
}
- (void)pieceTapped:(UITapGestureRecognizer *)recognizer
{
UIImageView *piece = recognizer.view;
self.zoomedImageView.frame = piece.frame;
self.zoomedImageView.image = piece.image;
self.zoomedImageView.hidden = NO;
[UIView animationWithDuration:0.3 animation:^{
self.zoomedImageView.frame = self.view.frame;
}];
}
|
two pieces of code, one works, one doesnt, why?
Date : March 29 2020, 07:55 AM
around this issue Congratulations, you just fell for the fixed limits trap: You allocate an array of 100 bytes on the stack, then you copy a string of unknown size into it (using strcpy()). Now, when parser is a string that is longer than 100 bytes, strcpy() continues writing past the end of the array, overwriting vital data on your stack, including your functions return address. This is why your program crashes when your function tries to return - it tries to jump to an address that does not exist.
|
VBA to loop through worksheets running code either doesnt loop or does loop but doesnt run code
Tag : excel , By : MJRider
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further You could avoid all the Activate and Select and qualify all your Range and Cells statemets inside by using With ws. So after you loop through all your Worksheets in : Option Explicit
Sub GetFlows()
Dim cell As Range
Dim dem1 As String
Dim WhereCell As Range
Dim ws As Worksheet
Dim valueRng As Range
Dim x As Long
Dim y As Long
For Each ws In ThisWorkbook.Worksheets
With ws
If .Name <> "summary" Then
For x = 9 To 200 ' run a loop from row 9 to 200
dem1 = .Range("A" & x).Value
If dem1 <> "" Then
Set WhereCell = .Range("A9:A200").Find(what:=dem1, LookAt:=xlPart)
If Not WhereCell Is Nothing Then
Workbooks("GetFilenames v2.xlsm").Worksheets(dem1).Range("A1").CurrentRegion.Copy
WhereCell.Offset(, 2).PasteSpecial xlPasteValues
End If
End If
Next x
End If
End With
Next ws
End Sub
|
I have 2 pieces of xquery codes where 1 gives the right result but 2 doesnt. Why?
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , Your constraints are different in these two queries. In the first query, you are applying both constraints to the same language: language[contains(.,"German") and data(@percentage)>50]
for $p in $doc/countries/country
where $p/language[@percentage >50 and contains(.,"German")]
return $p/@name
|
Operating Systen three easy pieces - translate stack memory address
Date : March 29 2020, 07:55 AM
To fix this issue I am reading chapter 16 from OSTEP on memory segmentation. , in step 4, why is the maximum segment 4KB--isn't it 2KB?
|