In a Spring MVC project I have inserted the GenericObjectPool of Apache commons. This library has done what it should for several months, until the visitor counts reached a big number. Since this time, the Jetty server breaks down with heapspace exhausted.
Jahr: 2013
Java, Spring
In einem Spring MVC Projekt habe ich den GenericObjectPool von Apache commons eingebaut. Dieser hat einige Monate scheinbar getan, was er sollte, bis das Projekt Zugriffszahlen erreicht hat, die ein gewisses Limit überschritten haben. Seit dem ist der Server, ein Jetty, regelmäßig mit Heapspace exhausted abgeschmiert.
iOS / Objective-C
If you overwrite the UILabel in Objective C, for example to get the functionality of VerticalAlign, like I wanted to do, You can get bad side effects.
I used a small code part I found on Internet, to get this functions.
@implementation UILabel (VerticalAlign)
- (void)alignTop {
CGSize fontSize = [self.text sizeWithFont:self.font];
double finalHeight = fontSize.height * self.numberOfLines;
double finalWidth = self.frame.size.width; //expected width of label
CGSize theStringSize = [self.text sizeWithFont:self.font constrainedToSize:CGSizeMake(finalWidth, finalHeight) lineBreakMode:self.lineBreakMode];
int newLinesToPad = (finalHeight - theStringSize.height) / fontSize.height;
for(int i=0; i<newLinesToPad; i++)
self.text = [self.text stringByAppendingString:@"\n "];
}
- (void)alignBottom {
CGSize fontSize = [self.text sizeWithFont:self.font];
double finalHeight = fontSize.height * self.numberOfLines;
double finalWidth = self.frame.size.width; //expected width of label
CGSize theStringSize = [self.text sizeWithFont:self.font constrainedToSize:CGSizeMake(finalWidth, finalHeight) lineBreakMode:self.lineBreakMode];
int newLinesToPad = (finalHeight - theStringSize.height) / fontSize.height;
for(int i=0; i<newLinesToPad; i++)
self.text = [NSString stringWithFormat:@" \n%@",self.text];
}
- (void)awakeFromNib {
[super awakeFromNib];
[self setFont:[UIFont fontWithName:@"KievitPro-Regular" size:12.0]];
}
-(id)initWithFrame:(CGRect)frame {
id result = [super initWithFrame:frame];
if (result) {
[self setFont:[UIFont fontWithName:@"KievitPro-Regular" size:12.0]];
}
return result;
}
@end
Read More „Problems with BadgeValue text color when overwrites UILabel“ »