首页 \ 问答 \ 搜索字段在sencha touch中(Search fields In sencha touch)

搜索字段在sencha touch中(Search fields In sencha touch)

在我的应用程序中,我必须添加搜索字段和一些选择字段。 当我在搜索字段中添加任何字符时,应显示来自商店的相应内容。 目前我正在使用我正在处理keyup事件的搜索字段。 请让我知道流程和指南行。 谢谢


In my app I have to add Search field and some select fields. when I add any character in search field corresponding content from store should be display. Currently I am using search field on which I am handling keyup event. Please let me know the flow and guide line to do this. Thanks


原文:https://stackoverflow.com/questions/18503601
更新时间:2021-09-22 13:09

最满意答案

C ++中的整数值只能存储有界范围内的值(通常为-2 31到+2 31 - 1),最大值大约为20亿并且会发生变化。 这意味着如果您尝试在整数中存储一个超过十位的二进制值,您将超出此上限。 在大多数系统中,这会导致值环绕,因此负输出。

为了解决这个问题,我建议你的函数返回一个存储位而不是整数的std::string ,因为从逻辑上讲你返回的数字实际上不是你想做的基数为10的整数进一步的算术运算。 这将允许您生成所需长度的二进制序列,而不会有整数溢出的风险。

至少你的逻辑是正确的!


Integer values in C++ can only store values in a bounded range (usually -231 to +231 - 1), which maxes out around two billion and change. That means that if you try storing in an integer a binary value with more than ten digits, you’ll overflow this upper limit. On most systems, this causes the value to wrap around, hence the negative outputs.

To fix this, I’d recommend having your function return a std::string storing the bits rather than an integer, since logically speaking the number you’re returning really isn’t a base-10 integer that you’d like to do further arithmetic operations on. This will let you generate binary sequences of whatever length you need without risking an integer overflow.

At least your logic is correct!

相关问答

更多
  • 我对这个班不熟悉,但我会认为你想要: SmartPointer str = SmartPointer(new char[20]); 或者可能: SmartPointer str = new char[20]; I'm not familiar with this class but I would think you want: SmartPointer str = SmartPointer(new char[20]); Or possibl ...
  • 显然, *(cra+3)是一个值为'\xdd'的char 。 由于char被签名,它实际上意味着-35(2的补码中的0xdd ),即0x ... fffffdd。 限制为16位给出0xffdd,即65501。 你需要使它成为一个unsigned char因此它给出了一个0-255范围内的数字: num = (unsigned char)cra[3]; 注意: 1. char的签名是实现定义的,但通常(例如在OP的情况下)它是签名的。 2.有signed char , unsigned char和unsig ...
  • 我在转换编号例程中看到一个错误,如果n不是GE而不是基数,则需要一个else,在那里打印出n是什么。 这就是为什么你的所有答案都缺少最后一位数字。 祝你好运。 I see a bug in the convert number routine, if n is not GE than the base, you need an else, where you print out whatever n is. This is why all of your responses are missing the ...
  • 假设每个字符串表示一个大端形式的二进制数(位从零开始编号,指的是字符串的最后一个字符),确定是否所有奇数位(即位#1,位#3,位# 5,等等)字符串是通过测试字符串是否匹配此正则表达式来完成的: ^[01]?(?:1[01])*$ 要理解这一点,首先让我们假设我们已经知道所有字符都是0或1简化。 鉴于(并忽略非捕获技巧),我们可以编写(以扩展形式): ^ .? (1.)* $ A BB CCCCC D <- the key 这是整个字符串( A和D )的锚定匹配,它是空字符串,或任何数字( B )或任何 ...
  • 这里最后一个函数调用是在索引midpoint+1而不是元组传递一个值。 错误解释 IndexError :元组索引超出范围,这发生在len元组为1且midpoint+1为1超出范围,因为只有一个元素 TypeError :'int'类型的对象没有len(),那当int在最后一行作为第一个参数传递给isMemberR def isMemberR(aseq, target): if len(aseq) == 0: return False else: midpoi ...
  • 为了澄清,我将在这里发布一个答案。 你得到的“错误” 根本不是错误。 然而,它是疯狂的长,因为它以递归方式打印从::paginate(5)方法返回的整个集合。 如果滚动到此print_r语句的最底部,您应该可以创建结果集。 例如,查找其中一个结果的id ,您应该看到类似于Array ([id] => 1 [column_2] => x [column_3] => y ...其中column_N是列中的列的名称你的桌子。 使用Laravel时最简单的经验法则: 如果返回集合,请使用foreach循环。 我的意 ...
  • 要知道您的解决方案是否正确,您需要运行它并打印结果。 要打印,请使用System.out.println(..) public static void main(String[] args) { int s = sum(10); System.out.println(s); } static int sum(int n) { if(n % 2 == 0) { n--; } if (n <= 1) { return 0; ...
  • 你想要以相反的顺序做这两个add : add $s1, $zero, $v0 # $s1 = c(n,k-1) addi $a0, $s0, -1 add $a1, $s1, $zero 否则你的第二个呼叫将是C(n-1, C(n,k-1))而不是C(n-1, k) 。 You'll want to do these two adds in the opposite order: add $s1, $zero, $v0 # $s1 = c(n,k-1) addi $a0, $s0, -1 add $a ...
  • C ++中的整数值只能存储有界范围内的值(通常为-2 31到+2 31 - 1),最大值大约为20亿并且会发生变化。 这意味着如果您尝试在整数中存储一个超过十位的二进制值,您将超出此上限。 在大多数系统中,这会导致值环绕,因此负输出。 为了解决这个问题,我建议你的函数返回一个存储位而不是整数的std::string ,因为从逻辑上讲你返回的数字实际上不是你想做的基数为10的整数进一步的算术运算。 这将允许您生成所需长度的二进制序列,而不会有整数溢出的风险。 至少你的逻辑是正确的! Integer value ...
  • 可能有用的一个小改进就是使用尾递归来定义它。 当最后执行的事情是递归调用时,会发生尾递归。 要使此尾递归,请使用辅助方法并将运行总和作为参数传递。 我很确定下面的伪代码是尾递归的,因为无论(如果奇数)检查的结果如何,最后一步是递归调用(数学在递归调用之前发生)。 procedure SumOdds(n) return SumOddsHelper(n, 0) procedure SumOddsHelper(n, sum) if n = 1 return 1 if n is odd return ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。