我目前正在寻找一种方法来加载多个脚本/插件,而无需在标题中列出清单.
要简单地拥有一个load.js,所有加载对我来说都是非常优雅的.
$(function() {
var scripts = ['scripts/jquery1.5.js','scripts/easing.js','scripts/scroll.js','scripts/main.js'];
for(var i = 0; i < scripts.length; i++) {
$.getScript(scripts[i]);
}
})
Run Code Online (Sandbox Code Playgroud)
我目前有类似的东西,但由于某种原因无法让它工作.有任何想法吗?
这是我的代码
public class Main extends Activity {
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
LinearLayout rLinear=new LinearLayout(this);
rLinear.setId(200);
for (int c=0;c<5;c++)
{
ImageView imEdit = new ImageView(this);
imEdit.setId(300+c);
imEdit.setImageResource(R.drawable.a);
imEdit.setLayoutParams(new LayoutParams(36, 36));
rLinear.addView(imEdit);
}
}
}
Run Code Online (Sandbox Code Playgroud)
好吧,我有这个代码,我在运行时添加5个ImageView到线性布局,到目前为止一直很好,但我想做的是,当用户将手指滑过其中一个时,我想改变图像,所以我的问题是,我怎么知道用户手指下的当前图像视图是什么.
谢谢.
我的错误日志失控,出现以下两个错误
warning feof() expects parameter 1 to be resource
Run Code Online (Sandbox Code Playgroud)
和
warning fread() expects parameter 1 to be resource
Run Code Online (Sandbox Code Playgroud)
负责的代码是
<?php
$file = '../upload/files/' . $filex;
header("Content-Disposition: attachment; filename=" . urlencode($file));
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
header("Content-Description: File Transfer");
header("Content-Length: " . filesize($file));
flush(); // this doesn't really matter.
$fp = fopen($file, "r");
while (!feof($fp)) {
echo fread($fp, 65536);
flush(); // this is essential for large downloads
}
fclose($fp);
?>
Run Code Online (Sandbox Code Playgroud)
我使用这个代码进行标题下载,但它现在吓坏了 - 在任何人询问我尝试过之前,我试过google但仍然不完全理解错误消息.
Mysql错误日志旁边只有一个数字和它们的创建时间,我需要对其进行格式设置,以便它还包括日期,
我该怎么办?
130207 2:25:29 [Note] Plugin 'FEDERATED' is disabled.
130207 2:25:29 InnoDB: The InnoDB memory heap is disabled
130207 2:25:29 InnoDB: Mutexes and rw_locks use InnoDB's own implementation
130207 2:25:29 InnoDB: Compressed tables use zlib 1.2.3
130207 2:25:29 InnoDB: Using Linux native AIO
130207 2:25:30 InnoDB: Initializing buffer pool, size = 3.0G
130207 2:25:30 InnoDB: Completed initialization of buffer pool
130207 2:25:30 InnoDB: highest supported file format is Barracuda.
130207 2:25:30 InnoDB: Waiting for the background threads to start
Run Code Online (Sandbox Code Playgroud) #!/usr/bin/perl
use strict;
use DBI;
use Text::CSV_XS;
Run Code Online (Sandbox Code Playgroud)
每当我执行我的程序时,我都会收到以下错误.我已正确安装模块,但我不知道为什么会出现此错误.
Can't locate Text/CSV_XS.pm in @INC (@INC contains: /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi /usr/lib64/perl5/site_perl/5.8.7/x86_64-linux-thread-multi /usr/lib64/perl5/site_perl/5.8.6/x86_64-linux-thread-multi /usr/lib64/perl5/site_perl/5.8.5/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl/5.8.7 /usr/lib/perl5/site_perl/5.8.6 /usr/lib/perl5/site_perl/5.8.5 /usr/lib/perl5/site_perl /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi /usr/lib64/perl5/vendor_perl/5.8.7/x86_64-linux-thread-multi /usr/lib64/perl5/vendor_perl/5.8.6/x86_64-linux-thread-multi /usr/lib64/perl5/vendor_perl/5.8.5/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl/5.8.7 /usr/lib/perl5/vendor_perl/5.8.6 /usr/lib/perl5/vendor_perl/5.8.5 /usr/lib/perl5/vendor_perl /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/5.8.8 .) at /usr/WINAST/DHL/AGI/M_GET_AGENT_update.pl line 9.
BEGIN failed--compilation aborted at /usr/WINAST/DHL/AGI/M_GET_AGENT_update.pl
[root@localhost]# perldoc -l Text::CSV_XS.pm
/usr/local/lib/perl5/site_perl/5.8.8/x86_64-linux/Text/CSV_XS.pm
[root@localhost]# instmodsh
Available commands are:
l - List all installed modules
m <module> - Select a module
q - Quit the program
cmd? l
Installed modules are:
DBI
Date::Parse
DateTime::Format::DBI …Run Code Online (Sandbox Code Playgroud) 我想知道是否有人能帮助我解决我遇到的一个小的html/css问题.基本上,我正在尝试使用不同的图像为每个列表项的项目创建一个无序列表,并在同一行的右侧显示文本.更具体地说,顶行的标题和下面的一些普通文本.目前,我可以将图像和文本放在同一行:-(这是我的代码.
任何帮助将不胜感激.
HTML:
<ul>
<li class="service-list">
<a href=""><img src="image.png" alt="icon" class="alignnone size-full wp-image-156" /></a>
<h3>Header</h3>
<p>
text goes here
</P>
</li>
....
</ul>
Run Code Online (Sandbox Code Playgroud)
CSS:
.service-list {
list-style-type: none;
margin-left:0px;
padding-left:0px;
float: left;
display: inline-block;
}
.service-list p {
text-align: right;
margin: 0;
padding: 0;
}
Run Code Online (Sandbox Code Playgroud) 我不明白为什么__unset()不工作.
class myclass {
public $name = array();
public function __set($arraykey, $value){
$this->name[$arraykey] = $value;
}
public function __isset($argu){
return isset($this->name[$argu]);
}
public function __unset($argu){
echo "Working: Unset $this->name[$argu]";
unset($this->name[$argu]);
}
}
$obj = new myclass;
$obj->name = 'Arfan Haider';
var_dump(isset($obj->name));
unset($obj->name);
Run Code Online (Sandbox Code Playgroud)
我读到只要unset()调用该函数,就会__unset()自动调用Magic Method 并取消设置变量.
在上面的代码我使用unset但它没有调用__unset().为什么?我在理解魔术方法时遗漏了什么__unset()?
我想从选择中将数据插入到表中。到目前为止,这工作正常......
INSERT INTO table_2
SELECT t.id, 1
FROM table_1 t
WHERE t.title LIKE '%search%';
Run Code Online (Sandbox Code Playgroud)
但是当我第二次运行时,该语句引发异常,因为某些行已经存在。
我能做些什么来解决这个问题?
感谢您的帮助,乌克曼
var xmlhttp;
if (window.XMLHttpRequest) {
xmlhttp=new XMLHttpRequest();
}
else {
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("POST","test.php",true);
xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xmlhttp.send("abc=123");
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState==4 && xmlhttp.status==200) {
<?php if(isset($_POST['abc'])) {
$test123 = 'worked';
}
?>
}}
var worked = '<?php echo $test123;?>'; // <--- this is not working
Run Code Online (Sandbox Code Playgroud)
我怎样才能做到这一点?我不会在PHP中收到变量,无论是使用get还是post方法.
我试图弄清楚这个程序是如何工作的,我陷入了While循环,我不明白第二个循环如何退出,因为它v永远不会等于0或负数.既然这是唯一可以退出该循环的条件,还是我错过了更深层次的东西?代码将整数(> 0)转换为二进制.
public class Binary {
public static void main(String[] args) {
// read in the command-line argument
int n = Integer.parseInt(args[0]);
// set v to the largest power of two that is <= n
int v = 1;
while (v <= n/2) {
v = v * 2;
}
// check for presence of powers of 2 in n, from largest to smallest
while (v > 0) {
// v is not present in n
if (n …Run Code Online (Sandbox Code Playgroud) php ×3
html ×2
javascript ×2
ajax ×1
android ×1
binary ×1
css ×1
css3 ×1
html-lists ×1
java ×1
jquery ×1
list ×1
my.cnf ×1
mysql ×1
perl ×1
postgresql ×1
sql ×1
unset ×1
while-loop ×1