对于一个项目,我想直接从DOS调用第一个硬盘上的MBR.我编写了一个小的汇编程序,它将MBR加载到内存中0:7c00h,远远超过它.我把我的util放在(DOS)可启动软盘上.我正在尝试启动的磁盘(HD0,0x80)上有一个TrueCrypt启动加载程序.当我在此设置中运行该工具时,它会显示TrueCrypt屏幕,但输入密码后会崩溃系统.当我在普通的WinXP机器上运行我的小功能(w00t.com)时,它似乎立即崩溃.
显然我忘记了BIOS通常会做的一些关键事情,我猜这是微不足道的.有更好的裸机DOS和BIOS经验的人可以帮助我吗?
继承我的代码:
.MODEL tiny
.386
_TEXT SEGMENT USE16
INCLUDE BootDefs.i
ORG 100h
start:
; http://vxheavens.com/lib/vbw05.html
; Before DOS has booted the BIOS stores the amount of usable lower memory
; in a word located at 0:413h in memory. We going to erase this value because
; we have booted dos before loading the bootsector, and dos is fat (and ugly).
; fake free memory
;push ds
;push 0
;pop ds
;mov ax, TC_BOOT_LOADER_SEGMENT / 1024 * 16 + TC_BOOT_MEMORY_REQUIRED …Run Code Online (Sandbox Code Playgroud) 我对C++很陌生,所以在我学习的时候,我倾向于设计很多Java主义.无论如何,在Java中,如果我的类具有"搜索"方法,该方法T将从Collection< T >匹配特定参数的对象返回一个对象,我将返回该对象,如果在集合中找不到该对象,我将返回null.然后在我的调用函数中,我会检查if(tResult != null) { ... }
在C++中,我发现null如果对象不存在,我就无法返回值.我只想返回一个类型为T的'指示符',它通知调用函数没有找到任何对象.我不想抛出异常,因为它并不是一个特例.
这就是我的代码现在的样子:
class Node {
Attr& getAttribute(const string& attribute_name) const {
//search collection
//if found at i
return attributes[i];
//if not found
return NULL; // what should this be?
}
private:
vector<Attr> attributes;
}
Run Code Online (Sandbox Code Playgroud)
我怎样才能改变它以便我能给出那种标记?
我们有很多开发人员,只有少数QA人员.通过编写自动化测试,开发人员在整个开发过程中越来越多地参与qa,但我们的QA实践大多是手动的.
我喜欢的是如果我们的开发实践是BDD和TDD,并且我们开发了一个强大的测试套件.问题是:在构建这样的测试套件时,我们如何确定我们可以信任的测试,以及我们应该继续手动测试的内容?
我正在尝试debug.keystore使用JDK中的keytool.exe 从文件生成MD5指纹,因此我可以在Android项目中使用Google Maps.我找到了密钥库文件并将其移动到C:\android只是为了让事情变得更容易.
然后在命令提示符中输入
c:\Program Files\Java\jdk1.5.0_13\bin>keytool -list -alias androiddebugkey -keystore "C:\android\debug.keystore" -storepass android -keypass android
Run Code Online (Sandbox Code Playgroud)
我一直收到错误:
keytool error: java.lang.Exception: Keystore file does not exist: C:\android\debug.keystore
Run Code Online (Sandbox Code Playgroud)
我也尝试从其原始位置进入密钥库而不是移动到c:\android但我仍然得到相同的错误.
有谁知道为什么会这样?此外,有没有其他方法来获得这个MD5指纹?有些程序可能吗?
代码高尔夫的常用规则.这是python中的一个实现作为示例
from PIL import Image
im = Image.new("RGB", (300,300))
for i in xrange(300):
print "i = ",i
for j in xrange(300):
x0 = float( 4.0*float(i-150)/300.0 -1.0)
y0 = float( 4.0*float(j-150)/300.0 +0.0)
x=0.0
y=0.0
iteration = 0
max_iteration = 1000
while (x*x + y*y <= 4.0 and iteration < max_iteration):
xtemp = x*x - y*y + x0
y = 2.0*x*y+y0
x = xtemp
iteration += 1
if iteration == max_iteration:
value = 255
else:
value = iteration*10 % 255
print value …Run Code Online (Sandbox Code Playgroud) 快点一个给你们.
假设我有一个输出字符串的函数:
function myString()
{
echo 'Hello World';
}
Run Code Online (Sandbox Code Playgroud)
我将如何进行测试以查看该函数是否输出任何数据?
if(myString() ==''){
echo ''Empty function;
}
Run Code Online (Sandbox Code Playgroud) 1)我需要为每个菜单项设置不同的类名,基于菜单行(迭代,我只需要一个数字)
<% control Menu(1) %>
<div class="mainmenu-item-$MenuItemRow"><a href="$Link">$MenuTitle</a></div>
<% end_control %>
Run Code Online (Sandbox Code Playgroud)
2)是否有一种简单的方法来创建一个小的第二个菜单?
嘿,我现在有一个我做的结构列表,我每次使用std :: list排序方法添加新对象时都会对此列表进行排序.我想知道什么会更快,使用std :: multimap这个或std :: list,因为我每帧迭代整个列表(我正在制作一个游戏).
我想听听你的意见,我应该为这次事件使用什么.
从std :: fstreams以可移植的方式获取有意义的文件访问错误消息的最佳方法是什么?原始性badbits并且failbits变得有点烦人.我之前已经针对win32和POSIX编写了自己的异常层次结构,这比STL的方式灵活得多.
我将"basic :: ios_clear"作为一个错误消息从一个 已启用异常what的downcasted catch(std::exception)方法中获取fstream.这对我来说意义不大,虽然我知道问题是什么,但我希望我的程序能够提供更多信息,这样当我几个月后开始部署时,我的生活会更容易.
Boost中有什么东西可以从fstream实现跨平台中提取有意义的消息并跨越STL实现吗?
我有一个带注释的MKMapView(也是一个UIPopoverControllerDelegate).这个MapView在MKTestMapView.h文件中有一个UIPopoverController* popoverController在@interface中定义的和一个已@property (nonatomic, retain) UIPopoverController* popoverController;定义的@interface部分外部.此控制器@synthesized位于MKTestMapView.m文件中,并在该- (void)dealloc部分中发布.此MapView中的注释已rightCalloutAccessoryView定义为以下内容:
- (void)mapView:(MKMapView *)mapView2 annotationView:(MKAnnotationView *)aview calloutAccessoryControlTapped:(UIControl *)control{
...
CGPoint leftTopPoint = [mapView2 convertCoordinate:aview.annotation.coordinate toPointToView:mapView2];
int boxDY=leftTopPoint.y;
int boxDX=leftTopPoint.x;
NSLog(@"\nDX:%d,DY:%d\n",boxDX,boxDY);
popoverController = [[UIPopoverController alloc] initWithContentViewController:controller];
popoverController.delegate = self;
CGSize maximumLabelSize = CGSizeMake(320.0f,600.0f);
popoverController.popoverContentSize = maximumLabelSize;
CGRect rect = CGRectMake(boxDX, boxDY, 320.0f, 600.0f);
[popoverController presentPopoverFromRect:rect inView:self.view permittedArrowDirections:UIPopoverArrowDirectionRight animated:YES];
...
}
Run Code Online (Sandbox Code Playgroud)
现在这里有趣的部分.首先,我不确定我是否需要maximumLabelSize和rect相同的尺寸.我是popovercontroller的新手,所以我一直在玩这个...
好吧,popover显示.现在要解雇它.我可以点击mapView2上的任何地方,然后popover消失......但如果他们改变了什么,我需要用户点击视图中的按钮.URGH!
文档显示:
要以编程方式关闭弹出框,请调用popover控制器的dismissPopoverAnimated:方法.
好吧,问题在于:通过定义popoverController的工作原理,你在显示的弹出窗口的视图 …
c++ ×3
php ×2
stl ×2
android ×1
assembly ×1
bare-metal ×1
bdd ×1
bootloader ×1
cmd ×1
code-golf ×1
exception ×1
fractals ×1
function ×1
google-maps ×1
ipad ×1
iphone ×1
iteration ×1
list ×1
mandelbrot ×1
mkmapview ×1
portability ×1
qa ×1
return-value ×1
sentinel ×1
silverstripe ×1
sorting ×1
tdd ×1
truecrypt ×1