我正在使用AvFoundation拍摄静态图像并将gps信息添加到元数据并使用资源库保存到相册,但gps信息根本不保存.
这是我的代码......
[self.stillImageTaker captureStillImageAsynchronouslyFromConnection:videoConnection
completionHandler:^(CMSampleBufferRef imageDataSampleBuffer, NSError *error)
{
if (imageDataSampleBuffer != NULL)
{
CFDictionaryRef exifAttachments = CMGetAttachment(imageDataSampleBuffer,kCGImagePropertyExifDictionary, NULL);
CFDictionaryRef metadataDict = CMCopyDictionaryOfAttachments(NULL, imageDataSampleBuffer, kCMAttachmentMode_ShouldPropagate);
NSDictionary *gpsDict = [NSDictionary dictionaryWithObjectsAndKeys:@"1",kCGImagePropertyGPSVersion,
@"78.4852",kCGImagePropertyGPSLatitude,@"32.1456",kCGImagePropertyGPSLongitude, nil];
CMSetAttachment(imageDataSampleBuffer,kCGImagePropertyGPSDictionary,gpsDict,kCMAttachmentMode_ShouldPropagate);
CFDictionaryRef newMetadata = CMCopyDictionaryOfAttachments(NULL, imageDataSampleBuffer, kCMAttachmentMode_ShouldPropagate);
CFDictionaryRef gpsAttachments = CMGetAttachment(imageDataSampleBuffer,kCGImagePropertyGPSDictionary, NULL);
if (exifAttachments)
{ // Attachments may be read or additional ones written
}
NSData *imageData = [AVCaptureStillImageOutput jpegStillImageNSDataRepresentation:imageDataSampleBuffer];
UIImage *image = [[UIImage alloc] initWithData:imageData];
ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
/
NSDictionary *newDict = (NSDictionary *)newMetadata; …Run Code Online (Sandbox Code Playgroud) 我正在尝试开发一个使用iPhone的GPS和指南针的应用程序,以指向某个特定位置的指针(就像指南针总是指向北方).位置是固定的,无论用户位于何处,我总是需要指针指向该特定位置.我有这个位置的Lat/Long坐标,但不知道如何使用指南针和GPS指向该位置...就像http://www.youtube.com/watch?v=iC0Xn8hY80w此链接1: 20'
我写了一些代码,然而,它无法正确旋转方向.
-(float) angleToRadians:(double) a {
return ((a/180)*M_PI);
}
-(void)updateArrow {
double alon=[longi doubleValue];//source
double alat=[lati doubleValue];//source
double blon=[pointlongi doubleValue];//destination
double blat=[pointlati doubleValue];//destination
float fLat = [self angleToRadians:alat];
float fLng = [self angleToRadians:alon];
float tLat = [self angleToRadians:blat];
float tLng = [self angleToRadians:blon];
float temp = atan2(sin(tLng-fLng)*cos(tLat),
cos(fLat)*sin(tLat)-sin(fLat)*cos(tLat)*cos(tLng-fLng));
double temp2= previousHeading;
double temp1=temp-[self angleToRadians:temp2];
/*I using this,but it can't rotate by :point even i change the coordinate
in CGPointMake */
Compass2.layer.anchorPoint=CGPointMake(0, 0.5);
[Compass2 setTransform:CGAffineTransformMakeRotation(temp1)];
/* Compass2 is …Run Code Online (Sandbox Code Playgroud) 我目前在数据库类中,并且在这个问题上遇到了第3个问题.
问题2大学数据库有以下关系:
学生(Sno:int,Sname:varchar(64),性别:'F'或'M',年龄:int),
COURSES(Cno:int,Cname:varchar(32)),
ENROLLMENT(Sno:int,Cno: int,Grade:int).
编写SQL语句以执行以下任务:
我的类中有一个int属性,并想验证用户是否输入了一个字符串.如何使用数据注释来做到这一点?当我传递一个非整数值时,我得到一个像这样的excpetion:
The value 'asdasd' is not valid for property.
Run Code Online (Sandbox Code Playgroud)
例如,使用此验证属性:
[Range(0, Int32.MaxValue, ErrorMessage="Invalid Number")]
public int? Number { get; set; }
Run Code Online (Sandbox Code Playgroud)
并在使用该模型的字段中输入'aaa'我已经获得了此消息的例外情况:
The value 'aaa' is not valid for Number.
Run Code Online (Sandbox Code Playgroud)
而不是"无效的数字"消息.
有任何想法吗?
我已经把
[Range(0, Int32.MaxValue, ErrorMessage="Invalid Number")]
public int? Number { get; set; }
Run Code Online (Sandbox Code Playgroud)
但我从这个消息中得到了这个消息
The value 'aaa' is not valid for Number.
Run Code Online (Sandbox Code Playgroud) 我想取代temp.replace
(QString("/"), QString("\"));
Run Code Online (Sandbox Code Playgroud)
这里我得到错误错误C2001:常量
错误中的换行符C2275:'QString':非法使用此类型作为表达式
如何用"\"替换"/"
thakns 4你的回答.但直到现在我还没有解决我的问题.请检查我的代码
//转换为wchar_t*
size_t origsize = strlen(toChar) + 1;
const size_t newsize = 100;
size_t convertedChars = 0;
wchar_t wcstring[newsize];
mbstowcs_s(&convertedChars, wcstring, origsize, toChar, _TRUNCATE);
wcscat_s(wcstring, L"\\*.*\0");
wcout << wcstring << endl; // C:\Documents and Settings\softnotions\Desktop\Release\*.*
SHFILEOPSTRUCT sf;
memset(&sf,0,sizeof(sf));
sf.hwnd = 0;
sf.wFunc = FO_COPY;
//sf.pFrom =wcstring; /* when giving wcstring i am not getting answer */
sf.pFrom = L"C:\\Documents and Settings\\softnotions\\Desktop\\Release\\*.*\0";
wcout << sf.pFrom <<endl; // C:\Documents and Settings\softnotions\Desktop\Release\*.*
Run Code Online (Sandbox Code Playgroud)
在分配sf.pFrom = wcstring时,wcstring和sf.pFrom都是相同的y not …
我在Android编程方面很陌生(我编写了大量的PC应用程序并使用了Java),我很茫然.我想创建一个使用片段的应用程序.我想创建Fragment Programaticaly(正如Android Developer页面上的介绍所说)买我的应用程序一直崩溃,我不知道为什么.
这是我的主要活动的代码:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
FragmentManager fmanager = getFragmentManager();
FragmentTransaction ftransaction = fmanager.beginTransaction();
FileBrowser fbrowser = new FileBrowser();
ftransaction.add(R.layout.main,fbrowser, "FileBrowser");
ftransaction.commit();
fbrowser.test();
}
Run Code Online (Sandbox Code Playgroud)
这是FileBrowser的代码:
公共类FileBrowser扩展了ListFragment {
public void test(){
System.err.println("Entre a test!!!");
String[] MyList = {"HOla","Mundo","De","Las","Listas"};
if (getActivity() == null){
System.err.println("I get a NULL Activity");
}
else{
System.err.println("No NULL Activity Attempting to Create an Adapter");
ArrayAdapter<String> aa = new ArrayAdapter<String>(getActivity(), R.layout.file_row, MyList);
}
//setListAdapter(new ArrayAdapter<String>(this.getActivity(), R.layout.file_row, MyList));
}
Run Code Online (Sandbox Code Playgroud)
}
我要做的就是在片段中打印字符串列表MyList.但是我程序崩溃了,我收到这个错误:
06-09 19:25:42.920:ERROR/AndroidRuntime(26064):java.lang.RuntimeException:无法启动活动ComponentInfo {com.ccr/com.ccr.Main}:java.lang.IllegalArgumentException:找不到id的视图片段FileBrowser的0x7f030001 {4077d558#0 …
我创建了一个数组,并在initializeBoard函数中设置了从1到9的值,但由于某种原因,当我打印出值时,它们会出现0到8.为什么会发生这种情况?不应该打印1到9,因为那些是我放入数组的数字initializeBoard?
int main()
{
initializeBoard();
ticTacToeBoard();
}
void initializeBoard()
{
for (int i = 1; i < 9; i++)
ticTacBoard[i] = i;
cout << endl;
}
void ticTacToeBoard ()
{
for (int y = 0; y < 3; y++)
{
for (int x = 0; x < 3; x++)
cout << ticTacBoard[3 * y + x] << " ";
cout << endl;
}
}
Run Code Online (Sandbox Code Playgroud) 我正在使用劳伦斯飞利浦Double-Metaphone算法取得了巨大的成功,但我发现了某些组合的奇怪"意外结果".
是否有其他人对算法的其他部分添加或更改,他们不介意共享,或只是他们发现不能按预期工作的组合.
例如.我之间有问题:
是否有可能在函数内部获取这些值并使用函数之外的函数是我的代码:
<?
function expenditure () {
$totalexpenditure = $sum1 + $sum2;
}
function income () {
totalincome = $sum1 + $sum2;
}
$profit = $totalincome - $totalexpenditure;
?>
Run Code Online (Sandbox Code Playgroud)
现在我的问题是如何才能获得totalincome和toatalexpenditure的价值?我正在学习php alos新的PHP所以请帮助我们.
我要为严格的正则表达式0:59来99:59小时.它应该允许0到99小时.怎么可能呢.
/^([0-9]{1,2}(\:[0-5][0-9])?)$/
Run Code Online (Sandbox Code Playgroud)
工作正常
所以,我有以下非常简单的map.r文件.
我正在尝试让用户在交互模式下键入"click",然后使用该功能.
由于它是一个函数,用户必须键入"click()"我如何才能使它们只需要单词(没有括号),然后让该函数对img做一些事情.
所以用户输入:
mydist( "image.pnm")
点击
//然后单击函数会执行它应该执行的操作
mydist <- function(mapfile) {
img <- read.pnm(mapfile)
plot(img)
}
click <- function() {
//Prompt user to click on img
}
Run Code Online (Sandbox Code Playgroud) algorithm ×1
android ×1
arrays ×1
asp.net ×1
asp.net-mvc ×1
avfoundation ×1
c# ×1
c++ ×1
cocoa-touch ×1
database ×1
echo ×1
function ×1
gps ×1
interactive ×1
iphone ×1
javascript ×1
location ×1
master-pages ×1
metadata ×1
metaphone ×1
php ×1
qt ×1
qt-creator ×1
qt4 ×1
r ×1
regex ×1
soundex ×1
sql ×1