问题列表 - 第19579页

.NET:在静态方法中确定"this"类的类型

在我可以使用的非静态方法中this.GetType(),它将返回Type.如何Type在静态方法中获得相同的内容?当然,我不能只写,typeof(ThisTypeName)因为ThisTypeName只在运行时才知道.谢谢!

.net c# static-methods types

92
推荐指数
4
解决办法
6万
查看次数

Python原始字符串和unicode:如何使用Web输入作为regexp模式?

编辑:一旦你拿起"r"标志的含义,这个问题就没有意义了.更多细节在这里.对于寻找快速安全的人,我在下面补充道.

如果我在Python脚本中手动输入正则表达式,我可以为模式字符串使用4种标志组合:

  • p1 ="模式"
  • p2 =你的"模式"
  • p3 = r"模式"
  • p4 = ru"模式"

我有一堆来自Web表单输入的unicode字符串,并希望将它们用作regexp模式.

我想知道我应该对字符串应用什么过程,所以我可以期望使用上面的手册形式得到类似的结果.就像是 :

import re
assert re.match(p1, some_text) == re.match(someProcess1(web_input), some_text)
assert re.match(p2, some_text) == re.match(someProcess2(web_input), some_text)
assert re.match(p3, some_text) == re.match(someProcess3(web_input), some_text)
assert re.match(p4, some_text) == re.match(someProcess4(web_input), some_text)
Run Code Online (Sandbox Code Playgroud)

someProcess1到someProcessN会是什么?为什么?

我想someProcess2不需要做任何事情,而someProcess1应该做一些unicode转换到本地编码.对于原始字符串文字,我无能为力.

python regex unicode rawstring

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

C#关闭notifyIcons文本(托盘图标)

我正在制作这个"你正在听的内容" - 用于学习目的的插件,将当前的Spotify或Winamp歌曲显示为IM客户端中的消息.

到目前为止它真的很简单,我只是从标题中播放这首歌

Process.GetProcessesByName("spotify");
Run Code Online (Sandbox Code Playgroud)

然后选择歌曲部分("Spotify - <歌曲标题>")

proc.MainWindowTitle.Substring(10);
Run Code Online (Sandbox Code Playgroud)

但是,大多数人不会将主窗口打开或最小化到任务栏,而是仅将其视为托盘图标.我想从那里得到文本(悬停在它上面时显示的文本).

这有什么简单的方法吗?

谢谢

c# icons text notifyicon tray

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

prawnto显示新页面时不会中断的表格

我有一个可变数量的表,行数可变,我想让它们一个接一个地显示,但如果一个表不适合当前页面,则将它放在下一个然后继续.我把表放在一个交易中,所以我可以回滚然后打印它,如果高度适合在curent页面,但我如何获得表高度?

我现在有这个代码

pdf.transaction do 

pdf.table @data,
    :font_size  => 12, 
    :border_style => :grid,
    :horizontal_padding => 10,
    :vertical_padding   => 3,
    :border_width       => 2,
    :position           => :left,
    :row_colors => ["FFFFFF","DDDDDD"]

pdf.move_down 20

#pdf.rollback 
end
Run Code Online (Sandbox Code Playgroud)

对此的任何帮助都会很棒.或者其他任何方式来做到这一点?

最好的问候里克

ruby pdf-generation ruby-on-rails prawn prawnto

5
推荐指数
3
解决办法
4559
查看次数

仅为匿名用户缓存ASP.NET页面

是否有一种简单的方法可以仅为匿名用户缓存ASP.NET整个页面(使用表单身份验证)?

上下文:我正在创建一个网站,向匿名用户显示的页面大部分是完全静态的,但是为登录用户显示的页面不同.

当然,我可以通过后面的代码手动执行此操作,但我认为可能有更好/更容易/更快的方式.

asp.net caching forms-authentication

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

为什么编程语言允许从整数到shortint的赋值?

program TypeCategory;
{$R+}
var
    sInt : shortint;
    iInt : integer;
begin
    readln(iInt);
    sInt := iInt;
    writeln(sInt);
end.
Run Code Online (Sandbox Code Playgroud)

考虑到上面的例子,Pascal语言确实允许从分配integershortint,或甚longintshortint没有显式类型casting.That是,帕斯卡确实允许类型类别内分配(这里是整数类型).

Pascal以它的名气而闻名strongly typed,但为什么它允许这种weakly typed东西?我认为这种语法会鼓励不一致的代码.

这种语法的优点是什么?除了着名的C和C++之外,还有其他语言应用这种语法吗?

谢谢.

编辑:
我只测试turbo pascalfree pascal with fpc/objfpc/tp/delphi model.也,gcc/g++msvc产生相同的结果.也就是说,从int(我的计算机上的4字节short int大小)到(大小为2)的分配不会触发任何编译错误,而你可以设置使编译器生成possible lose of data警告的适当选项.

programming-languages strong-typing weakly-typed

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

"u"和"r"字符串标志究竟做了什么,以及什么是原始字符串文字?

在问这个问题时,我意识到我对原始字符串知之甚少.对于那些自称是Django训练师的人来说,这很糟糕.

我知道编码是什么,而且我知道u''自从我得到什么是Unicode以来我们独自做了什么.

  • 但到底r''做了什么呢?它会产生什么样的字符串?

  • And above all, what the heck does ur'' do?

  • Finally, is there any reliable way to go back from a Unicode string to a simple raw string?

  • Ah, and by the way, if your system and your text editor charset are set to UTF-8, does u'' actually do anything?

python unicode python-2.x rawstring

600
推荐指数
7
解决办法
41万
查看次数

What do you call the entire first part of a URL?

If I have a URL like:

http://www.example.com:9090/test.html
Run Code Online (Sandbox Code Playgroud)

Then I know that www.example.com is the host name, but what do you call http://www.example.com:9090? Is there some kind of established name for that?

url uri terminology

68
推荐指数
4
解决办法
3万
查看次数

x86 emulator for training embedded development

I wish to learn more about the inner working of the computer, to enhance my knowledge about embedded system developement.

At work, I never get involved with the low-level details (such as, the GDT, the loader of the code from flash to RAM, etc) as all these are already written.

我现在不想购买任何其他硬件.有没有一个模拟器,一个非常简单的操作系统,我可以玩,以掌握嵌入式programmimng的所有低级方面?是否有一个教程可以指导我设置一个非常简单的嵌入式环境(设置内存段,GDT,进入保护模式和执行main())

architecture embedded x86 assembly

8
推荐指数
2
解决办法
1614
查看次数

手机软件开发有共同语言吗?

我想让我的客户通过手机在我的网站上阅读他们的数据.

我的网站是ASP.NET应用程序.

我看到诺基亚和Apple都有自己的SDK,可以让你完成创建软件应用程序.

  • 是否有一个独特的语言平台,我可以编写我的软件,以便在所有手机品牌上运行它?喜欢java还是c ++?
  • 如果是这样,是否有一个快速启动应用程序,所以我将能够开始研究它?

iphone mobile

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