我有一个奇怪的问题.我的postgresql(8.3)的大小正在增加.所以我做了一个转储,然后清理了数据库,然后重新导入了转储.数据库大小减少了大约50%.
一些信息:(1)AUTOVACUUM和REINDEX在后台定期运行.(2)数据库编码是ASCII.(3)数据库位置:/ database/pgsql/data(4)系统:Suse-Ent.10.
任何提示都表示赞赏
我有一个温度传感器,该温度传感器使用USB-I2C适配器(http://www.robot-electronics.co.uk/htm/usb_i2c_tech.htm)连接,并将该设备连接到linux计算机(suse10)。我输入dmesg并看到
usb 3-3: new full speed USB device using ohci_hcd and address 10
usb 3-3: new device found, idVendor=0403, idProduct=6001
usb 3-3: new device strings: Mfr=1, Product=2, SerialNumber=3
usb 3-3: Product: FT232R USB UART
usb 3-3: Manufacturer: FTDI
usb 3-3: SerialNumber: A7007K93
usb 3-3: configuration #1 chosen from 1 choice
ftdi_sio 3-3:1.0: FTDI USB Serial Device converter detected
drivers/usb/serial/ftdi_sio.c: Detected FT232BM
usb 3-3: FTDI USB Serial Device converter now attached to ttyUSB0
Run Code Online (Sandbox Code Playgroud)
但是我不知道如何读取当前温度。
更新1:实际上,I2C总线最多可以连接127个传感器。但是我不知道如何列出可用传感器的地址。
有人可以给我一些提示吗?提前致谢
我在代码中写了几个"assert(...)",以确保满足前置条件和后置条件.我们可以告诉Delphi编译器,是否在调试版本中使用断言进行编译,而在发布版本中没有断言.
我想知道,如果有可能,像其他Pascal关键字一样突出"断言"?
我的Windows应用程序有一个标签界面.每个选项卡都会呈现一些UI内容.众所周知,如果我在主线程中进行非常耗时的for循环而不让其他人处理任何Windows消息,那么应用程序将被冻结.在冻结期间,我无法切换标签.
我受到了谷歌Chrome的多进程架构的启发.我尝试使用SetParent到嵌入过程到另一个过程.更具体一点:流程A是主人.它可以创建无限的工作流程.每个工作进程都有自己的消息循环.如果进程B被冻结,则不应冻结进程A和任何其他工作进程.
其实我错了:如果我点击按钮工作进程B在主线程中不间断地执行大量UI工作,不仅会阻止进程B的UI,还会阻止进程A的UI,直到我的测试代码结束.
有人可以分享一些灯吗?
如果同一类的两个对象在 Java 中具有相同的 hashCode,那么它们将如何存储在HashMap/ 中HashTable?哈希码和内存地址的实际架构是什么。hashCode 驻留在内存中的什么位置?
例子:有一个类A。创建对象时a1,a2它们将代表一些内存地址,但我每次都覆盖了哈希码。当我阅读一篇文章时,我发现 hashcode 函数从内存地址生成一个 hashcode。这意味着如果哈希码相同,内存地址将相同。请解开我的疑惑。
public class A {
@Override
public int hashCode() {
return 1;
}
public static void main(String args[]) {
A a1 = new A();
A a2 = new A();
System.out.println(a1.hashCode());
System.out.println(a2.hashCode());
}
}
Run Code Online (Sandbox Code Playgroud) 我把一个webapp放到ElectronJS框架中.在webapp(实际上是网页)中有一些链接target=_blank.但是,当我单击该链接时,它将打开另一个Electron浏览器窗口.我希望链接能够在默认的Web浏览器中显示.
我能想到的是捕获这样的导航事件,然后将消息发送到主浏览器窗口,让它生成一个默认的浏览器实例来显示链接.
我觉得这有点复杂.我正在寻求一种更简单的方法来做到这一点.
我想更改外部应用程序的编辑控件的文本.该应用程序是用Delphi编写的.它有几种形式.我开始用Python库pywinauto+ sendkeys测试第一种形式TLoginForm.它完美地运作.这是伪代码:
helper = pywinauto.application.Application()
hwnd = pywinauto.findwindows.find_windows(class_name='TLoginForm')[0]
window = helper.window_(handle=hwnd)
ctrl = window[2] # the second control is the edit control I want to access
ctrl.ClickInput() # focus the control
ctrl.SetEditText('Hello world') # text can be changed expectedly
Run Code Online (Sandbox Code Playgroud)
作为第二步,我想为自动化工具制作UI.但由于缺乏Python UI知识并考虑到在Python中分发二进制文件的复杂性,我想做Delphi.但奇怪的是我无法使用Windows apis在Delphi中读/写编辑控件.以下是一些尝试:
SetForegroundWindow(EditControlHandle); // Works, the application will be brought to front, the edit control will be focused
// Attempt 1: Nothing happens
SetFocus(AnotherEditControlHandle);
// Attempt 2: Nothing happens
SetWindowText(EditControlHandle, 'Hello world');
// Attempt 3: …Run Code Online (Sandbox Code Playgroud) 我想创建一个TImage组件,并用背景色填充图像。但是我的代码比我预期的要长。
如果我没记错的话,在旧的Delphi版本中,我可以用FloodFill特定的颜色填充整个图像。所以我想我确实错过了一些事情。
有人可以弄清楚如何用更简单的代码填充背景色吗?
Image := TImage.Create(nil);
Image.Position.X := 100;
Image.Position.Y := 100;
Image.Width := 500;
Image.Height := 500;
Image.Bitmap.Width := Trunc(Image.Width);
Image.Bitmap.Height := Trunc(Image.Height);
with Image.Bitmap.Canvas do
begin
BeginScene;
try
Fill.Color := TAlphaColors.Black;
FillRect(RectF(0, 0, Image.Bitmap.Width, Image.Bitmap.Height), 0, 0, [], 1.0);
finally
EndScene;
end;
end;
Run Code Online (Sandbox Code Playgroud)