问题列表 - 第34392页

gcc/ld - 使用glibc.2.6中的__isoc99_sscanf @@ GLIBC_2.7符号创建一个新的libc.so

我有一个应用程序,当我尝试运行它时会出错:

/lib/libc.so.6: version `GLIBC_2.7' not found
Run Code Online (Sandbox Code Playgroud)

但是glibc 2.7需要的唯一符号是

__isoc99_sscanf@@GLIBC_2.7 
Run Code Online (Sandbox Code Playgroud)

我想写一个小的单个函数"library",用这个符号作为__sscanf()的别名

我怎么能用gcc/ld做到这一点?

我的变体不被接受,因为"@@"符号

 int __isoc99_sscanf@@GLIBC_2.7(const char *, const char *, ...) __attribute__((alias("__sscanf")));
Run Code Online (Sandbox Code Playgroud)

第二个是我的变种

#include <stdarg.h>
int __isoc99_sscanf1(const char *a, const char *b, va_list args)
{
   int i;
   va_list ap;
   va_copy(ap,args);
   i=sscanf(a,b,ap);
   va_end(ap);
   return i;
}

   // __asm__(".symver __isoc99_sscanf,__isoc99_sscanf@@GLIBC_2.7");
    __asm__(".symver __isoc99_sscanf1,__isoc99_sscanf@@GLIBC_2.7");
Run Code Online (Sandbox Code Playgroud)

但它以链接器中的"找不到符号__isoc99_sscanf @@ GLIBC_2.7的版本节点"结束.

linker gcc scanf ld linker-scripts

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

摆脱HTML/CSS中输入框上的蓝色焦点矩形?

我正在运行Mac OS,所以我无法确定这种效果是否出现在Windows机器上,所以我很抱歉,如果你没有看到这种效果.

输入和TextFields在聚焦时似乎有一个蓝色矩形,至少在Mac上的Firefox和Chrome上.我对网站有一个自定义焦点效果,我想知道我是否可以避免这个默认选择行为显示.谷歌在他们的网站上避免使用它.我尽可能地为Google的输入框获取'实效'CSS样式,将其应用于我的css对象.但是,它仍然显示蓝色矩形.我不确定谷歌正在做什么样的伏都教,但在我看来,它既不是HTML或CSS属性.有谁知道如何避免这种影响?谢谢!

html css macos

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

在自定义模块上的system.xml中添加日期选择器

正如在主题中所述,我试图在系统>配置区域中为自定义模块添加日期字段及其日期选择器(因此使用etc/system.xml).

我试图从下面的主题中获得灵感: Magento - 在system.xml上添加一个按钮,附加方法

但没有成功.

我确定这是一个创建正确的块或方法来创建自定义html字段的问题,但我无法读取通过Magento矩阵:)

我陷入了需要编写类(Datefield.php)的步骤:

    <?php
            class Namespace_Module_Block_Datefield extends Mage_Adminhtml_Block_System_Config_Form_Field {

             protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
    // ----> Am I wrong in calling ..._Abstract?  Should I call Varien_Data_Form_Element_Date? I've tried but no success either...

$this->setElement($element);

              $html = // ------------------> what to put here? Call a block or some other method?
                      ->setFormat('d-m-Y')
                      ->setLabel($this->__('Choose date'))
                      ->toHtml();

              return $html;
             }
            }    
            ?>
Run Code Online (Sandbox Code Playgroud)

你有诀窍怎么做?

非常感谢.埃尔韦

magento

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

VIM Spellcheck,引用字符串 - PHP

我想知道在用PHP编码时是否可以运行vim拼写检查程序.如果我禁用语法高亮显示,我可以运行它,并且它突出显示几乎所有方法/函数名称,因为它们不是英语单词.

所以,我的问题是,我可以对PHP文件中的字符串进行拼写检查吗?

例如,在'引号(和"引号")中,忽略其他所有内容:

$paragraph = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. In est libero, dictum ut suscipit eget, lacinia in justo. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Praesent sit amet sem libero, in pretium enim. Pellentesque tortor ante, imperdiet quis mattis in, tincidunt et ligula. Cras porta velit a ligula venenatis placerat.';

$paragraph2 = "Vestibulum quis eleifend lectus. Vestibulum odio odio, mollis at eleifend a, adipiscing sed quam. Nam quis nisi …

vim spell-checking

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

警告 - 有符号和无符号整数表达式之间的比较

我目前正在使用Accelerated C++,并在练习2-3中遇到了一个问题.

程序的快速概述 - 程序基本上采用名称,然后在星号框架内显示问候语 - 即Hello!被*的框架包围着.

练习 - 在示例程序中,作者用于const int确定问候语和星号之间的填充(空格).然后,作为练习的一部分,他们要求读者询问用户输入他们想要填充的大小.

所有这一切似乎都很容易,我继续向用户询问两个整数(int)并存储它们并更改程序以使用这些整数,删除作者使用的整数,编译时虽然得到以下警告;

Exercise2-3.cpp:46:warning:有符号和无符号整数表达式之间的比较

经过一些研究后,似乎是因为代码试图将上述整数(int)之一与a进行比较string::size_type,这很好.但我想知道 - 这是否意味着我应该改变其中一个整数 unsigned int?明确说明我的整数是签名还是未签名是否很重要?

 cout << "Please enter the size of the frame between top and bottom you would like ";
 int padtopbottom;
 cin >> padtopbottom;

 cout << "Please enter size of the frame from each side you would like: ";
 unsigned int padsides; 
 cin >> padsides;

 string::size_type c = 0; // definition of c …
Run Code Online (Sandbox Code Playgroud)

c++ unsigned-integer

66
推荐指数
3
解决办法
17万
查看次数

如何允许类属性在c#中具有多种/灵活类型?

在C#中,我有三个类:Person,Cat和Dog.

Cat和Dog类都有方法Eat().

我希望Person类有一个属性'Pet'.

我希望能够通过Person之类的Person.Pet.Eat()调用Cat和Dog的Eat方法,但我不能,因为Pet属性需要是Cat或Dog类型.

目前我正在使用Person类中的两个属性:PetDog和PetCat.

现在这没关系,但如果我想要100种不同类型的动物作为宠物,那么我真的不想在Person类中拥有100种不同的Pet属性.

有没有办法使用接口或继承?有没有办法可以将Pet设置为Object类型,但仍然可以访问分配给它的动物类的属性?

c# polymorphism

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

春季3自动装配和junit测试

我的代码:

@Component
public class A {
    @Autowired
    private B b;

    public void method() {}
}

public interface X {...}

@Component
public class B implements X {
    ...
}
Run Code Online (Sandbox Code Playgroud)

我想在隔离类A中测试.我必须模拟B类吗?如果有,怎么样?因为它是自动装配的,并且没有可以发送模拟对象的setter.

junit spring autowired

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

函数式编程语言内省

我正在草拟一些设计(函数的机器学习),它最好是想要一种函数式编程语言,还有内省,特别是以一些易于处理的格式检查程序自己的代码的能力,最好还有获取机器的能力.生成的代码是在运行时编译的,我想知道什么是编写它的最佳语言.Lisp当然具有强大的内省功能,但静态类型语言也有优势; 我正在考虑的是:

F# - .Net平台在这里有一个很好的故事,你可以在运行时读取字节码,也可以发出字节码并进行编译; 我假设从F#访问这些设施没有问题.

Haskell,Ocaml - 通过字节码或解析树,它们有类似的功能吗?

还有其他语言我还应该关注吗?

f# ocaml haskell functional-programming introspection

17
推荐指数
4
解决办法
2485
查看次数

从MIDI文件中获取备注数据

有没有办法从MIDI文件中获取音符数据?也就是说,我想将MIDI文件分解为其组成部分,因此它们采用唯一字(或任何其他数据类型)的形式.我最终想要做的是获取MIDI文件并在笔记中找到模式.获取每个音符,找到它的频率(正在播放)并记录其后音符播放的可能性.

在C/C++中这样做会很好,但任何语言都可以.

language-agnostic midi parsing

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

C++ time_t问题

我在C++中使用日期管理遇到了麻烦(VS 2008).

根据MSDN规范,time_t代表:

自1970年1月1日0:00 UTC以来的秒数

因此,我写了这段代码:

#include <stdio.h>
#include <time.h>

time_t GetDate(int year, int month, int day, int hour, int min, int sec)
{
    time_t rawtime;
    struct tm * timeinfo;

    time ( &rawtime );
    timeinfo = gmtime ( &rawtime );
    timeinfo->tm_year = year - 1900;
    timeinfo->tm_mon = month - 1;
    timeinfo->tm_mday = day;
    timeinfo->tm_hour = hour;
    timeinfo->tm_min = min;
    timeinfo->tm_sec = sec;
    timeinfo->tm_isdst = 0; // disable daylight saving time

    time_t ret = mktime ( timeinfo …
Run Code Online (Sandbox Code Playgroud)

c c++ time visual-studio-2008

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