小编koi*_*ose的帖子

bootstrap popover:高级定位

我正在尝试为一个触发器定位一个twitter-bootstrap popover,该触发器位于960px宽网页的最右上角.理想情况下,我将它放在底部并用CSS移动箭头(因此箭头位于弹出窗口的右上角).

不幸的是,"放置":"底部"定位是不够的,因为它会将其置于触发器下方.

我正在寻找能够将弹出窗口静态放置在触发器左下方的解决方案.我读了很多问题,却找不到任何问题.

提示?

javascript css css-position popover twitter-bootstrap

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

Twitter Bootstrap scrollspy总是选择最后一个元素

我有一个卷轴问题,在这个小提琴中重新创建:http: //jsfiddle.net/jNXvG/3/

如演示所示,无论滚动位置如何,ScrollSpy插件始终会保留最后一个菜单项.我已经阅读了其他问题和答案,尝试了不同的组合offset等,但没有一个有帮助.我无法弄清楚出了什么问题.

我不想编辑我的模板以包含丑陋的html'数据'标签,所以我scrollspy()通过JavaScript 调用来激活插件.

下一步是删除固定内容高度并使用侧栏上的"附加".

javascript jquery-plugins twitter-bootstrap

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

这是PHP中的一个很好的哈希密码函数吗?如果没有,为什么不呢?

我想知道这个功能(部分取自~2岁的phpBB版本)是否足够好.

如果没有,为什么?
您将如何更改它(使现有用户无缝转换)?

hash_pwd()的结果将保存在DB中.

function hash_pwd($password)
{
    $itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';

    $random_state = $this->unique_id();
    $random = '';
    $count = 6;

    if (($fh = @fopen('/dev/urandom', 'rb')))
    {
        $random = fread($fh, $count);
        fclose($fh);
    }

    if (strlen($random) < $count)
    {
        $random = '';

        for ($i = 0; $i < $count; $i += 16)
        {
            $random_state = md5($this->unique_id() . $random_state);
            $random .= pack('H*', md5($random_state));
        }
        $random = substr($random, 0, $count);
    }

    $hash = $this->_hash_crypt_private($password, $this->_hash_gensalt_private($random, $itoa64), $itoa64);

    if (strlen($hash) == 34)
    {
        return $hash;
    } …
Run Code Online (Sandbox Code Playgroud)

php security passwords cryptography password-hash

22
推荐指数
2
解决办法
2695
查看次数

CLLocationManager Singleton - 这是要走的路吗?

我正在构建一个具有两个简单视图的应用程序(在tabbar中).

  • 第一个视图:它应显示用户的位置(默认蓝点)并从服务器加载数据.
  • 第二个视图:它应该显示用户的位置(我的自定义引脚带有注释和标注).用户可以点击标注并提交有关当前位置的数据.

我开始使用MKMapView的showsUserLocation.然后我读到最好使用CLLocationManager单例实例,所以我粗略地关注了这篇博文:http://jinru.wordpress.com/2010/08/15/singletons-in-objective-c-an-example-of -cllocationmanager /

现在这几乎可行,但我想知道这是否是正确的做事方式.

此外,我找不到显示默认蓝点而不是自定义引脚的方法.我读过我应该使用MKMapView的showsUserLocation,但是不会创建另一个CLLocationManager实例吗?

谢谢

mkmapview cllocationmanager ios

12
推荐指数
1
解决办法
4151
查看次数

bootstrap popover:用ajax重新加载内容

我在使用ajax重新加载bootstrap popover的内容时遇到问题.这是一些代码:http://pastie.org/3960102

第二个ajax请求(当我点击"a.close"时)返回一个更新的内容(我可以在控制台中看到它),但它没有加载到popover中.

我四处寻找解决方案,但似乎都没有.

我还能尝试什么?谢谢

ajax jquery popover twitter-bootstrap

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

单个Google Compute Engine实例上的多个IP地址

我正在尝试让我的GCE实例监听多个IP地址(出于搜索引擎优化的原因 - 在同一个实例上托管多个低流量站点).

最终目标:mydomain.com指向IP1,myotherdomain.es指向IP2,GCE实例将侦听IP1和IP2并相应地提供内容.

我添加了一个指向我的主实例的目标实例,并设法创建这样的转发规则:

gcloud compute forwarding-rules create another-ip --port 80 --target-instance MY_TARGET_INSTANCE_URL
Run Code Online (Sandbox Code Playgroud)

它实际上创建了一个短暂的IP地址; 我试图将它推广到静态但我超过了我的配额(我目前正在进行为期2个月的免费试用).

这是正确的吗?我可以创建任意数量的静态IP,并在试用期结束后将它们指向我唯一的实例吗?我也找不到任何关于定价的信息:我知道分配给活动实例的IP是免费的,但是其他的呢?

由于这是我正在管理的网站的必要配置,我希望确保它在承诺在GCE上移动所有内容之前有效.

google-compute-engine

8
推荐指数
1
解决办法
6246
查看次数

更新用户位置或使用默认值时刷新MKMapView

我正在尝试刷新我的地图视图,并在设备获取用户位置时从服务器加载新数据.这是我正在做的事情:

- (void)viewDidLoad {
    CGRect bounds = self.view.bounds;
    mapView = [[MKMapView alloc] initWithFrame:bounds];
    mapView.showsUserLocation=YES;
    mapView.delegate=self;
    [self.view insertSubview:mapView atIndex:0];
    [self refreshMap];
}

- (void)mapView:(MKMapView *)theMapView didUpdateUserLocation:(MKUserLocation *)userLocation
{
    //this is to avoid frequent updates, I just need one position and don't need to continuously track the user's location
    if (userLocation.location.horizontalAccuracy > self.myUserLocation.location.horizontalAccuracy) {
        self.myUserLocation = userLocation;
        CLLocationCoordinate2D centerCoord = { userLocation.location.coordinate.latitude, userLocation.location.coordinate.longitude };
        [theMapView setCenterCoordinate:centerCoord zoomLevel:10 animated:YES];
        [self refreshMap];
    }
}

- (void)refreshMap {
    [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];
    [self.mapView removeAnnotations:self.mapView.annotations];
    //default position …
Run Code Online (Sandbox Code Playgroud)

annotations refresh mkmapview ios

6
推荐指数
1
解决办法
5264
查看次数

使用 ffmpeg 输出具有正确宽高比的图像

我有一个具有以下属性的 mkv 视频(通过 mediainfo 获得):

Width                                    : 718 pixels
Height                                   : 432 pixels
Display aspect ratio                     : 2.35:1
Original display aspect ratio            : 2.35:1
Run Code Online (Sandbox Code Playgroud)

我想在特定时间截取它的屏幕截图:

ffmpeg -ss 4212 -i filename.mkv -frames:v 1 -q:v 2 out.jpg
Run Code Online (Sandbox Code Playgroud)

这将生成 718x432 jpg 图像,但纵横比错误(图像被水平“挤压”)。AFAIK,输出图像应为 1015*432(宽度=高度 * DAR)。这个计算正确吗?

有没有办法让 ffmpeg 为所有视频输出具有正确尺寸/AR 的图像(即没有“硬编码”值)?我尝试使用 setdar/setsar 过滤器但没有成功。

另外,出于好奇,尝试使用 ffmpeg 获取 SAR 和 DAR 会产生:

Stream #0:0(eng): Video: h264 (High), yuv420p(tv, smpte170m/smpte170m/bt709, progressive),
718x432 [SAR 64:45 DAR 2872:1215], SAR 155:109 DAR 55645:23544, 24.99 fps, 24.99 tbr, 1k tbn, 49.98 tbc …
Run Code Online (Sandbox Code Playgroud)

ffmpeg

3
推荐指数
1
解决办法
2414
查看次数

setNetworkActivityIndi​​catorVisible微调器不显示

正如标题所说,这是一些代码:

- (void)refreshMap {
    NSLog(@"refreshing");
    [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];
    lat = [[NSNumber numberWithDouble:myUserLocation.coordinate.latitude] stringValue];
    lon = [[NSNumber numberWithDouble:myUserLocation.coordinate.longitude] stringValue];

    NSString *url = [[NSString alloc] initWithFormat:@"http://mywebsite.com/geo_search.json?lat=%@&lon=%@", lat, lon];
    NSURLRequest *theRequest=[NSURLRequest requestWithURL:[NSURL URLWithString:url]
                                              cachePolicy:NSURLRequestUseProtocolCachePolicy
                                          timeoutInterval:60.0];
    [[NSURLConnection alloc] initWithRequest:theRequest delegate:self];
    [url release];
    [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
}
Run Code Online (Sandbox Code Playgroud)

网络活动指示器(在状态栏中)根本不显示(不在模拟器中,也不在真实设备上).我该如何解决这个问题?

nsurlconnection uiapplication ios

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