我刚刚运行了下面的脚本,它将JDK取出并解压缩到正确的位置.问题是每个java
命令(复制到/ urs/bin)都会出错.然后我通过cd
(我现在在JDK/bin中)进入JDK安装目录并输入:./java -version
并获取:./java: No such file or directory
,但是java
在那里进行双重检查!ls -l
在JDK上显示所有java
客户端都在bin中.
#!/bin/bash
#Author: Yucca Nel http://thejarbar.org
#Will restart system
#Modify these variables as needed...
tempWork=/tmp/work
locBin=/usr/local/bin
javaUsrLib=/usr/lib/jvm
sudo mkdir -p $javaUsrLib
mkdir -p $tempWork
cd $tempWork
#Update this line to reflect newer versions of JDK...
wget http://download.oracle.com/otn-pub/java/jdk/7u2-b13/jdk-7u2-linux-i586.tar.gz
#Extract the download
tar -zxvf $tempWork/*
#Move it to where it can be found...
sudo mv -f …
Run Code Online (Sandbox Code Playgroud) 我没有任何面向我语言的调试工具的经验,但我最近发现了一些展示Firebug的视频.
我现在在一个脚本中使用Firebug,其中包含一个错误.
我目前的理解是:
但我不明白:
Continue
,Step Into
,Step Over
和Step Out
?
对我来说,Step Over有时类似于Step Into ...我在这里可能是错的.
如果您能解释4个选项的差异,或者更深入地解释这些选项的链接,我将不胜感激.
我用ProGuard混淆了我的Android应用程序,当我试图运行我的混淆.apk时它抛出:
java.lang.nosuchfielderror:吐司
这是我的proguard.cfg文件:
<!-- language: lang-none -->
-injars bin/classes //injars
-injars libs //injars
-outjars bin/classes-processed.jar
-optimizationpasses 1
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-allowaccessmodification
-keepattributes *Annotation*
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
-printmapping D:/out.map
-renamesourcefileattribute ProGuard
-keepattributes Exceptions,InnerClasses,Signature,Deprecated,
SourceFile,LineNumberTable,*Annotation*,EnclosingMethod
-libraryjars C:/Program Files/Android/android-sdk/platforms/android
12/android.jar
-dontwarn android.support.**
-dontwarn com.android.**
-dontwarn com.google.**
-dontwarn org.apache.**
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends …
Run Code Online (Sandbox Code Playgroud) 我想使用Javascript(而不是jquery)来访问<ul>
列表中的所有项目,并从除我选择的菜单项之外的所有内容中删除活动类.
这是清单:
<ul id='flash-menu'>
<li id="menu1" class='something active'>item 1</li>
<li id="menu2" class='somethingelse'>item 2</li>
<li id="menu3" class='somethingelse'>item 3</li>
</ul>
Run Code Online (Sandbox Code Playgroud)
这是我的javascript:
function updateMenu(view_name) {
var list_items = document.getElementById('flash-menu').childNodes;
for (var i=0 ; i<list_items.length ; i++){
list_items[i].className = list_items[i].className.replace('/\bactive\b/','');
}
document.getElementById(view_name).className += " active";
}
Run Code Online (Sandbox Code Playgroud)
Javascript的最后一行(添加活动类)有效,但我不认为我正在访问列表项以从其他项中删除类.有什么建议?- 谢谢!
我知道使用timedelta函数你可以使用类似的东西将秒转换为h:m:s:
>> import datetime
>> str(datetime.timedelta(seconds=666))
'0:11:06'
Run Code Online (Sandbox Code Playgroud)
但我需要将h:m:s转换为秒或分钟.
你知道一个可以做到这一点的功能吗?
我想添加对我创建的表的排序支持.
当使用item:TR时,我实现的占位符在IE 7中根本不起作用.它在FF中运行正常.
我已经尝试了代码<UL\>
并且它正确执行.它似乎特定于表格和
我通过论坛进行了研究,似乎没有很多人使用表格排序:
<style type="text/css">
.dndPlaceHolder
{
background-color:Red ;
color:Red;
height: 20px;
line-height:30px;
border: solid 2px black;
}
.dndItem
{
background-color: #c0c0c0;
border:solid 1px black;
padding:5px;
}
</style>
<script type="text/javascript" >
$(function() {
$("#myTable").sortable(
{
placeholder:'dndPlaceHolder',
distance:15,
items:'tr',
forcePlaceholderSize:true,
change : dndChange,
update : dndUpdate
});
$("#myTable").disableSelection();
$("#myList").sortable(
{
placeholder:'dndPlaceHolder',
distance:15,
items:'li',
forcePlaceholderSize:true,
change : dndChange,
update : dndUpdate
});
$("#myList").disableSelection();
});
function dndChange(event,ui){
}
function dndUpdate(event,ui){
var msg = '';
}
</script>
<table id='myTable' > …
Run Code Online (Sandbox Code Playgroud) 我想制作一个将数据发布到我的电子邮件的表单.
我找到了以下代码,它工作正常,但我想删除一些不需要的字段.例如,如何在不破坏工作代码的情况下删除"姓氏"和"电子邮件"字段?
HTML:
<html>
<head>
<title>?????</title>
</head>
<body>
<form name="contactform" method="post" action="send_form_email.php">
<table width="450px">
<tr>
<td valign="top">
<label for="first_name">Name *</label>
</td>
<td valign="top">
<input type="text" name="first_name" maxlength="50" size="30">
</td>
</tr>
<tr>
<td valign="top">
<label for="telephone">Phone number</label>
</td>
<td valign="top">
<input type="text" name="telephone" maxlength="30" size="30">
</td>
</tr>
<tr>
<td valign="top">
<label for="comments">Comments *</label>
</td>
<td valign="top">
<textarea name="comments" maxlength="1000" cols="25" rows="6"></textarea>
</td>
</tr>
<tr>
<td colspan="2" style="text-align:center">
<input type="submit" value="Send">
</td>
</tr>
</table>
</form>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
PHP:
<?php
if(isset($_POST['email'])) {
// …
Run Code Online (Sandbox Code Playgroud) 在昨晚阅读jQuery Cookbook(Oreilly)的同时,我遇到了一个问题,这个问题似乎无法在书中找到答案,或者在网上找到答案.我在jQuery网站上找到了我用于此问题的代码,我在下面将其作为参考:
<script>
$(document.body).click(function () {
$("div").each(function (i) { //Where does the 'i' come from?
if (this.style.color != "blue") {
this.style.color = "blue";
} else {
this.style.color = "";
}
});
});
</script>
Run Code Online (Sandbox Code Playgroud)
我想知道'i'参数的起源和目的,因为我没有看到它来自哪里(客户端代码)以及它用于什么?作为一个Java人,我会更熟悉这个概念,因为我熟悉Java中的方法或"函数"参数.
在这里,我没有看到客户端代码(我认为它在库中)并且我没有看到它(/ i
)在函数中是如何相关的,因为它没有被引用.
来自社区的人是否可以为此做出明确的解释或者请参考我的指南?
我理解每个函数的目的和'this'参考,所以你不需要解释这些,除非你觉得它与这个问题的未来观众有关.
我试图交换两个按钮的位置.我的交换代码看起来是:
private void exchangeButtons(Button btn1, Button btn2) {
// Create the animation set
AnimationSet exchangeAnimation = new AnimationSet(true);
TranslateAnimation translate = new TranslateAnimation(
Animation.RELATIVE_TO_SELF, btn2.getLeft(),
Animation.RELATIVE_TO_SELF, btn1.getLeft(),
Animation.RELATIVE_TO_SELF, btn2.getRight(),
Animation.RELATIVE_TO_SELF, btn1.getRight());
translate.setDuration(500);
exchangeAnimation.addAnimation(translate);
//int fromX = btn1.getLeft();
//int fromY = btn1.getRight();
//int toX = btn2.getLeft();
//int toY = btn2.getRight();
Log.d("ArrangeMe",
"view1 pos:" + btn1.getLeft() + ",
" +btn1.getRight() + "view2 pos:" +
btn2.getLeft() + ", " + btn2.getRight());
AnimationSet exchangeAnimation1 = new AnimationSet(true);
TranslateAnimation translate1 = new TranslateAnimation(
Animation.RELATIVE_TO_SELF, btn1.getLeft(), …
Run Code Online (Sandbox Code Playgroud) 关于内存效率,我有以下问题:
必须将正确的数据类型用于相应的变量.将数值表示1
为a byte
需要内存的八分之一(但如果我错了,请纠正我).我的问题是,如果在定义变量类型或初始化时发生内存分配/推导?这可能看起来很奇怪,但我要求关于不需要初始化的全局变量,因为它们具有与局部变量相关的默认值.我还想知道对象数据类型是否有默认大小?我认为这是基于JVM(32位对64位)?