我们将建立一个iPhone从服务器请求数据的解决方案.我们可以选择决定采用何种解决方案,我们不确定要走哪条路.
关于SOAP我认为我有答案,没有真正稳定的解决方案(我知道有解决方案,但我想要稳定的东西).
REST怎么样?
或者只是创建我们自己的XML更好?它不会是如此复杂的reguest/respons-flow.
提前致谢!
我创建了一个UIColor对象,并希望在使用CGContextSetRGBStrokeColor绘制之前设置颜色.为此,我需要从UIColor对象中提取红色,绿色和蓝色的值.我怎么做?
或者是否有更好的方法使用其他类型的方法定义颜色(虽然我找不到时找不到),我可以使用UIColor对象来设置颜色?
提前致谢!
/尼克拉斯
我即将完成我的应用程序的发布,并正在尝试使用Instruments来修复任何内存泄漏.
为什么我在使用Instruments和我的设备时会发现一次内存泄漏,但在使用iPhone模拟器时却没有?我知道这是一个高级别的问题,但我不认为发布任何代码会有所帮助(相当多的代码......).
是否有可能让仪器指向它认为泄漏的源代码?我可以在使用模拟器时这样做,但是当它用于设备时它似乎不起作用(对象由地址(我假设)表示,同时为模拟器运行它看到它是什么对象,设置问题?)
提前致谢!
此致,尼克拉斯
更新:它是否与OSX有自动垃圾收集有关,但iOS没有?
我用谷歌搜索了它,但我有点惊讶,我找不到它.
我只想访问设备配置的区域设置.我试图找到如何列出所有系统propreties(如果我可以找到那里的语言环境),但甚至无法找到如何做到这一点.我知道(/认为)之前我已经检索过系统属性,但我也记得在谷歌搜索时找到这些信息并不容易.也许我在搜索时使用了错误的单词...
如何识别在实际设备上配置的区域设置(和/或系统属性)?
谢谢!
/尼克拉斯
I have a beginner's question for web development. I am going to create a table in which I am having input fields which I will submit to the server.
What is the common practice for doing this? Should I use html-tables or should I build the tables using stylesheets for positioning and sizing cells, columns, etc.? If both are common practice, what are the pros and cons of using eithor of those?
是否有一种很好的方式(没有循环)来创建由许多相同字符构成的字符串?
我知道我应该加5'.' 到一个字符串的开头.如何在没有循环的情况下做到这一点?
我事先不知道应该是5'.',这可能会有所不同.因此我的问题.
我正在使用PHP.
我正在尝试验证表单.表单是动态生成的,并添加到页面上的div.提交表单时,我希望立即执行验证.现在发生的是我第一次提交表单时未经验证就发布了.我第二次点击提交它的验证.
这是我的脚本:
$("#registerform").live("submit", function(e){
//Prevent the form from submitting normally
e.preventDefault();
$("#registerform").validate({
rules: {
firstname: "required",// simple rule, converted to {required:true}
surname: "required",
//phonenumber: "required",
address: "required",
// address2: "required",
zipcode: "required",
username_ID: "required",
city: "required",
companyname: "required",
email: {// compound rule
required: true,
email: true
}
},
messages: {
firstname: "Förnamn saknas" ,
surname: "Efternamn saknas",
address: "Adress saknas",
// address2: "required",
zipcode: "Postkod saknas",
username_ID: "Användarnamn saknas",
city: "Ort saknas",
companyname: "Företagsnamn saknas",
email: "Korrekt emailadress saknas"
} …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用JSON将动态内容添加到我的网页,使用javascript.有些事情是不正确的,我有问题弄清楚它可能是什么.在firebug中,我可以看到JSON数据已经按照它应该进行了检索.在"DOM"下查看Firebug时,我访问该页面的URL(我创建的实际页面,而不是JSON数据的URL)显示为红色(参见下面的屏幕截图).这是我的javascript:
$(document).ready(function() {
$('#target').click(function() {
alert("At least I',m reached ");
$.getJSON('http://localhost/timereporting/phpscriptlibrary/get_remaining_hours.php', function(data) {
document.getElementById('errorDiv').innerHTML = "Divtext";
alert("Inside getJason");
});
alert("At least I',m done ");
});
Run Code Online (Sandbox Code Playgroud)
这是我的php文件的重要部分:
$json_string = "{\"activities\": ";
$json_string = $json_string."[";
for ( $counter = 0; $counter < $num; $counter += 1) {
$json_string = $json_string."[".mysql_result($rows,$counter,'date').", \"".mysql_result($rows,$counter,'activity_id')."\", ".mysql_result($rows,$counter,'hours')."]";
if($counter != ($num-1)){
$json_string = $json_string.", ";
}
}
$json_string = $json_string."]}";
echo $json_string;
Run Code Online (Sandbox Code Playgroud)
我假设"echo"是将JSON数据"发送"到javascript的方式?
奇怪的是,在firebug中,JSON数据以两种不同的方式呈现.如果你看下面包含的截图,第二个截图有"1988"或类似的日期,而在第一个日期更完整,如"2010-12-10".第一个截图描绘了它应该是什么,这就是我试图发送它的方式,显然它在某些时候就像这样收到了.
为什么我的div-tag没有更新日期或$ .getJSON内的警报没有被触发,只有前后的警报?



我用自定义的initWithCoord创建自己的类,它接受一个(struct CLLocationCoordinate2D*)作为参数.
即使我认为我有正确的参数类型,我仍然得到"initWithCoord的参数1的不兼容类型:"我做错了什么:
PeopleStub.m:
#import "PeopleStub.h"
@implementation PeopleStub
-(id)initWithCoord:(struct CLLocationCoordinate2D*)coord{
if(self = [super init]){
people = [[NSMutableDictionary alloc] init];
}
return self;
}
@end
Run Code Online (Sandbox Code Playgroud)
PeopleStub.h
#import <Foundation/Foundation.h>
@interface PeopleStub : NSObject {
NSMutableDictionary *people;
}
-(id)initWithCoord:(struct CLLocationCoordinate2D*)coord;
@end
Run Code Online (Sandbox Code Playgroud)
我创建PeopleStub实例的方法:
PeopleStub *peopleStub = [[PeopleStub alloc] initWithCoord:locationManager.location.coordinate;
Run Code Online (Sandbox Code Playgroud)
提前致谢!
location struct initialization objective-c parameter-passing
我正在尝试使用php创建一个网页.问题是,有时候我会收到服务器错误,而有时我根本得不到任何回报.有一次,服务器自己更改了文件类型.我不知道问题是什么.
因为我实际上不知道问题是什么,所以我将整个文件粘贴到这里,即使我希望它是前几行的问题(我把它放在这里:http://www.iandapp.com/smic/ subscription.php):
<?php header('Content-Type: text/html; charset=ISO-8859-1');
echo("<div id='subscribe'>");
$mail = $_POST['email1'];
//Set the locale format, etc. of date and time
date_default_timezone_set('Europe/Stockholm');
setlocale(LC_TIME, "sv_SV");
//Create the db-connection
$mysqli = mysqli_connect("mydb", "myuser", "mupsw", "myschema", "3306");
//If verifying the subscription, makse sure the db is updated accordingly
if($_GET['newid'] != ""){
//Make the subscriber a verified subscriber
$result = mysqli_query($mysqli,"UPDATE users SET subscriber = 1 WHERE id = " . $_GET['newid']);
if($result){
echo("<p>Welcome to our newsletter! We will send …Run Code Online (Sandbox Code Playgroud) 我创建了自己的Perl模块.我从文件Config.pm中引用它.
当我从Perl模块中获取内容并将其复制到Config.pm时,脚本会被适当地触发.但是当我把它包括在内时:
use severalnines;
Kernel::severalnines::config_severalnines($Self);
Run Code Online (Sandbox Code Playgroud)
它没有被触发.我确信找到该文件是因为当我尝试更改文件名时,我收到错误(脚本标题的过早结束:).
这是我要包含在Config.pm中的文件(several nins.pm):
package Kernel::severalnines;
sub config_severalnines
{
$Self->{TicketAcl}->{'ACL-Name-Typer'} = {
Properties => {Frontend => {Action => ['CustomerTicketMessage']},
# current ticket match properties
CustomerUser => {
Group_rw => [ 'Incident Management Severalnines', ],
},
},
Possible => {
Ticket => {
Type => ['Incident',],},
},
};
}
1;
Run Code Online (Sandbox Code Playgroud)
onesnines.pm位于/usr/lib/perl5/5.12.3中,在执行perl -V时列出.
问题是什么?
先感谢您!
objective-c ×5
html ×3
iphone ×3
php ×3
dom ×2
javascript ×2
cgi ×1
css ×1
debugging ×1
graphic ×1
html-table ×1
instruments ×1
jquery ×1
json ×1
linux ×1
localization ×1
location ×1
memory-leaks ×1
module ×1
perl ×1
properties ×1
rest ×1
server-error ×1
soap ×1
string ×1
struct ×1
uicolor ×1
xcode ×1
xml ×1