小编chr*_*tfr的帖子

IE9中的占位符

这似乎是一个众所周知的问题,但我在Google上找到的所有解决方案都不适用于我新下载的IE9.

为了Placeholderinputtextarea标签上启用属性,您最喜欢哪种方式?

可选:我在这上面浪费了很多时间,但还没有寻找required房产.你也对此有一些建议吗?显然我可以检查PHP中的值,但是为了帮助用户这个属性非常方便.

html javascript html5 placeholder internet-explorer-9

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

检测服务器端的视网膜(HD)显示

我发现了许多关于Retina Display的问题,但没有一个答案是在服务器端.

我想根据屏幕提供不同的图像,ex(在PHP中):

if( $is_retina)
    $thumbnail = get_image( $item_photo, 'thumbnail_retina' ) ;
else
    $thumbnail = get_image( $item_photo, 'thumbnail' ) ;
Run Code Online (Sandbox Code Playgroud)

你能看到解决这个问题的方法吗?

我只能想象在JavaScript中进行测试,设置Cookie.然而,这需要初始交换来设置它.谁有更好的解决方案?

Cookie设置代码:

(function(){
  if( document.cookie.indexOf('device_pixel_ratio') == -1
      && 'devicePixelRatio' in window
      && window.devicePixelRatio == 2 ){

    document.cookie = 'device_pixel_ratio=' + window.devicePixelRatio + ';';
    window.location.reload();
  }
})();
Run Code Online (Sandbox Code Playgroud)

php retina-display

20
推荐指数
2
解决办法
9881
查看次数

在iOS/iPhone上冻结正常运行时间

有人会知道为什么我用以下方法经历了奇怪的正常运行时间吗?

NSProcessInfo *processInfo = [NSProcessInfo processInfo];
NSTimeInterval systemUptime = [processInfo systemUptime];
Run Code Online (Sandbox Code Playgroud)

第一分钟,一切看起来都很好,但是当我回到应用程序上几小时或几天后,正常运行时间仍然是相同的:30分钟,或1小时34分...它似乎随机冻结.主要在iPhone 4上(很少在模拟器或iPad上)

它可能与我的展示方式有关:

+ (NSTimeInterval)uptime:(NSNumber **)days hours:(NSNumber **)hours mins:(NSNumber **)mins
{
    NSProcessInfo *processInfo = [NSProcessInfo processInfo];
        //START UPTIME///////
    NSTimeInterval systemUptime = [processInfo systemUptime];
        // Get the system calendar
    NSCalendar *sysCalendar = [NSCalendar currentCalendar];
        // Create the NSDates
    NSDate *date = [[NSDate alloc] initWithTimeIntervalSinceNow:(0-systemUptime)]; 
    unsigned int unitFlags = NSDayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit;
    NSDateComponents *c = [sysCalendar components:unitFlags fromDate:date toDate:[NSDate date]  options:0]; 
        //NSString *uptimeString = [NSString stringWithFormat:@"%dd %dh %dmin", [c …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c ipad ios

6
推荐指数
2
解决办法
3444
查看次数

获取 AWS 区域的英文名称

我找不到使用 AWS CLI 检索区域英文名称的方法。任何想法?

我需要在Linux的命令行输出中生成下表中所有AWS区域的英文名称。

'ap-northeast-1' => 'Asia Pacific (Tokyo)',
'ap-southeast-1' => 'Asia Pacific (Singapore)',
'ap-southeast-2' => 'Asia Pacific (Sydney)',
'eu-central-1'   => 'EU (Frankfurt)',
'eu-west-1'      => 'EU (Ireland)',
'sa-east-1'      => 'South America (Sao Paulo)',
'us-east-1'      => 'US East (N. Virginia)',
'us-east-2'      => 'US East (Ohio)',
'us-west-1'      => 'US West (N. California)',
'us-west-2'      => 'US West (Oregon)',
'eu-west-2'      => 'EU (London)',
'ca-central-1'   => 'Canada (Central)',
'sa-east-1'      => 'South America (Sao Paulo)',
Run Code Online (Sandbox Code Playgroud)

我不是 Linux VM 的管理员,无法安装 Java。

bash amazon-web-services aws-cli

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

如何在出现第一个错误时停止 Cloud-init

当我使用 Cloud-init 启动 Linux 服务器时,我有一些脚本,/etc/cloud/cloud.cfg.d/它们按相反的字母顺序运行

# ll /etc/cloud/cloud.cfg.d/
total 28
-rw-r--r-- 1 root root  173 Dec 10 12:38 00-cloudinit-lifecycle-hook.cfg
-rw-r--r-- 1 root root 2120 Jun  1  2021 05_logging.cfg
-rw-r--r-- 1 root root  590 Oct 26 17:55 10_aws_yumvars.cfg
-rw-r--r-- 1 root root   29 Dec  1 18:22 20_amazonlinux_repo_https.cfg
-rw-r--r-- 1 root root  586 Dec 10 12:38 50-cloudinit-tomcat.cfg
-rw-r--r-- 1 root root  585 Dec 10 12:40 60-cloudinit-newrelic.cfg
Run Code Online (Sandbox Code Playgroud)

最后执行的是00-cloudinit-lifecycle-hook.cfg,我使用 .txt 文件完成 Auto Scaling 组的生命周期CONTINUE。如果 ASG 在给定超时后未收到此信号,则它会失败。

问题是,即使出现错误50-cloudinit-tomcat.cfg …

provisioning configuration-management cloud-init

5
推荐指数
0
解决办法
1004
查看次数