在开发环境中,我将语言环境路径设置为:
LOCALE_PATHS = (
'/Users/***/Documents/Projects/**/Server/Django/**/locale',
)
Run Code Online (Sandbox Code Playgroud)
但是,当我将其部署到服务器时,区域设置路径将被更改.
我怎么处理这个?
在我的Django应用程序中,我有3种类型的角色(组)
超级用户帐户管理员ShopAdmin
我希望超级用户可以访问每个URL,但是其他2个管理员不能访问/ su / * URL。
我怎样才能做到这一点?
$ yum install httpd-devel
-bash: /usr/bin/yum: /usr/bin/python: bad interpreter: No such file or directory
Run Code Online (Sandbox Code Playgroud)
我怎样才能解决这个问题?
我在从表视图中删除行时遇到问题.当按下行中的删除按钮时,我正在使用下面的代码:
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:control.tag-100 inSection:0];
[resultList removeObjectAtIndex:indexPath.row];
[resultView beginUpdates];
[resultView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];
[resultView endUpdates];
//[resultView reloadData];
Run Code Online (Sandbox Code Playgroud)
第一行已成功删除,但随后索引不正确.因此,当我删除最后一行时,它会给出索引超出范围的异常.
细胞生成代码是:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"personalizeTableCell";
PersonalizeCell *cell = (PersonalizeCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
cell = [[PersonalizeCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
cell.title.text = @"text";
cell.rateView.tag = indexPath.row + 100;
return cell;
}
Run Code Online (Sandbox Code Playgroud)
我哪里错了?
更新:
for (NSInteger j = 0; j < [venuesTableView numberOfSections]; ++j)
{
for (NSInteger i = 0; i < …Run Code Online (Sandbox Code Playgroud) 我正在使用SDWebImage.在我的表中,每行都有图像和标签.

如您所见,无法看到图像.
但是当我回到父视图控制器并再次来到这里时,它们会被显示出来.

我使用的代码是:
[cell.imageView setImageWithURL:[NSURL URLWithString:serie.image] placeholderImage:[UIImage imageNamed:@"placeholder.png"] options:SDWebImageRefreshCached];
Run Code Online (Sandbox Code Playgroud)
那么,我哪里错了?
t滚动后,我无法在滚动视图中获得可见矩形的坐标。因此,当我想在可见矩形中添加子视图时,便不能。我怎样才能做到这一点?
我正在尝试解析来自MongoDB的日期(2015-06-25T00:00:00.000Z).
try {
DateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.ENGLISH);
Date date = format.parse("2015-06-25T00:00:00.000Z");
return new Date().after(date);
} catch (ParseException e) {
e.printStackTrace();
}
}
Run Code Online (Sandbox Code Playgroud)
我哪里错了?
我需要一个GridView,但在每个网格中,它上面/内部都会有一个ImageView和TextView.
它将类似于每个网格中的项目图像,以及图像上项目的名称.
我是:
public View getView(int position, View convertView, ViewGroup parent) {
ImageView imageView;
if (convertView == null) { // if it's not recycled, initialize some
// attributes
imageView = new ImageView(mContext);
imageView.setLayoutParams(new GridView.LayoutParams(300, 300));
imageView.setScaleType(ImageView.ScaleType.FIT_XY);
imageView.setPadding(0, 0, 0, 0);
} else {
imageView = (ImageView) convertView;
}
imageView.setImageResource(mThumbIds[position]);
TextView nameView = new TextView(mContext);
nameView.setText("Name");
nameView.setTextSize(20);
parent.addView(nameView);
return imageView;
}
Run Code Online (Sandbox Code Playgroud)
在我的网格视图适配器中.但我不能在这里添加它.我也尝试在ImageView中添加它,但由于它不是ViewGroup,我无法实现.
更新:
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = LayoutInflater.from(mContext);
ViewHolder holder;
if (convertView == …Run Code Online (Sandbox Code Playgroud) 我试图删除左UIBarButtonItem背景的背景.
我的图像只是带有线条的图标.但是有黑色背景.我的代码是:
paneViewController.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"menuicon"] style:UIBarButtonItemStylePlain target:self action:@selector(navigationPaneBarButtonItemTapped:)];
paneViewController.navigationItem.leftBarButtonItem.tintColor = [UIColor clearColor];
Run Code Online (Sandbox Code Playgroud)
我哪里错了?
更新:
UIImage *myImage = [UIImage imageNamed:@"menuicon"];
UIButton *myButton = [UIButton buttonWithType:UIButtonTypeCustom];
[myButton setImage:myImage forState:UIControlStateNormal];
myButton.showsTouchWhenHighlighted = YES;
myButton.frame = CGRectMake(0.0, 0.0, myImage.size.width, myImage.size.height);
[myButton addTarget:self action:@selector(navigationPaneBarButtonItemTapped:) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *leftBarButton = [[UIBarButtonItem alloc] initWithCustomView:myButton];
paneViewController.navigationItem.leftBarButtonItem = leftBarButton;
Run Code Online (Sandbox Code Playgroud)
这对我有用.谢谢
我有一个UIView和一个轻敲手势识别器:
UIImageView *tabView = [[UIImageView alloc] initWithFrame:CGRectMake(41, 145, 702, 100)];
tabView.image = [UIImage imageNamed:@"inactive_tab"];
tabView.userInteractionEnabled = YES;
UITapGestureRecognizer *singleFingerTap =
[[UITapGestureRecognizer alloc] initWithTarget:self
action:@selector(handleSingleTap:)];
[tabView addGestureRecognizer:singleFingerTap];
[self.scrollView addSubview:tabView];
Run Code Online (Sandbox Code Playgroud)
我在scrollview上添加了另一个视图:
[self.scrollView addSubview:self.activeTab];
Run Code Online (Sandbox Code Playgroud)
activeTab超过inactiveTap.当我点击activeTap时,手势识别器会发射,我想不要发生这种情况.我怎么能避免这个?
更新:
我写了一个非常简单的下载代码:
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSURLRequest* request = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:@"http://xxxx.s3.amazonaws.com/products/ipad/xxxx.mp4"]];
for(int i=0; i<4; i++){
NSString *filePath = [NSString stringWithFormat:@"%@/%@", documentsDirectory,[NSString stringWithFormat:@"xxxx%d.mp4",i]];
AFDownloadRequestOperation* operation = [[AFDownloadRequestOperation alloc] initWithRequest:request targetPath:filePath shouldResume:YES];
operation.outputStream = [NSOutputStream outputStreamToFileAtPath:filePath append:NO];
[operation setShouldOverwrite:YES];
[operation setProgressiveDownloadProgressBlock:^(AFDownloadRequestOperation *operation, NSInteger bytesRead, long long totalBytesRead, long long totalBytesExpected, long long totalBytesReadForFile, long long totalBytesExpectedToReadForFile) {
NSLog(@"%f", ( totalBytesRead / (float)totalBytesExpected));
}];
[operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
NSLog(@"finished");
} failure:^(AFHTTPRequestOperation *operation, …Run Code Online (Sandbox Code Playgroud) memory-leaks memory-management ios afnetworking afnetworking-2
我在POEdit中收到重复的消息定义错误,我无法从该目录更新.
POEdit不显示详细信息,并且错误中的行号不匹配.
我怎么能找到错误的?
Sat Mar 11 16:51:31 2017: /var/folders/qt/cg8qlhc159v9s15kmhy1h4440000gn/T/poeditgGtdFw/1input.po:2791: duplicate message definition...
Sat Mar 11 16:51:31 2017: /var/folders/qt/cg8qlhc159v9s15kmhy1h4440000gn/T/poeditgGtdFw/1input.po:65: ...this is the location of the first definition
Sat Mar 11 16:51:31 2017: /var/folders/qt/cg8qlhc159v9s15kmhy1h4440000gn/T/poeditgGtdFw/1input.po:2827: duplicate message definition...
Sat Mar 11 16:51:31 2017: /var/folders/qt/cg8qlhc159v9s15kmhy1h4440000gn/T/poeditgGtdFw/1input.po:1530: ...this is the location of the first definition
Sat Mar 11 16:51:31 2017: /Users/burakkilic/Applications/Poedit.app/Contents/PlugIns/GettextTools.bundle/Contents/MacOS/bin/msgmerge: found 2 fatal errors
Sat Mar 11 16:51:31 2017: Entries in the catalogue are probably incorrect.
Sat Mar 11 16:51:31 2017: Updating the catalogue failed. …Run Code Online (Sandbox Code Playgroud) 我有以下ngOnInit方法:
ngOnInit() {
this.countries = this.sharedService.getCountries();
this.shopService.getCurrentShopFromCache().then(shop => {
this.shop = shop;
this.myFormGroup = this.fb.group({
name: [this.shop.name[this.shop.defaultLanguage.code], [Validators.required]],
address: [this.shop.address.address],
city: [this.shop.address.city],
state: [this.shop.address.state],
country: [this.shop.address.country, [Validators.required]],
phone: [this.shop.phone],
email: [this.shop.email],
website: [this.shop.social.website],
twitter: [this.shop.social.twitter],
facebook: [this.shop.social.facebook],
instagram: [this.shop.social.instagram],
foursquare: [this.shop.social.foursquare]
});
}
);
}
Run Code Online (Sandbox Code Playgroud)
我越来越
formGroup expects a FormGroup instance. Please pass one in.
Run Code Online (Sandbox Code Playgroud)
我哪里错了?
更新:
<form *ngIf="shop" class="m-form m-form--fit m-form--label-align-right" [formGroup]="myFormGroup" novalidate>
...
Run Code Online (Sandbox Code Playgroud) ios ×5
android ×2
django ×2
uitableview ×2
afnetworking ×1
angular ×1
date ×1
delete-row ×1
django-i18n ×1
java ×1
memory-leaks ×1
mongodb ×1
poedit ×1
python ×1
sdwebimage ×1
uiscrollview ×1
yum ×1