小编max*_*ax_的帖子

JQuery附加'[object,Object]'而不是图像

我正在使用$.getJSONJQuery的功能来下载一些图像的 url,并且我试图将它们输出到一个 div 中。我试图让输出看起来像这样:

<a href="the image url (shot.short_url)"><img src="the direct image url (shot.image_teaser_url)" /></a>
Run Code Online (Sandbox Code Playgroud)

但是,它正在输出这个:

<div id="body-wrapper">
    <a href="http://drbl.in/300896">[object Object]</a>
    <a href="http://drbl.in/298080">[object Object]</a>
    <a href="http://drbl.in/290395">[object Object]</a>
    <a href="http://drbl.in/290324">[object Object]</a>
    <a href="http://drbl.in/268595">[object Object]</a>
    <a href="http://drbl.in/265197">[object Object]</a>
    <a href="http://drbl.in/256368">[object Object]</a>
    <a href="http://drbl.in/252519">[object Object]</a>
    <a href="http://drbl.in/242235">[object Object]</a>
    <a href="http://drbl.in/241676">[object Object]</a>
</div>
Run Code Online (Sandbox Code Playgroud)

请你告诉我在输出图像的情况下我哪里出错了?

这是我的代码:

function work() {
            $('#body-wrapper').empty();
            $.getJSON("http://dribbble.com/jakekrehel/shots.json?callback=?", function(data){
                $.each(data.shots, function(i,shot){
                  var image = $('<img/>').attr('src', shot.image_teaser_url);
                  var title = '<a href=\"' + shot.short_url + '\">';
                  var string = title;
                  string …
Run Code Online (Sandbox Code Playgroud)

html javascript jquery json

5
推荐指数
1
解决办法
1万
查看次数

一台Mac上有两个iOS开发人员许可证

在我的Mac上,我已经安装了所需的证书和密钥,通过我自己的iOS开发者许可证开发和分发我自己开发的iOS应用程序.但是,我的客户希望我使用他的许可证分发(Ad-Hoc)测试版并最终将应用程序分发到应用程序商店.

请问您能告诉我如何在我的Mac上安装他的开发者许可证,而不会影响我的个人开发者证书和Mac上已安装的密钥?

此外,这甚至可能吗?

编辑 - -

对不起,我没提到; 我不想在他的开发者帐户上撤销我客户的预先存在的证书.

certificate keychain iphone-developer-program ios

5
推荐指数
1
解决办法
1088
查看次数

在MySQL查询中使用第二个ORDER

我使用以下查询来选择指定纬度和经度的最近行.然后按距离排序结果,返回所选数据集中最近的行.

但是,我想按expiry_date字段对返回的最近行进行排序,以便对该数据集进行排序,以便我在最顶部(最近的到期日期)和最底部的最终结果.

请问你能告诉我怎么做?

提前致谢.

SELECT * , ( 6371 * ACOS( COS( RADIANS( latitude ) ) * COS( RADIANS( 51.61062 ) ) * COS( RADIANS( - 0.236952 ) - RADIANS( longitude ) ) + SIN( RADIANS( latitude ) ) * SIN( RADIANS( 51.61062 ) ) ) ) AS distance
FROM  `questions` 
WHERE  `expiry_date` > 
CURRENT_TIMESTAMP HAVING distance <=50000
ORDER BY distance
LIMIT 0 , 15
Run Code Online (Sandbox Code Playgroud)

mysql sql sql-order-by

5
推荐指数
2
解决办法
1万
查看次数

Show Redirecting In .. CountDown Timer PHP

到目前为止,我有这个代码,在5秒后将用户重定向到正确的URL:

<?php $url = $_GET['url']; header("refresh:5;url=$url"); include('ads.php'); ?>

请问你能告诉我怎样才能显示一个倒数计时器,说明重定向... ...是剩下的秒数.我是网络开发的新手,所以所有代码都会有所帮助!

javascript php redirect timer countdown

4
推荐指数
2
解决办法
2万
查看次数

CLLocation distanceFromLocation

我正在使用CLLocation来计算当前用户位置和注释的距离.但是我只是想知道这是否正确.我目前正在使用iPhone模拟器,根据MKMapView,iPhone模拟器位于:

Lat: 0 Long: -1067024384
Run Code Online (Sandbox Code Playgroud)

注释的位置是:

workingCoordinate.latitude = 40.763856;
workingCoordinate.longitude = -73.973034;
Run Code Online (Sandbox Code Playgroud)

但是,如果你看看谷歌地图,你会发现这些距离有多近,但根据CLLocation这么远.我使用以下代码来确定它们之间的距离.

CLLocation *loc = [[CLLocation alloc] initWithLatitude:annotation.coordinate.latitude longitude:annotation.coordinate.longitude];
CLLocation *loc2 = [[CLLocation alloc] initWithLatitude:self.mapView.userLocation.coordinate.latitude longitude:self.mapView.userLocation.coordinate.longitude];
CLLocationDistance dist = [loc distanceFromLocation:loc2];
int distance = dist
NSLog(@"%i", distance);
Run Code Online (Sandbox Code Playgroud)

NSLogged的距离是12769908.我认为这是不正确的,因此我的代码一定有问题.

如果有,请你指出来!

iphone xcode core-location mkmapview ios4

4
推荐指数
1
解决办法
2万
查看次数

如何使用ASIHTTPRequest(ASYNC)跟踪下载进度

我目前正在我的网站上使用异步调用我的API(我设置).我正在使用ASIHTTPRequest的setDownloadProgressDelegate和UIProgressView.但是我不知道如何调用一个选择器(updateProgress),它将把一个CGFloat'progress'设置为progressView的进度.我尝试了以下,但两个进展都是零.请问你能告诉我如何才能使这个工作?

(in some method)

ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:[NSURL URLWithString:[url stringByAppendingFormat:@"confidential"]]];
    [request setDownloadProgressDelegate:progressView];
    [NSTimer scheduledTimerWithTimeInterval:1.0f/60.0f target:self selector:@selector(updateProgress:) userInfo:nil repeats:YES];
    [request setCompletionBlock:^{~100 lines of code}];
    [request setFailedBlock:^{~2 lines of code :) }];
    [request startAsynchronous];

- (void) updateProgress:(NSTimer *)timer {
    if (progressView.progress < 1.0) {
        currentProgress = progressView.progress;
        NSLog(@"currProg: %f --- progressViewProg: %f", currentProgress, progressView.progress);
    }
    else {
        [timer invalidate];
    }
    return;
}
Run Code Online (Sandbox Code Playgroud)

iphone objective-c uiprogressview asihttprequest

4
推荐指数
1
解决办法
8081
查看次数

MySQL Query选择了太多行

我试图只选择和之间的差异,$from并按$to降序输出这些行.到目前为止的问题是我输入'5'作为$from值,'10'输入$to值,但它似乎输出10而不是5.

请问你能告诉我哪里出错了?

$query = mysql_query("SELECT * FROM `Posts` WHERE `isPublic` = 'yes' ORDER BY `date` DESC LIMIT $from,$to") or die(mysql_error());  
Run Code Online (Sandbox Code Playgroud)

php mysql

4
推荐指数
2
解决办法
813
查看次数

修剪PHP框架导致'无法打开页面'

我使用Slim PHP框架设置了一个REST API,它在使用请求时非常有效,即http://mysite.com/class/id.

但是当我导航到http://mysite.com/时,我在Safari中收到以下错误:

Safari无法打开"http://mysite.com/"页面.

错误是:"无法解码原始数据"(NSURLErrorDomain:-1015)

请选择Safari>向Apple报告错误,记下错误编号,并在看到此消息之前描述您的操作.

请问你能告诉我哪里出错了?

include_once('config.php');
require 'Slim/Slim.php';

$app = new Slim();

$app->post('/user/create', 'create_user');
$app->get('/user/:id', 'info_user');
$app->post('/user/:id', 'update_user');
$app->delete('/user/:id', 'delete_user');
$app->post('/user/validate', 'validate_user');
$app->get('/user/:id/venues', 'venues_user');
$app->get('/user/:id/queues', 'queues_user');

$app->post('/venue', 'create_venue');
$app->post('/venue/:id', 'update_venue');
$app->delete('/venue/:id', 'delete_venue');
$app->get('/venue/:id', 'info_venue');
$app->get('/venue/:id/queues', 'queues_venue');

$app->post('/queue', 'create_queue');
$app->post('/queue/:id', 'update_queue');
$app->delete('/queue/:id', 'delete_queue');
$app->get('/queue/:id', 'info_queue');

$app->run();
Run Code Online (Sandbox Code Playgroud)

php api safari slim

4
推荐指数
1
解决办法
794
查看次数

为什么要使用MySQL DB缓存?

我目前正在开发两个严重依赖MySQL数据库的iOS应用程序.它们每个都有自己的API,由相应的应用程序请求,它运行从MySQL数据库请求数据的相关查询.

查询不同于简单,用户或"对象":

SELECT `username`, `id`, `full_name` FROM `users` WHERE `id` = 1
INSERT INTO `users` (`full_name`, `username`, `email`, `password`, `signup_method`, `latitude`, `longitude`) VALUES (?, ?, ?, ?, ?, ?, ?)"
SELECT q.*, (SELECT COUNT(a.qid) FROM answers as a WHERE qid=q.id) AS a_count FROM questions as q ORDER BY a_count DESC LIMIT 1, 10
Run Code Online (Sandbox Code Playgroud)

基于位置:

SELECT ( 6371 * acos( cos( radians(?) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(?) ) + sin( radians(?) ) …
Run Code Online (Sandbox Code Playgroud)

php mysql database caching

4
推荐指数
1
解决办法
1289
查看次数

自定义标记图标未显示Google Static Maps v2

我正在使用Static Google Maps API v2下载地图视图的静态图像,其中只有一个标记显示一个图像.但是,添加到markerurl参数的图像似乎没有任何区别,只是在该位置显示了一个红色标记.

请问你能告诉我哪里出错了?

http://maps.googleapis.com/maps/api/staticmap
?center=37.446754,-77.572746
&size=70x61
&maptype=roadmap
&sensor=true
&scale=2
&zoom=15
&key=some_key
&markers=icon:https://foursquare.com/img/categories_v2/shops/financial_bg_64.png|37.446754,-77.572746
Run Code Online (Sandbox Code Playgroud)

google-maps httprequest google-maps-static-api

4
推荐指数
2
解决办法
6582
查看次数