我想为谷歌浏览器/铬编写一个扩展(一个会话管理器,它比画廊中已有的具有更多的功能和吸引人的眼球)。
但我无法让以下代码工作:
function list_session() {
var list = [];
chrome.windows.getAll(
{"populate" : true},
function (window_list) {
for(window in window_list) {
list.concat(window.tabs);
}
}
);
console.log(list);
return list;
}
Run Code Online (Sandbox Code Playgroud)
这是使用 google api 的一个相当简单的示例,但我得到的不是选项卡列表,而是“未定义”值作为回报。此外,窗口列表似乎是空的。
我目前在 Ubuntu 10.10 下运行 Chromium 7.0.517.44 (64615)。我也尝试过 google 的官方 chrome 版本,结果相同。
API 文档可以在这里找到:http : //code.google.com/chrome/extensions/windows.html
菲尼亚斯
一个纯粹出于好奇心的问题.这显然是无效的语法:
foo = {}
foo['bar': 'baz']
Run Code Online (Sandbox Code Playgroud)
很明显发生了什么,开发人员从字典定义中移出一行,但没有将它从文字字典声明更改为赋值语法(并且已经适当地模拟了结果).
但我的问题是,为什么Python会TypeError: unhashable type在这里而不是SyntaxError?它试图散列的是什么类型?这样做:
'bar': 'baz'
Run Code Online (Sandbox Code Playgroud)
是一个SyntaxError,如下所示:
['bar': 'baz']
Run Code Online (Sandbox Code Playgroud)
所以我看不出什么类型的东西是不可用的.
<div id="test">
<input type="text" value="10" size="3">
<input type="text" value="0" size="3">
<input type="text" value="25" size="3">
<input type="text" value="0" size="3">
</div>
Run Code Online (Sandbox Code Playgroud)
我想要一个函数来获取输入的所有值.我正在尝试这个:
var inputs = $("test :input");
Run Code Online (Sandbox Code Playgroud)
但我不知道如何去那里,或者即使它是正确的.
谢谢
我有两个JTabbedPanes,JTabbedPane1和2如何在JTabbedPane2中按下按钮来显示JTabbedPane1?
以下是JTabbedPane的代码:
public class TabbedPane extends JFrame {
public TabbedPane() {
setTitle("Tabbed Pane");
setSize(300,300);
JTabbedPane jtp = new JTabbedPane();
getContentPane().add(jtp);
JPanel1 jp1 = new JPanel1();//This will create the first tab
JPanel jp2 = new JPanel2();//This will create the second tab
//add panel .........
//example usage
public static void main (String []args){
TabbedPane tab = new TabbedPane();
}
}
Run Code Online (Sandbox Code Playgroud)
这是类JPane1:
... JLabel label1 = new JLabel();
label1.setText("This is Tab 1");
jp1.add(label1);
Run Code Online (Sandbox Code Playgroud)
和类Jpane2与int上的按钮
JButton test = new JButton("Press"); jp2.add(测试);
ButtonHandler phandler = …Run Code Online (Sandbox Code Playgroud) 鉴于此查询:
select distinct subject_key
from mytable
Run Code Online (Sandbox Code Playgroud)
结果:
subject_key
-----------
90896959
90895823
90690171
90669265
90671321
Run Code Online (Sandbox Code Playgroud)
如何在Oracle中编写查询(使用Aqua Data Studio后端Oracle 8i)结果:
subject_key
-----------
90896959,
90895823,
90690171,
90669265,
90671321
Run Code Online (Sandbox Code Playgroud)
谢谢大家!我是否希望改变输出而不是如下所示.我怎么写它,同一个平台.谢谢.
subject_key
90896959, 90895823, 90690171, 90669265, 90671321
Run Code Online (Sandbox Code Playgroud) 要跟进这个问题:我发现一些结果与Sean McSomething所描述的非常不同:
我有一个大约300M行的表.
Select max(foo) from bar;大约需要15秒.跑步
Select foo from bar order by foo desc limit 1;需要3秒.跑步
Sean的陈述"看起来像MIN()是要走的路 - 在最坏的情况下它更快,在最好的情况下无法区分"只是不适用于这种情况......但我不知道为什么.任何人都可以提供解释吗?
编辑:因为我无法在这里显示表的结构:假设bar是ndb_cluster中没有关系的表,foo是没有索引的任意数据点.
我试图通过Java执行命令行参数.例如:
// Execute command
String command = "cmd /c start cmd.exe";
Process child = Runtime.getRuntime().exec(command);
// Get output stream to write from it
OutputStream out = child.getOutputStream();
out.write("cd C:/ /r/n".getBytes());
out.flush();
out.write("dir /r/n".getBytes());
out.close();
Run Code Online (Sandbox Code Playgroud)
以上打开命令行但不执行cd或dir.有任何想法吗?我正在运行Windows XP,JRE6.
(我已将我的问题修改为更具体.以下答案有帮助,但不回答我的问题.)
我正在我的页面上打开几个jQuery对话框,我正在使用:
$("#dialog2").parent().appendTo($("form:first")); //This was working, no problem.
Run Code Online (Sandbox Code Playgroud)
我注意到,当我再次将它应用于dialog3时,它已经停止了该对话框的工作.如何将它用于不同的对话框?
$("#dialog2").dialog({
bgiframe: false,
autoOpen: false,
height: 410,
width: 800,
modal: true,
draggable: true,
resizable: true
});
$("#dialog2").parent().appendTo($("form:first")); //doesn't work now
$("#dialog3").dialog({
bgiframe: false,
autoOpen: false,
height: 410,
width: 600,
modal: true,
draggable: true,
resizable: true
});
$("#dialog3").parent().appendTo($("form:first"));
Run Code Online (Sandbox Code Playgroud)
HTML:
<div id="dialog3" title="Attachments">
<p id="P1">
<asp:Button ID="btnAttach" runat="server" Text="Attach files" class="float-left ui-button"/></p>
<fieldset>
</fieldset>
</div>
<div id="dialog2" title="Notes">
<asp:Image ID="Image1" runat="server" ImageUrl="~/images/icons/user_comment.png" />
<asp:Label ID="Label1" runat="server" Font-Bold="True" Font-Size="Larger" Text="Notes"></asp:Label>
<br />
<div style="overflow: …Run Code Online (Sandbox Code Playgroud) 很多人遇到的问题是,当他们从 nautilus 启动 JAR 应用程序时,CWD(当前工作目录)被设置为他们的主文件夹(而不是 JAR 所在的文件夹)。这是 Nautilus 中的错误,尤其是 Linux。
如果您知道一个技巧可以更轻松地正确启动 Jar 而不是打开终端并在那里手动输入java -jar myJar.jar,请在下面发布。
谢谢
问题的简短代码示例:
File f = new File("ASimpleTextFile.txt");
System.out.println(f.getAbsolutePath());
Run Code Online (Sandbox Code Playgroud)
在 Windows 中,这会打印:[The Path To The Jar]/ASimpleTextFile.txt
但在 Linux 中,它会打印:/home/[yourName]/ASimpleTextFile.txt
这是一个非常糟糕的主意,因为我们经常使用配置文件的相对路径。这样,它们将不会被找到,因为文件指向主文件夹。
我已经创建了一个MSI Windows安装程序,它安装了一个插件,我为我办公室使用的一个软件编写了这个插件.但是,这里的许多用户对他们的计算机没有管理员权限,并且IT部门因为必须为他们安装插件而感到沮丧.
我的安装程序除了将几个文件复制到用户可以访问复制文件的位置之外什么都不做.有没有办法修改我的安装项目,以便生成的MSI不需要管理员权限?