我已经建立了一个简单的Eclipse 3.5/Jetty 6.1 Web应用程序,它可以返回hello world.有用.这是在Windows上并使用"Jetty通用服务器适配器".我有自动部署工作,以便它定期更改后部署.
我如何设置它,以便如果我更改任何静态内容,它不必重新部署,即我可以直接点击F5查看更改.对于轻微的HTML更改,它几乎无法使用,等待20-30秒进行部署.
可能重复:
git push错误'[remote rejected] master - > master(分支当前已检出)'
我是Git的新手,并尝试将其用于本地grails项目.
我遵循的步骤:
git init 回购中的git状态给出了以下消息
BXX@BXX-PC /c/Work/Grails/projects/yyy/tables (master)
$ git status
# On branch master
nothing to commit (working directory clean)
Run Code Online (Sandbox Code Playgroud)尝试将其保留为主分支,通过克隆repo进行更改,然后再将更改推回.为了那个原因
将本地更改推送到master.
15:41:56.249: git push -v origin master
Pushing to c:/Work/Grails/projects/xxx/tables
remote: error: refusing to update checked out branch: refs/heads/master
remote: error: By default, updating the current branch in a non-bare repository
remote: error: is denied, because it will make the index and work tree inconsistent …Run Code Online (Sandbox Code Playgroud)当超视图的界限尚未知晓时,相对于其超视图大小定位视图的最佳方法是什么?
如果可能的话,我试图避免硬编码坐标.也许这很愚蠢,如果是这样,这是一个完全可以接受的答案.
在使用自定义UI时,我遇到过很多次.最近的例子是我试图UINavigationItem用自定义视图替换纯文本标题.我希望该视图填充超视图,但另外,我想UIActivityIndicatorView在右侧,插入约2个像素并垂直居中.这是代码:
- (void) viewDidLoad
{
[super viewDidLoad];
customTitleView = [[UIView alloc] initWithFrame:CGRectZero];
customTitleView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
titleLabel = [[UILabel alloc] initWithFrame:CGRectZero];
titleLabel.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
titleLabel.lineBreakMode = UILineBreakModeWordWrap;
titleLabel.numberOfLines = 2;
titleLabel.minimumFontSize = 11.0;
titleLabel.font = [UIFont systemFontOfSize:17.0];
titleLabel.adjustsFontSizeToFitWidth = YES;
[customTitleView addSubview:titleLabel];
spinnerView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
spinnerView.center = CGPointMake(customTitleView.bounds.size.width - (spinnerView.bounds.size.width / 2) - 2,
customTitleView.bounds.size.height / 2);
spinnerView.hidesWhenStopped = YES;
[customTitleView addSubview:spinnerView];
self.navigationItem.titleView = customTitleView;
[customTitleView release];
}
Run Code Online (Sandbox Code Playgroud)
这是我的问题:在这段代码运行的时候, …
我有一个带标签栏的简单应用程序,根据用户输入禁用一个或多个条形项.我知道我需要使用我尝试使用的UITabBarDelegate.但是,当我调用委托方法时,我得到一个未捕获的异常错误[NSObject doesNotRecognizeSelector].我不确定我是在做这件事还是我没有错过任何东西.有什么建议.
我现在拥有以下内容:
WMViewController.h
#import <UIKit/UIKit.h>
#define kHundreds 0
@interface WMViewController : UIViewController <UITabBarDelegate, UIPickerViewDelegate, UIPickerViewDataSource>{
}
@end
WMViewController.m
#import "WMViewController.h"
#import "MLDTabBarControllerAppDelegate.h"
@implementation WMViewController
- (IBAction)finishWizard{
MLDTabBarControllerAppDelegate *appDelegate = (MLDTabBarControllerAppDelegate *)[[UIApplication sharedApplication] delegate];
[appDelegate setAvailabilityTabIndex:0 Enable:TRUE];
}
MLDTabBarControllerAppDelegate.h
#import <Foundation/Foundation.h>
@interface MLDTabBarControllerAppDelegate : NSObject <UITabBarDelegate>{
}
- (void) setAvailabilityTabIndex: (NSInteger) index Enable: (BOOL) enable;
@end
MLDTabBarControllerAppDelegate.m
#import "MLDTabBarControllerApplicationDelegate.h"
#import "MyListDietAppDelegate.h"
@implementation MLDTabBarControllerAppDelegate
- (void) setAvailabilityTabIndex: (NSInteger) index Enable: (BOOL) enable
{
UITabBarController *controller = (UITabBarController *)[[[MyOrganizerAppDelegate getTabBarController] viewControllers ] …Run Code Online (Sandbox Code Playgroud) Castle/Windsor新手,请耐心等待.
我目前正在使用框架System.Web.Mvc.Extensibility,并在其启动代码中,它注册了HttpContextBase,如下所示:
container.Register(Component.For<HttpContextBase>().LifeStyle.Transient.UsingFactoryMethod(() => new HttpContextWrapper(HttpContext.Current)));
Run Code Online (Sandbox Code Playgroud)
我想要做的是改变行为并将httpContextBase的生活方式改为PerWebRequest.
所以我将代码更改为以下内容:
container.Register(Component.For<HttpContextBase>().LifeStyle.PerWebRequest.UsingFactoryMethod(() => new HttpContextWrapper(HttpContext.Current)));
Run Code Online (Sandbox Code Playgroud)
但是,当我这样做时,我收到以下错误:
System.Configuration.ConfigurationErrorsException: Looks like you forgot to
register the http module Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleModule
Add '<add name="PerRequestLifestyle"
type="Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleModule, Castle.MicroKernel"
/>' to the <httpModules> section on your web.config
Run Code Online (Sandbox Code Playgroud)
这是我做下<system.web>和<system.webServer>,但是,我仍然得到同样的错误.任何提示?
提前致谢.
更新
每个请求添加了代码块
在system.web.mvc.extensibility框架中,有一个名为extendedMvcApplication的类,它继承自HttpApplication,在Application_start方法中,它调用BootStrapper.Execute().此方法的实现如下:
public void Execute()
{
bool shouldSkip = false;
foreach (IBootstrapperTask task in ServiceLocator.GetAllInstances<IBootstrapperTask>().OrderBy(task => task.Order))
{
if (shouldSkip)
{
shouldSkip = false;
continue;
}
TaskContinuation continuation = task.Execute(ServiceLocator);
if (continuation == TaskContinuation.Break) …Run Code Online (Sandbox Code Playgroud) 代码示例
- (void)drawRect:(CGRect)rect {
[super drawRect:rect];
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSaveGState(context);
CGContextTranslateCTM(context, 0, self.frame.size.height);
CGContextScaleCTM(context, 1.0, -1.0);
CGContextDrawImage(context, CGRectMake(0.0, 0.0, self.frame.size.width, self.frame.size.height), [UIImage imageNamed:@"sample.png"].CGImage);
CGContextRestoreGState(context);
}
Run Code Online (Sandbox Code Playgroud)
================
我想将图像中的某个矩形复制到上下文中,因此不是绘制整个图像而只是图像的一部分.有人有解决方案吗?我在谷歌和文档上找不到任何东西.
我知道还有其他选择:1.使用剪辑创建一个UIView,然后将UIImageView放在其中.2.在UIScrollView中创建UIImageView并使用内容偏移量.
但我认为那些是蹩脚的......
我在使用fgets抓取服务器对我正在进行的一些批量数据库调用的响应所产生的延迟时遇到了一些实际问题.
我正在通过一批说,10,000个电话发送,并且我已经跟踪延迟到fgets导致我的应用程序的速度保持不变,因为需要抓住每个呼叫的响应.
我发现这个帖子http://bugs.php.net/bug.php?id=32806很好地解释了这个问题,但他正在读一个文件,而不是服务器响应,所以fread可能有点棘手,因为我可以参与其中下一行,以及我不想要的额外内容.
所以我的问题是,作为fgets的替代方案,从服务器读取响应的最佳/最快方法是什么?
有没有办法在Groovy中使用匿名代码块?例如,我正在尝试将以下Java代码转换为Groovy:
{
int i = 0;
System.out.println(i);
}
int i = 10;
System.out.println(i);
Run Code Online (Sandbox Code Playgroud)
我能想出的最接近的翻译如下:
boolean groovyIsLame = true
if (groovyIsLame) {
int i = 0
println i
}
int i = 10
println i
Run Code Online (Sandbox Code Playgroud)
我知道匿名代码块通常是一种反模式.但是拥有像"inputStream0"和"inputStream1"这样的名称的变量也是一个反模式,所以对于我正在研究的代码,匿名代码块会有所帮助.
gs -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dBATCH \
-sDEVICE=pdfwrite -sOutputFile=output.pdf input.pdf
Run Code Online (Sandbox Code Playgroud)
我正在使用(尝试无论如何)使用Ghostscript来减少我的PDF文件大小.上面的命令看起来像它的工作,它大大减少了文件大小,但随后几个字段出现乱码.至于我可以追踪它,它正在进行字体替换.IE,同一文本=相同的乱码文本.
当它到达我时,字体嵌入在PDF中.另外,我试图将所有字体添加到Fontmap中.
任何想法,理想情况下我希望它使用嵌入式字体,而不必更新gs系统字体/编辑字体图等.我正在使用Ubuntu 9.10和嵌入的字体是Windows字体,Arial/TimesNewRoman.
谢谢.
iphone ×3
java ×2
asp.net-mvc ×1
cocoa-touch ×1
deployment ×1
drawrect ×1
eclipse ×1
editor ×1
fgets ×1
fonts ×1
fread ×1
ghostscript ×1
git ×1
groovy ×1
image ×1
java-ee ×1
jetty ×1
pdf ×1
performance ×1
php ×1
postscript ×1
push ×1
text-editor ×1
ubuntu ×1
uitabbar ×1
vim ×1
xcode ×1