我希望datepicker能够在我的wordpress模板页面中以某种形式出现,但它不起作用.
这是我的子主题函数的代码.php:
function modify_jquery() {
if (!is_admin()) {
// comment out the next two lines to load the local copy of jQuery
wp_deregister_script('jquery');
wp_register_script('jquery', 'http://ajax.googleapis.com/ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js', false, '2.1.1');
wp_enqueue_script('jquery');
}
}
add_action('init', 'modify_jquery');
function load_jquery_ui_google_cdn() {
global $wp_scripts;
wp_enqueue_script('jquery-ui-core');
wp_enqueue_script('jquery-ui-slider');
// get the jquery ui object
$queryui = $wp_scripts->query('jquery-ui-core');
// load the jquery ui theme
$urlui = "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.8/jquery-ui.min.js";
wp_enqueue_style('jquery-ui-smoothness', $urlui, false, null);
}
add_action('wp_enqueue_scripts', 'load_jquery_ui_google_cdn');
Run Code Online (Sandbox Code Playgroud)
然后我在page-mypage.php中这个:
<script>
$(function() {
$( "#datepicker" ).datepicker();
});
</script>
...other code...
Date: <input type="text" id="datepicker">
...other …
Run Code Online (Sandbox Code Playgroud) 我正在学习Java,我遇到了问题ListIterator
.我有一个包含这些字符的列表:buongiorn o.我的代码返回"buongiorno",而我期望它打印"buongiorn",没有尾随的"o".由于这个hasNext()
功能,我期待这个.我的代码使用递归.你能解释一下原因吗?
public static String creaStringa(List<Character> lista) {
System.out.println(lista.size());
ListIterator<Character> it = lista.listIterator();
return ricCrea(it);
}
public static String ricCrea(ListIterator<Character> it) {
if(!(it.hasNext())) {
return "";
else
return String.valueOf(it.next()) +ricCrea(it);
}
Run Code Online (Sandbox Code Playgroud) 我的网站经常失败,因为蜘蛛可以访问许多资源.这是主持人告诉我的.他们告诉我禁止这些IP地址:46.229.164.98 46.229.164.100 46.229.164.101
但我不知道如何做到这一点.
我已经google了一下,我现在已经将这些行添加到根目录中的.htaccess:
# allow all except those indicated here
<Files *>
order allow,deny
allow from all
deny from 46.229.164.98
deny from 46.229.164.100
deny from 46.229.164.101
</Files>
Run Code Online (Sandbox Code Playgroud)
这是100%正确吗?我能做什么?请帮我.我真的不知道该怎么办.
我正在使用线程,我希望一个线程读取一个字符串并将其返回到主线程,以便我可以在主线程中使用它。你能帮助我吗?这就是我所做的,但在输出中它显示了奇怪的字符:
线:
char *usr=malloc(sizeof(char)*10);
[...code...]
return (void*)usr;
Run Code Online (Sandbox Code Playgroud)
主要的:
[...code...]
char usr[10];
pthread_join(login,(void*)&usr);
printf("%s",usr);
Run Code Online (Sandbox Code Playgroud) 我对应该通过 Unix 上的 C 中的套接字写入/读取的字节数有一些疑问。我习惯于发送 1024 个字节,但有时当我发送短字符串时这真的太多了。
我从文件中读取了一个字符串,我不知道这个字符串有多少字节,它每次都可以变化,可以是 10、20 或 1000。我只知道它 < 1024。所以,当我编写代码,我不知道在客户端读取的字节大小,(在我可以使用的服务器上strlen()
)。那么,无论我从文件中读取的字符串的长度如何,始终读取最大字节数(在这种情况下为 1024)的唯一解决方案是什么?
例如,使用此代码:
read(socket,stringBuff,SIZE);
Run Code Online (Sandbox Code Playgroud)
SIZE
如果我想读取一个 10 字节的字符串,如果是 10 而不是 1024 不是更好吗?
我正在学习C 和TCP/UDP。正如标题... C 中的 inet_aton() 和 gethostbyname() 有什么区别吗?据我所知,两者都将 IP 地址从字符串转换为数字。
我正在尝试在 C 中设置客户端/服务器。我建立连接,然后我想向服务器发送用户名和密码,服务器必须回复确认他已收到 usr/pwd。问题是服务器和客户端一遇到“写”或“读”功能就退出。我应该怎么办?
服务器.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <netdb.h>
#include <signal.h>
void main(){
int ds_sock;
struct sockaddr_in my_addr;
ds_sock=socket(AF_INET,SOCK_STREAM,0);
memset(&my_addr,0,sizeof(my_addr));
my_addr.sin_family=AF_INET;
my_addr.sin_port=htons(25000);
my_addr.sin_addr.s_addr=INADDR_ANY;
if(bind(ds_sock,(struct sockaddr *)&my_addr,sizeof(my_addr))<0){
printf("error in bind");
}
listen(ds_sock,2);
int ds_sock_acc;
struct sockaddr_in addr;
size_t sin_size = sizeof(struct sockaddr_in);
signal(SIGCHLD,SIG_IGN);
while(1){
if((ds_sock_acc=accept(ds_sock,(struct sockaddr *)&addr,&sin_size))<1){
printf("error accept");
}
printf("connected");
char usr[10];
read(ds_sock,usr,10);
char* confirm_usr;
confirm_usr="Username received";
write(ds_sock,confirm_usr,100);
char pwd[10];
read(ds_sock,pwd,10);
char* confirm_pwd;
confirm_pwd="Password received";
write(ds_sock,confirm_pwd,100); …
Run Code Online (Sandbox Code Playgroud) 我对fgets有一些疑问。据我所知,它在字符串的末尾添加了“ \ n”,而不是“ \ 0”。因此,如果我编写这段代码:
fgets(buff,2,stdin);
printf("%s",buff);
Run Code Online (Sandbox Code Playgroud)
因此,fgets读取两个字符,我输入为“ y”,因此buff应该为“ y \ n”。我希望printf打印y并添加一行,而它打印“ y”而不添加一行。你能解释为什么吗?
假设我有一个包含这些列的表:
DATA1 | DATA2 | DATA3
Run Code Online (Sandbox Code Playgroud)
我想打印:DATA1 (DATA2)
如果 DATA2 不为空,则仅DATA1
当DATA2
为空时。如果我用 concat 来做:
SELECT CONCAT(DATA1," (",COALESCE(DATA2,""),")")
Run Code Online (Sandbox Code Playgroud)
我的问题是“(”和“)”总是被打印,即使 DATA2 为空,所以我将得到结果:DATA1 ()
而不是DATA1
有什么办法可以用 mysql 数据库上的 sql 来做到这一点吗?
我有一个用latin1_swedish_ci编码的数据库.我想知道插入<
和<
数据库之间的区别是什么?