我有一个代码,将小写字母转换为大写但它只适用于IE而不是Crome或Firefox.
function ChangeToUpper()
{
key = window.event.which || window.event.keyCode;
if ((key > 0x60) && (key < 0x7B))
window.event.keyCode = key-0x20;
}
<asp:TextBox ID="txtJobId" runat="server" MaxLength="10" onKeypress="ChangeToUpper();"></asp:TextBox>
Run Code Online (Sandbox Code Playgroud)
即使我尝试过
document.getElementById("txtJobId").value=document.getElementById("txtJobId").value.toUpperCase();
Run Code Online (Sandbox Code Playgroud)
onBlur文本框的事件
我该怎么做才能让它在所有浏览器中都能运行?
谢谢
如何编写postgresql查询以从表中仅获取timestamp字段的日期部分
朋友们,
我有三个线性布局按钮,宽度为fill_parent
现在我如何设置这些按钮的宽度以平均覆盖整个屏幕区域?
任何帮助都会得到满足.
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/btnReplyMessage"
android:gravity="left"
android:text="Reply"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/btnMarkAsUnread"
android:gravity="left"
android:text="Mark as unread"
/>
<ImageButton
android:id="@+id/btnDeleteMessage"
android:src="@drawable/imgsearch"
android:gravity="right"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_alignParentRight="true"
/>
Run Code Online (Sandbox Code Playgroud) 首先,我的最新编码是Java,我不想"用C++编写Java".
这是交易,我必须创建一个不可变的类.这很简单.唯一的问题是获得初始值是一些工作.所以我不能简单地调用初始化来初始化我的成员.
那么创建这样一个类的最佳方法是什么?如何在C++标准中将我的不可变/最终属性暴露给外界?
这是一个示例类:
class Msg {
private:
int _rec_num;
int _seq;
string text;
public:
Msg(const char* buffer) {
// parse the buffer and get our member here...
// ... lots of code
}
// does this look like proper C++?
int get_rec_num() { return _rec_num; }
};
Run Code Online (Sandbox Code Playgroud) class A(object):
def __init__(self, a, b, c):
#super(A, self).__init__()
super(self.__class__, self).__init__()
class B(A):
def __init__(self, b, c):
print super(B, self)
print super(self.__class__, self)
#super(B, self).__init__(1, b, c)
super(self.__class__, self).__init__(1, b, c)
class C(B):
def __init__(self, c):
#super(C, self).__init__(2, c)
super(self.__class__, self).__init__(2, c)
C(3)
Run Code Online (Sandbox Code Playgroud)
在上面的代码中,注释掉的__init__
调用看起来是进行超类初始化的普遍接受的"智能"方式.但是,如果类层次结构可能会发生变化,我一直在使用未注释的表单,直到最近.
看来,在B
上面层次结构中对超级构造函数的B.__init__
调用,再次调用,self.__class__
实际上C
并不B
像我一直假设的那样.
在Python-2.x中是否有某些方法可以在调用超级构造函数时保持正确的MRO(关于以正确的顺序初始化所有父类),而不是命名当前类(B
in in super(B, self).__init__(1, b, c)
)?
我有这种格式的日期:
24-12-2010 // DAY - MONTH - YEAR
Run Code Online (Sandbox Code Playgroud)
我需要以这种格式得到它:
1995-12-31T23:59:59.999Z // The Z is for the TimeZone I think.
Run Code Online (Sandbox Code Playgroud)
检查此链接:
http://lucene.apache.org/solr/api/org/apache/solr/schema/DateField.html
以上链接是我需要日期的方式.
我现在正在使用PHP,所以这需要使用PHP.如何以最简单的方式转换这些日期?
谢谢
我刚刚安装了Mercurial的最新1.4.3版本,并查看了未知/修改过的文件的新状态消息.
以前的版本显示了修改后的文件:
M README.txt
Run Code Online (Sandbox Code Playgroud)
这个新版本显示了一些乱码:
?[0;32;1m file.txt?[0m
Run Code Online (Sandbox Code Playgroud)
这是什么以及如何解释它?
此外,是否有可能恢复到旧式符号?
解:
如果您碰巧在Windows上启用了"颜色"插件,那么您将获得以上行为.在我评论'color'插件后,一切都恢复正常.
让die()生活在生产环境中被认为是不好的做法吗?刚刚读过这篇文章http://www.phpfreaks.com/blog/or-die-must-die,作者对在生产环境中使用这类东西的人进行了抨击.所以我不应该这样编码:
$connection = mysql_connect($db_host, $db_username, $db_password);
if (!$connection){
die ("Could not connect to the database.");
}
Run Code Online (Sandbox Code Playgroud)
你怎么编码?
mysql ×2
php ×2
sql ×2
android ×1
blackberry ×1
c++ ×1
class-design ×1
constructor ×1
datetime ×1
eclipse ×1
html ×1
javascript ×1
layout ×1
llvm ×1
mercurial ×1
postgresql ×1
python ×1
python-2.x ×1
super ×1