我总是写这样的布尔表达式:
if (!isValid) {
// code
}
Run Code Online (Sandbox Code Playgroud)
但我的新雇主坚持以下风格:
if (false == isValid) {
// code
}
Run Code Online (Sandbox Code Playgroud)
一种风格是首选,还是标准?
我是Git的新手,所以我怀疑我在这里误解了一些东西,但无论如何我都会问.
通过TortoiseGit我做以下事情:
如果我然后浏览参考我看到以下内容:
heads/master
remotes/origin/master
我觉得奇怪的是我没有在遥控器上看到HEAD.
如果我删除我的本地仓库,然后从服务器克隆它(我只是推到上面),然后浏览我看到的参考:
头/主
遥控器/原点/ HEAD
遥控器/原点/主
那么为什么我在初次推动后看不到远程头?
NB.我通过Git Bash命令(即不是Tortoise Git)做了同样的事情,并且看到了同样的事情.
我的问题是自我解释.我想使用按钮从JSP运行一个shell,它正在调用一个过程.
程序是
CREATE OR REPLACE PROCEDURE DEMO_PRC (dist IN variable,mrno IN variable,
yr IN variable,flags OUT number)
IS
begin
flags:=0;
// CODE THAT GENERATES A UTIL.....
flags:=1;
end;
/
Run Code Online (Sandbox Code Playgroud)
而shell是:
sqlplus demo_user/123456@demo
var a NUMBER(4);
exec DEMO_PRC($1,$2,,$3,:a);
print a;
Run Code Online (Sandbox Code Playgroud)
命名为它dist.sh,它在命令行中运行为:
dist.sh 3 1937 10
Run Code Online (Sandbox Code Playgroud)
但是当我点击一个按钮时,我想从JSP运行它.但我不知道从JSP运行shell(.sh)的语法.
我有一个UserControl看起来像这样:
<UserControl
MaxHeight="32"
MaxWidth="32"
MinHeight="25"
MinWidth="25">
<DockPanel>
<!-- some stuff -->
</DockPanel>
</UserControl>
Run Code Online (Sandbox Code Playgroud)
除了最小/最大尺寸约束,我希望控件始终被涂上Width = Height.所以我覆盖MeasureOverride并ArrangeOverride:
protected override Size MeasureOverride(Size availableSize)
{
var resultSize = new Size(0, 0);
((UIElement)Content).Measure(availableSize);
var sideLength = Math.Min(((UIElement)Content).DesiredSize.Width, ((UIElement)Content).DesiredSize.Height);
resultSize.Width = sideLength;
resultSize.Height = sideLength;
return resultSize;
}
protected override Size ArrangeOverride(Size finalSize)
{
((UIElement)Content).Arrange(new Rect(0, 0, finalSize.Width, finalSize.Height));
return finalSize;
}
Run Code Online (Sandbox Code Playgroud)
我明白,我必须调用Measure,并Arrange在用户控件的每一个孩子.由于DocPanel是我的用户唯一的孩子,(在我的理解)存储在Content用户控件的属性,我简单地调用Measure和Arrange这个内容属性.但是不显示UserControl.我究竟做错了什么?
我正在开发一个项目,我以下面的方式调用其他viewcontroller: -
AppDelegate *app2 = (AppDelegate *)[[UIApplication sharedApplication]delegate];
[self.navigationController pushViewController:app2.SecondForm animated:NO];
app2 =nil;
Run Code Online (Sandbox Code Playgroud)
我的应用程序是基于导航的,我在导航栏上创建了我的后退按钮
-(void)viewDidLoad
{
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarStyleBlackOpaque target:self action:@selector(Back:)];
}
Run Code Online (Sandbox Code Playgroud)
通过这种方式我的后退动作将调用点击
-(IBAction)Back:(id)sender
{
// What code I will write over here to get the same functionality
// which is by default given by navigation controller?
}
Run Code Online (Sandbox Code Playgroud) 我正在使用ASANT来运行指向NARS.jar文件的xml文件.
我得到"java.lang.OutOfMemoryError:Java堆空间",我正在研究这个问题.
所以我发现我需要设置"-XX:+ HeapDumpOnOutOfMemoryError",以创建要分析的转储文件.
我编辑了ASANT.bat并将"-XX:+ HeapDumpOnOutOfMemoryError"添加到ANT_OPTS:
set ANT_OPTS= "-XX:+HeapDumpOnOutOfMemoryError" "-Dos.name=Windows_NT" "-Djava.library.path=%AS_INSTALL%\lib;%AS_ICU_LIB%;%AS_NSS%" "-Dcom.sun.aas.installRoot=%AS_INSTALL%" "-Dcom.sun.aas.instanceRoot=%AS_INSTALL%" "-Dcom.sun.aas.instanceName=server" "-Dcom.sun.aas.configRoot=%AS_CONFIG%" "-Dcom.sun.aas.processLauncher=SE" "-Dderby.root=%AS_DERBY_INSTALL%"
Run Code Online (Sandbox Code Playgroud)
但我似乎无法找到任何转储文件.我将使用Eclipse Memory Analyzer来分析何时找到转储.
我还尝试设置选项"-XX:HeapDumpPath = c:\ memdump\bds.hprof",但没有在那里创建转储.
任何人都知道我做错了什么?提前致谢
任何触发或GPS专家都可以帮助我吗?我正在尝试创建一个地理空间边界框(矩形)计算,使用我检索到的以下方法返回最大纬度和经度.我为每个轴承调用一次方法:北,南,东和西.有了这四个值,我打算在我的Core Data存储库中查询框中的所有对象.
-(CLLocation*) offsetLocation:(CLLocation*)startLocation:(double)offsetMeters:(double)bearing {
double EARTH_MEAN_RADIUS_METERS = 6372796.99;
double newLatitude = asin( sin(startLocation.coordinate.latitude) * cos(offsetMeters/EARTH_MEAN_RADIUS_METERS) + cos(startLocation.coordinate.latitude) * sin(offsetMeters/EARTH_MEAN_RADIUS_METERS) * cos(bearing) );
double newLongitude = startLocation.coordinate.longitude + atan2( sin(bearing) * sin(offsetMeters/EARTH_MEAN_RADIUS_METERS) * cos(startLocation.coordinate.latitude), cos(offsetMeters/EARTH_MEAN_RADIUS_METERS) - sin(startLocation.coordinate.latitude) * sin(newLatitude));
CLLocation *tempLocation = [[CLLocation alloc] initWithLatitude:newLatitude longitude:newLongitude];
[tempLocation autorelease];
return tempLocation;
}
Run Code Online (Sandbox Code Playgroud)
问题是newLatitude偏移的计算肯定是不正确的.鉴于以下内容:
startLocation:北纬37.331688999999997,经度-122.030731 offsetMeters:1000轴承:0(北)
newLatitude返回-0.36726592610659514(不正确).
有什么建议?到目前为止,我已经围绕这个特殊的公式进行了编码,这个让我难过.我也试过从PHP翻译不同的公式无济于事.我认为如果它可以调整,上面正是我需要的.
谢谢,b.dot
我是Django的新手,并在教程中尝试了这段代码.但是由于以下错误,我现在无法运行我的程序:
IndentationError at /
('unexpected indent', ('D:\\django_workspace\\django_bookmarks\\..\\django_bookmarks\\bookmarks\\views.py', 14, 4, ' return HttpResponse(output)\n'))
Request Method: GET
Request URL: http://localhost:8000/
Exception Type: IndentationError
Exception Value:
('unexpected indent', ('D:\\django_workspace\\django_bookmarks\\..\\django_bookmarks\\bookmarks\\views.py', 14, 4, ' return HttpResponse(output)\n'))
Exception Location: D:\django_workspace\django_bookmarks\..\django_bookmarks\urls.py in <module>, line 2
Python Executable: C:\Python26\python.exe
Python Version: 2.6.4
Python Path: ['D:\\django_workspace\\django_bookmarks', 'C:\\Python26', 'C:\\WINDOWS\\system32\\python26.zip', 'C:\\Python26\\DLLs', 'C:\\Python26\\lib', 'C:\\Python26\\lib\\plat-win', 'C:\\Python26\\lib\\lib-tk', 'C:\\Python26\\lib\\site-packages']
Server time: Tue, 9 Mar 2010 19:18:32 +
Run Code Online (Sandbox Code Playgroud)
我的views.py文件代码是:
from django.http import HttpResponse, Http404
from django.contrib.auth.models import User
from django.template import Context
from django.template.loader import get_template …Run Code Online (Sandbox Code Playgroud) 我注意到QT的示例应用程序将其菜单栏显示为不透明,并且颜色与窗口上的任何样式都不匹配.在Vista或Windows 7上运行时,似乎QT创建的窗口似乎没有获得不是新Windows外观主体的半透明效果.有没有办法在QT中覆盖它,甚至有自定义绘制的菜单?
请原谅我的无知.我对正则表达式的了解非常有限.
我在正则表达式验证器上有以下正则表达式.
^(\d{1,3},?(\d{3},?){0,2}\d{3}|\d{1,3})$
Run Code Online (Sandbox Code Playgroud)
它目前允许零.我需要更新它,以便它不允许值为0.
[编辑:只是为了澄清,我希望它排除零值而不是单数"0" - 谢谢]
任何帮助将不胜感激.
谢谢zaps
iphone ×2
java ×2
boolean ×1
button ×1
c++ ×1
coding-style ×1
core-data ×1
django-views ×1
dump ×1
geolocation ×1
git ×1
gps ×1
heap ×1
indentation ×1
jsp ×1
memory ×1
objective-c ×1
qt ×1
qt-creator ×1
qt4 ×1
regex ×1
shell ×1
tortoisegit ×1
validation ×1
wpf ×1