问题列表 - 第32211页

为什么我们使用finally块?

据我所知,以下两个代码片段都将起到同样的作用.为什么要有finally块?

代码A:

try { /* Some code */ }
catch { /* Exception handling code */ }
finally { /* Cleanup code */ }
Run Code Online (Sandbox Code Playgroud)

代码B:

try { /* Some code */ }
catch { /* Exception handling code */ }
// Cleanup code
Run Code Online (Sandbox Code Playgroud)

.net java finally

82
推荐指数
4
解决办法
2万
查看次数

如何更改TCanvas的textOut的高度?

我正在使用TextOut()在TCanvas上绘制文本,但我想要更大的字体.

我能做什么?

delphi textout

4
推荐指数
1
解决办法
1674
查看次数

在php中替换'with'的快速功能

心理障碍......

我知道这很容易......但今天没有什么事情可言!

任何人都可以帮助我快速搜索字符串并在php中转义所有撇号.谢谢.

php

1
推荐指数
1
解决办法
182
查看次数

你如何确定一个字符串是否是回文?

如何测试给定的String是否是Java中的回文,而不使用任何方法为我做这一切?

java string palindrome

-6
推荐指数
2
解决办法
8205
查看次数

非浅文件cmp.cmp究竟做了什么?

我正在使用Python 2.6.2.filecmp模块文档说:

filecmp模块定义了比较文件和目录的功能,以及各种可选的时间/正确性权衡.

和filecmp.cmp函数:

filecmp.cmp(f1,f2 [,浅])

比较名为f1和f2的文件,如果它们看起来相等则返回True,否则返回False.

除非给出浅并且为false,否则具有相同os.stat()签名的文件将被视为相同.

他们不做的是指定一个人获得的正确性等级shallow=False.那么,该怎么shallow=False办?它有多正确?

python filecompare

5
推荐指数
1
解决办法
6521
查看次数

固定功能管道中的 OpenGL 每像素照明

是否可以在 OpenGL 固定功能管道中启用每像素照明(以便我可以在低细分曲面上有很好的镜面高光)?

opengl lighting

5
推荐指数
1
解决办法
1382
查看次数

如何杀死正在等待Java中阻塞函数调用的线程?

我有一个帖子:

Thread t = new Thread(){
    public void run(){
        ServerSocketConnection scn = (ServerSocketConnection)
                Connector.open("socket://:1234");
        // Wait for a connection.
        SocketConnection sc = (SocketConnection) scn.acceptAndOpen();
       //do other operation
    }
};
t.start();
Run Code Online (Sandbox Code Playgroud)

让我们说没有客户端连接到服务器,所以这个线程将被阻止.现在我想杀死上面的线程t?我怎么能杀了它?

java multithreading midp java-me

9
推荐指数
1
解决办法
1万
查看次数

编程语言中符号的频率

我正在寻找某种参考,它显示了流行编程语言的符号频率.我正在尝试为编程设计最佳的键盘布局.

如果没有这样的参考,我不介意创建一个简单的实用程序来解决这个问题.但是,我需要就每种语言分析哪些文件提出建议.

我可以预见的一个问题是我得到了一些Objective-c代码,如果它是一个没有对象的简单程序,那么[]键的频率远远低于普通的objective-c文件.所以,我会说其中一个指导原则是示例代码应该代表一个普通文件,并使用该语言最常用的功能.

最初我认为我应该使用不同的语言编写相同的代码,但我不确定这是不是一个好主意,因为某些语言的用途不同于其他语言.

keyboard-layout

15
推荐指数
3
解决办法
2978
查看次数

使用"const"关键字进行C类型转换

我通常在C/C++代码中使用C类型转换.我的问题是,在构建类型中添加"const"关键字是否意味着结果的任何内容?

例如,我可以想出几个场景:

const my_struct *func1()
{
   my_struct *my_ptr = new my_struct;

   // modify member variables

   return (const my_struct *)my_ptr;
   // return my_instance;
}
Run Code Online (Sandbox Code Playgroud)

在这一个中,该函数构造一个struct的新实例,并将其转换为常量指针,因此除了删除它之外,调用者将无法进一步修改其内部状态.是"const"转换是必需的,推荐的还是简单的不必要的,因为任何一个return语句都有效.

在这一个中,my_base是基类my_derive.

const my_base *func2(const my_derive *my_ptr)
{
    return (const my_base *)my_ptr;
    // return (my_base *)my_ptr;
}
Run Code Online (Sandbox Code Playgroud)

因为my_ptr已经是一个const指针,所以会在转换时使用(my_base *)const_cast来删除const和另一个隐式const_cast吗?

是否有任何理由将"const"添加到整数函数参数中,因为更改它永远不会影响函数外的状态?

void func3(const int i)
{
    // i = 0; is not allowed, but why, as it is harmless?
}
Run Code Online (Sandbox Code Playgroud)

如何在转换整数时添加"const"?我觉得这应该很像func2().

void func4(short i)
{
    const unsigned int …
Run Code Online (Sandbox Code Playgroud)

c c++ casting const

5
推荐指数
2
解决办法
2万
查看次数

尽管存在插件错误,如何启动IntelliJ IDEA

我的IntelliJ idea 9 IDE有问题.我安装了La Clojure插件(http://plugins.intellij.net/plugin/?id=4050)和重启所需的IDE.现在我在启动时遇到以下错误,它不会让我继续工作:

java.lang.AssertionError: Source file C:\Users\foo\.IntelliJIdea90\system\plugins\org.intellij.clojure_8192.zip does not exist for action unzip[C:\Users\foo\.IntelliJIdea90\system\plugins\org.intellij.clojure_8192.zip, C:\Users\foo\.IntelliJIdea90\config\plugins]
    at com.intellij.openapi.diagnostic.DefaultLogger.error(DefaultLogger.java:49)
    at com.intellij.openapi.diagnostic.Logger.error(Logger.java:48)
    at com.intellij.ide.startup.StartupActionScriptManager$UnzipCommand.execute(StartupActionScriptManager.java:189)
    at com.intellij.ide.startup.StartupActionScriptManager.executeActionScript(StartupActionScriptManager.java:49)
    at com.intellij.ide.ClassloaderUtil.initClassloader(ClassloaderUtil.java:123)
    at com.intellij.ide.Bootstrap.main(Bootstrap.java:39)
    at com.intellij.ide.Bootstrap.main(Bootstrap.java:35)
    at com.intellij.idea.Main.main(Main.java:54)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.exe4j.runtime.LauncherEngine.launch(Unknown Source)
    at com.exe4j.runtime.WinLauncher.main(Unknown Source)
Run Code Online (Sandbox Code Playgroud)

当我在指定的文件夹中找不到zip存档时,我手动将其删除,IDE正确地将其解压缩到config/plugins文件夹,并从system/plugins文件夹中删除了zip文件.然而,它没有解决我的问题,错误仍然存​​在.有没有办法启动IntelliJ想法禁用该插件?

先谢谢你,Alex

java plugins clojure intellij-idea

7
推荐指数
3
解决办法
5642
查看次数