小编JIN*_*AJI的帖子

未捕获的TypeError:.indexOf不是函数

我是JavaScript的新手,我收到如下错误.

未捕获的TypeError:time.indexOf不是函数

哎呀,我真的以为indexOf()确实是一个函数.这是我的代码片段:

    var timeofday = new Date().getHours() + (new Date().getMinutes()) / 60;
    document.getElementById("oset").innerHTML = timeD2C(timeofday);
</script>


<script>
 function timeD2C(time) { // Converts 11.5 (decimal) to 11:30 (colon)
    var pos = time.indexOf('.');
    var hrs = time.substr(1, pos - 1);
    var min = (time.substr(pos, 2)) * 60;

    if (hrs > 11) {
        hrs = (hrs - 12) + ":" + min + " PM";
    } else {
        hrs += ":" + min + " AM";
    }
    return hrs;
} …
Run Code Online (Sandbox Code Playgroud)

javascript function indexof

22
推荐指数
3
解决办法
10万
查看次数

如何使用大型 Excel 文件的 XSSF 和 SAX(事件 API)获取命名范围、工作表名称和参考公式的列表

我试图读取大型 Excel 文件(大小~10MB,.xlsx)。

我正在使用下面的代码

Workbook xmlworkbook =WorkbookFactory.create(OPCPackage.openOrCreate(root_path_name_file));
Run Code Online (Sandbox Code Playgroud)

但它显示堆内存问题。

我还在 StackOverflow 上看到了其他解决方案,其中一些解决方案是为了增加 JVM,但我不想增加 jvm。

问题1)我们不能使用,SXSSF (Streaming Usermodel API)因为这仅用于编写或创建新的工作簿。

我的唯一目标是获取大型 Excel 文件的工作表 NamedRange 数量、工作表总数及其工作表名称。

excel apache-poi

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

使用计划任务使用PHP服务器脚本进行iOS推送通知

我正在为Apple设备实现推送通知服务。使用php脚本,仅当php脚本从浏览器中命中时,它才推送通知。当我通过浏览器点击服务器php脚本时,它将通知推送到Apple设备。我的PHP脚本是...

//在Apple设备中发送通知的方法的结尾

function sendNotificationToAppleDevice($token,$message)
    {
    /////////////////////////////////////////////For apple divice////////////////////////////////

$passphrase='1234';
// Create a stream to the server
$streamContext = stream_context_create();
stream_context_set_option($streamContext, 'ssl', 'local_cert', 'sample.pem');
stream_context_set_option($streamContext, 'ssl', 'passphrase', $passphrase);

$apns = stream_socket_client( 'ssl://gateway.sandbox.push.apple.com:2195', $error,$errorString,60,STREAM_CLIENT_CONNECT, $streamContext);

// You can access the errors using the variables $error and $errorString


// Now we need to create JSON which can be sent to APNS
        $inc=0;                  
$load = array(
'aps' => array(
'alert' => $message,
'badge' =>$inc,
)
);
$inc++;
$payload = json_encode($load);
// The payload needs …
Run Code Online (Sandbox Code Playgroud)

cron push-notification ios

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

从逗号分隔的字符串中读取每个字符串,并使用jQuery将其显示在html列表中

我有一串字如下:home,apple,banana,music,sound。在这里,每个单词都用逗号(',')分隔。 如何使用jQuery从该字符串中提取每个逗号分隔的元素并将其显示在html列表上,如下所示?

<ul>
<li>home</li>
<li>apple</li>
<li>banana</li>
<li>music</li>
<li>sound</li>
</ul>
Run Code Online (Sandbox Code Playgroud)

jquery html5

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