问题列表 - 第34148页

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

我可以使用rpm扩展specfile中的宏吗?

具体的例子是我有很多specfiles Source0:或其他Source包含宏的行.如何在不实际启动specfile构建或编写自己的解析器的情况下扩展这些宏?

rpm rpm-spec

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

如何在c ++和c#中实现vtables?

让我们有这种情况(在c ++中,在c#类A中,B是接口):

class A { virtual void func() = 0; };
class B { virtual void func() = 0; };
class X: public A, public B { virtual void func(){ var = 1; } int var;};

X * x = new X; // from what I know, x have 2 vtables, is this the same in c#?
A * a = (A*)x; // a == x
B * b = (B*)x; // here b != x, so when calling b->func(), …
Run Code Online (Sandbox Code Playgroud)

c# c++ inheritance interface vtable

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

使用SVG屏蔽带有可选文本的图像 - 可能吗?

在杂志等中经常出现的一个简洁的印刷效果是选择一个非常粗体的字体并将图像放在文本中.以下是效果的随机示例: 替代文字

在网页设计中,没有办法用普通的html/css/js做到这一点.它可以用闪存或位图图像完成,但这些技术显然有一些很大的缺点.

我想知道是否可以用SVG做到这一点?我从来没有使用过SVG,但如果可以的话,可能值得尝试绕过它.

例如,是否可以让javascript遍历页面并查找某些元素(h1s或某些类),并在运行中生成一个SVG文件,该文件包含所选字体中的可选文本,其中图像被剪切到字母形状?有谁知道这是否已经完成,教程,其他任何可能有趣的东西来看这个问题...

svg masking

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

好的编码:模块化的js文件或一个大的js文件?

只是想问一下那里的大师们.我知道CSS文件更好地合并而不是分成多个文件.js的工作方式是否相同?以下是我目前所知的几点(或者相信......如果我的信念/理解是错误的,你可以指出一些问题):

  • 我知道js更好地模块化以便于维护
  • 将所有文件合并为一个"风险很大",因为您只想在某个页面上使用某些功能.
  • 我知道并发下载会减慢页面速度,所以最好只做一个大文件.
  • 合并到1个文件可能会导致变量作用域出现问题?
  • 我知道有javascript编译器ala bundle-fu或YUI,但这是所有人的答案吗?dev的不同文件然后js只有1个文件?

javascript jquery bundle

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

一个更好的php array_merge

我希望这样做更好的方式,而无需硬编码整数$justPrices[$i]:

$pricesResult = array_merge($justPrices[0], $justPrices[1], $justPrices[2], $justPrices[3]);
Run Code Online (Sandbox Code Playgroud)

$justPrices是一个多维数组,每个数组中包含4个'带'的价格.$justPrices例如的数据:

Array ( [0] => Array ( [0] => 40.95 [1] => 39.95 [2] => 39.45 [3] => 38.95 ) [1] => Array ( [0] => 45.80 [1] => 41.80 [2] => 41.50 [3] => 41.40 ) [2] => Array ( [0] => 45.95 [1] => 42.95 [2] => 41.95 [3] => 41.45 ) [3] => Array ( [0] => 50.00 [1] => 50.00 [2] => 50.00 [3] …
Run Code Online (Sandbox Code Playgroud)

php arrays multidimensional-array array-merge

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

使用.offset().top在页面上查找Elements位置

我有一个DIV我想要滚动页面,但它在折叠上方不可见所以我正在使用它.

$(window).scroll(function() {
    // Get scrolling position of document   
    var scrollYpos = $(document).scrollTop();

    // if its more than the top of the element
    if (scrollYpos > 551 ) {

         // Add a margin to the top 
         $('#scrollingDiv').animate({'margin-top': scrollYpos - 541 }, {duration: 300, queue: false});
    } else {
         $('#scrollingDiv').animate({'margin-top': 0 }, {duration: 200, queue: false});
    }}); // end scroll
Run Code Online (Sandbox Code Playgroud)

ATM我手动给它DIV的垂直位置(551px).我想动态地做.

var elYpos = $('#scrollingDiv').offset().top
Run Code Online (Sandbox Code Playgroud)

因此,这会在页面上找到元素的垂直位置,但是当元素移动时,这会改变其他元素.

我怎样才能获得元素的位置一次?

jquery

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

Tomcat启动错误

我在Windows上启动Tomcat时在Catalina日志文件中收到以下错误:

Sep 3, 2010 3:22:53 PM org.apache.catalina.startup.Catalina start
SEVERE: Catalina.start: 
LifecycleException:  service.getName(): "Catalina";  Protocol handler start failed: java.lang.Exception: Socket bind failed: [730048] Only one usage of each socket address (protocol/network address/port) is normally permitted.  
    at org.apache.catalina.connector.Connector.start(Connector.java:1138)
    at org.apache.catalina.core.StandardService.start(StandardService.java:531)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Sep 3, 2010 3:22:53 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 67604 ms
Run Code Online (Sandbox Code Playgroud)

但是当我将端口号更改80809000然后没有错误,但是对http:// localhost:9000 /的请求给出了404错误 …

tomcat lifecycleexception

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

在fluentnhibernate中使用引用作为id

我有一个包含父级id的子表.这是一对一映射,但子表可能缺少值.我在绘制这个问题时遇到了问题而没有出现错误...我尝试了几件事; 映射相同的列,具有不同的属性等.

Parent table
  int id

Child table
  int parentid

Parent class
  int id

Child class
  Parent parent // note I'm referencing parent, not using an int id..

制图

Id(x => x.Parent)
  .Column("parentid"); // fails

Id(x => x.Parent.Id)
  .Column("parentid"); // fails

References(x => x.Parent)
  .Column("parentid"); // fails - missing id

// Adding an id field in addition to parent for
// child class (id is then the same as parent.id)
// fails on save
Id( x => x.Id ) 
  .Column("parentid"); …
Run Code Online (Sandbox Code Playgroud)

nhibernate-mapping fluent-nhibernate

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

为.Net平台编写DSL

我正在考虑编写一个在.Net环境中运行的DSL.我最有可能在C#中实现这一点,尽管我对此很灵活.

是否有推荐的在线资源显示为.Net平台编写DSL的主要步骤?

理想情况下,我想要一个至少提供以下概述的资源:

  • '指定DSL
  • 如何将规范映射到.Net框架
  • 优选地,以.Net语言实现的普通DSL的helloworld示例

[编辑]

实际上,我刚看过这篇文章 - 但它有点过时了.有没有人对文章是否是一个好的起点有所了解(.Net框架和C#似乎以非常快的速度发展)

.net c#

10
推荐指数
2
解决办法
8261
查看次数