-
Resid
2020-08-20 16:50:53关于Resid服务器闪退问题,导致客户端:Could not connect to Redis at 127.0.0.1:6379: 由于目标计算机积极拒绝无法连接解决方案。 前言:最近在整理计算机文档时发现过去学习过程中自己出现bug和解决办法,就整理...关于Resid服务器闪退问题,导致客户端:Could not connect to Redis at 127.0.0.1:6379: 由于目标计算机积极拒绝无法连接解决方案。
前言:最近在整理计算机文档时发现过去学习过程中自己出现bug和解决办法,就整理一下发到个人博客,可能不是所有问题都能用我的办法解决,仅供参考。
1.首先客户端出现:Could not connect to Redis at 127.0.0.1:6379: 由于目标计算机积极拒绝无法连接解决方案。是由于服务器没有启动,一般进入resid安装文件,双击服务器文件就可启动,解决问题。
但若出现闪退问题,可能就是小哥你的电脑太多“学习资料”,内存不够。这时候我们可以清理一下自己内存,把某些“学习资料”放到网盘,重新启动就可。如果实在不舍得这些资源,也可以自己设置redis的最大内存。
在配置文件中加入maxmemory定义Redis可用最大物理内存,加入一下语句就可,如下:
注意:没有带单位尾巴的为字节数,以B结尾的表示相应的大小。但需要注意KB和K、MB和M、GB和G是不同的,如1K表示1000字节,而1KB则为1024字节。如果maxmemory值为0,表示不做限制。
最后成功启动!!
问题原因和解决:因为为了防止redis占用过多的内存对其他的应用程序造成影响,redis可以在配置文件中通过设置maxmemory选项对redis所能够使用的最大内存做限制。
如果想了解更多关于这方面的,我看到一篇关于这方面不错的文章,如下:
https://blog.csdn.net/GDJ0001/article/details/80117797 -
Add colors using attribute resId
2020-12-26 00:53:20<div><p>Currently the background, title, etc colors can be set by color resId only. <p>Using Attribute resId, would be more useful for theming purposes. <p>Or, option to provide resolved color ... -
android getText(int resId)和getString(int resId)的使用
2018-05-17 08:54:07今天,简单讲讲android里对于getText(int resId)和getString(int resId)的使用和区别。最近,我查找资料时发现了getString(int resId)和getText(int resId)这两个函数。在android里,我们通常获取字符资源是通过...今天,简单讲讲android里对于getText(int resId)和getString(int resId)的使用和区别。
最近,我查找资料时发现了getString(int resId)和getText(int resId)这两个函数。在android里,我们通常获取字符资源是通过getString(int resId)来获取的,可是有时候看到代码里也可以通过getText(int resId)来获取String.xml文件的字符资源,那么这两个函数有没有区别呢?在网上查找资料,最终是解决了这个问题。这里记录一下。
CharSequence chrs = getText(R.string.demo);
String str = getString(R.string.demo);
这两种方式有什么不同呢?一定要搞明白,开始实验:
实验一:strings.xml中的相关代码<string name="demo">demo</string>
main.xml中用线性布局定义两个文本标签,分别使用两种方式获取demo的值,详细代码
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" > <TextView android:id="@+id/firstText" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="" /> <TextView android:id="@+id/secondText" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="" /> </LinearLayout>
注意android:text的值都是空的,下面继续看main.java是怎么处理的:
package com.dy.study.firstbase; import android.os.Bundle; import android.widget.TextView; import android.app.Activity; public class Main extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); findViews(); change(); } private TextView firstText; private TextView secondText; private void findViews() { firstText = (TextView) findViewById(R.id.firstText); secondText = (TextView) findViewById(R.id.secondText); } private void change() { CharSequence chs = getText(R.string.demo); String str = getString(R.string.demo); firstText.setText(chs); secondText.setText(str); } }
好,看看实验一的结果:
可以看到,两个值完全一样,怎么回事?难道这两种方式的效果时完全一样的吗?先不忙下结论,继续实验。实验二:把strings.xml中的那句相关代码改成<string name="demo"><b>demo</b></string>,仔细看,中间加了个<b></b>,然后其他都不改变,看结果:
你看,前面那个标签变了,这说明CharSequence的getText()是获取格式化的常量值,而String的getString()是单单获取值,而舍去了格式化。
就这么简单吗?可我又想了,如果把它们加起来,会是什么样子呢,继续实验。
实验三:在实验二的基础上改下main.java的内容:
main.java
package com.dy.study.firstbase; import android.os.Bundle; import android.widget.TextView; import android.app.Activity; public class Main extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); findViews(); change(); } private TextView firstText; private void findViews() { firstText = (TextView) findViewById(R.id.firstText); } private void change() { CharSequence chs = getText(R.string.demo); String str = getString(R.string.demo); firstText.setText(chs + str); } }
这里只让显示标签一的内容,猜想一下是不是一个粗一个细呢?看结果:
被同化了,这让我想起了java的隐式转换,实验到此为止。简单讲讲,getText()是获取到String.xml文件的字符资源,包含了字符的格式信息等,而getString()只是获取String.xml文件的字符串,会自动去掉格式的信息。
下面看看android关于getText()和getString()的源码:
1.getString()的源码:
@NonNull public final String getString(@StringRes int resId) { return getResources().getString(resId); }
@NonNull public String getString(@StringRes int id) throws NotFoundException { return getText(id).toString(); }
有此可见,android的getString()最终调用的还是getText(),不过进行了getText(id).toString()去掉了格式信息,然后转成字符串。
2.getText()的源码:
@NonNull public CharSequence getText(@StringRes int id) throws NotFoundException { CharSequence res = mResourcesImpl.getAssets().getResourceText(id); if (res != null) { return res; } throw new NotFoundException("String resource ID #0x" + Integer.toHexString(id)); }
这个应该是直接从资源文件里根据id获取到保存的字符序列CharSequence 。
所以获取字符资源时,getText()的效果优于getString(),因为getString()内部还是调用getText(id).toString()。
android getText(int resId)和getString(int resId)的使用就讲完了。
就这么简单。
-
Resources类中getString (int ResID)与getText (int ResID)的区别
2015-07-19 15:46:47Resources类中getString (int ResID)与getText (int ResID)的区别 getString (int ResID)和getText (int ResID)都是Resources类中方法,都是获取资源文件中的字符串资料。 getString (int ResID):是获得资源文件...Resources类中getString (int ResID)与getText (int ResID)的区别
getString (int ResID)和getText (int ResID)都是Resources类中方法,都是获取资源文件中的字符串资料。
- getString (int ResID):是获得资源文件的字符串资源(XML文件中String子元素定义的String资源),但是没有任何的文本显示样式的,其仅仅是获取字符串的值而已。
- getText (int ResID):也是获取XML文件中String子元素定义的String资源,与getString()方法不同的是,getText()返回的字符串包含文本的格式信息。
下面先看看二者在API的定义:
(1)public CharSequence getText (int ResID)
Return the string value associated with a particular resource ID. The returned object will be a String if this is a plain(简单的、平的) string; it will be some other type of CharSequence if it is styled.
返回与特定资源ID相关联的字符串值。如果是无格式的字符串,则返回的是字符串对象,如是格式的字符串,则将返回CharSequence 其他类型。
- 参数说明:
ResID:The desired resource identifier, as generated by the aapt tool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier.
- 返回值:
CharSequence :The string data associated with the resource, plus possibly styled text information.(与资源想关联的字符串数据和可能有的文本信息样式)
(2) public String getString (int ResID)
Return the string value associated with a particular resource ID. It will be stripped of(剥夺) any styled text information.
返回与特定资源ID相关联的字符串值。返回的字符串值被去除了全部文本信息的样式
- 参数说明:
ResID :The desired resource identifier, as generated by the aapt tool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier.
- 返回值:
String :The string data associated with the resource, stripped of styled text information.
(3) getString (int ResID)与getText (int ResID)的区别
二者都是在Resource类中的定义的方法,都是获取资源文件中的字符串资料。
- getString (int ResID):是获得资源文件的字符串资源(XML文件中String子元素定义的String资源),但是没有任何的文本显示样式的,其仅仅是获取字符串的值而已。
- getText (int ResID):也是获取XML文件中String子元素定义的String资源,与getString()方法不同的是,getText()返回的字符串包含文本的格式信息。
例如:
Strings.xml文件内容如下:
<?xml version="1.0" encoding="utf-8"?> <resources> <string name="demo"> <b>demo</b> </string> </resources>
在主程序中的主要语句:
CharSequence chs = getText(R.string.demo); //包含文本的样式信息 String str = getString(R.string.demo); //没有任何的文本样式信息 Text1.setText(chs); Text2.setText(str);
运行结果如下: -
Android getText(int resId)和getString(int resId)
2016-10-10 17:25:34ndroid提供多种获取资源文件方法,但是需要注意以下方法: ...CharSequence getText(int resId):返回本地、样式化的字符。 String getString(int resId) :返回字符串 比如: String.xml文件中定义资转载:http://blog.sina.com.cn/s/blog_5da93c8f01012zhb.html
ndroid提供多种获取资源文件方法,但是需要注意以下方法:
CharSequence getText(int resId):返回本地、样式化的字符。
String getString(int resId) :返回字符串
比如:
String.xml文件中定义资源文件:
<string name="styled_text">Plain, <b>bold</b>, <i>italic</i>, <b><i>bold-italic</i></b></string>
使用
getText(R.string.styled_text);
getString(R.string.styled_text);
getResource().getText(R.string.styled_text)
分别得到: -
获取resId
2010-04-03 09:57:40g" , null , null ) ; // or int resID = getResources( ) .getIdentifier ( "bug" , "drawable" , "org.anddev.android.testproject" ) ; -
Issue #839 - Resid selection with icodes
2020-12-27 21:31:10- Resid selections can now be suffixed by an icode <p>Eg: <pre><code>python u.select_atoms('resid 163A') # is the same as u.select_atoms('resid 163 and icode A') </code></pre> <h2>PR... -
inconsistent handling of PDB Insertion Codes and resid
2021-01-01 12:10:13<div><p>I using a data set of ~16k PDB files and many of them contain insertion codes (see ...resid {res.resid}")</code> might or might not return ... -
Android getText(int resId) 与 getString(int resId)的区别
2015-01-26 15:53:00Android提供两个获取strings.xml文件的方法:CharSequence getText(int resId):返回本地、样式化的字符。String getString(int resId) :单纯返回字符串 如: strings.xml中定义资源文件: <string name=... -
Android - Context中的getText(int resId)方法和getString(int resId)方法的区别
2015-04-09 14:38:00Android开发中,经常在Activity中使用getText(int resId)和getString(int resId)这两个方法,那么这两个方法有什么区别和联系呢? 这两个方法的参数都是资源ID,区别在于getText(int resId)返回的是一个... -
Eliminated unnecessary unit conversions for resid_moist etc.
2020-12-09 02:33:41<p>Currently, the <code>soil_con</code> terms <code>max_moist, <code>Wcr, and <code>Wpwp, have units of [mm] but <code>resid_moist</code> has units of [mm/mm]. Every time <code>resid_moist</code> is ... -
tensor_mechanics axisym_resid test failure on my computer
2020-12-27 09:35:07<div><p>The test 2D_geometries.axisym_resid still fails. Perhaps this is an important failure, as i <strong>think</strong> the force_z is supposed to agree with an analytical result, and i get things ... -
Resid总结
2018-09-02 21:12:33Redis是什么? Redis:REmote DIctionary Server(远程字典服务器) 是完全开源免费的,用C语言编写的,遵守BSD协议,是一个高性能的(key/value)分布式内存数据库,基于内存运行并支持持久化的NoSQL数据库,是当前... -
name-->resID
2014-05-28 16:22:35int resID = context.getResources().getIdentifier(fileName, "drawable", context.int resID = context.getResources().getIdentifier(fileName, "drawable", context.getPackageName());getPackageName()); -
ReSID audio broken when emulating MOS 8580 with "Emulate audio filter" enabled
2020-12-03 07:51:40<p>When choosing to emulate the MOS 8580 SID using the ReSID engine, if <code>Emulate audio filter</code> is enabled then the audio output is heavily corrupted - mostly silent, with bursts of static.... -
android:id="@id/resid" , andorid:id="@+id/resid" 的区别
2016-09-05 06:42:00android:id="@id/resid" //引用现有的资源idandorid:id="@+id/resid" //新增一个资源id id属性只能接受资源类型的值,也就是必须以@开头的值,例如,@id/abc、@+id/xyz等。 如果在@后面使用“+”,表示当修改完... -
View.setBackgroundResource(int resId)当resId代表的Drawable带有Padding时,会改变View本身的Padding值
2016-12-06 16:10:52View.setBackgroundResource(int resId)源码如下: /** * Set the background to a given Drawable, or remove the background. If the * background has padding, this View's padding is set to the -
redis05-Resid数据类型综合实践案例
2020-06-08 15:58:40Resid数据类型综合实践案例 业务场景 1.计数器 解决方案 设计计数器,记录调用次数,用于控制业务执行次数。以用户id作为key,使用此时作为value 在调用前获取次数,判断是否超过限定次数,不超过次数的情况下,... -
Redis简介与Resid的数据存储格式简单使用
2020-07-02 14:34:24Redis简介与Resid的数据存储格式简单使用 引入 Redis:我们使用MySql存在一些问题现象 为什么要使用NOSQL 具体表现为对如下三高问题的解决: High Performance - 数据库高并发访问 在同一个时间点,同时有海量的... -
【Redis】5. Resid数据类型综合实践案例
2021-01-07 21:01:25Resid数据类型综合实践案例 业务场景 1.计数器 解决方案 设计计数器,记录调用次数,用于控制业务执行次数。以用户id作为key,使用此时作为value在调用前获取次数,判断是否超过限定次数,不超过次数的情况下,每次... -
Hbonds analysis writing the digit 3 from TIP3 onto acceptor/donor resid
2021-01-01 18:41:51#TIME donor_idx acceptor_idx donor_resnm donor_resid donor_atom acceptor_resnm acceptor_resid acceptor_atom distance angle") f1.write("\n") for x in range(1,5): #25 dcd_name='2... -
Activity-setContentView(int resId)源码分析
2017-11-06 11:21:41Activity-setContentView(int resId)源码分析入口–Activity–》setContentView()public void setContentView(@LayoutRes int layoutResID) { getWindow().setContentView(layoutResID); initWindowDecorActio -
Add more getXXX(int resID) & clickOnXXX(int resID) methods
2021-01-07 04:38:15<div><p><em>From <a href="https://code.google.com/u/111939886635846010704/">courag....com</a> on December 05, 2012 16:11:40</em></p> <p>It would be nice if we have more of those getXXX() &... -
【NOSQL】 Resid命令参考
2014-01-23 14:03:13Resid命令参考:http://redis.readthedocs.org/en/latest/index.html 连接操作相关的命令 quit:关闭连接(connection)auth:简单密码认证 持久化 save:将数据同步保存到磁盘bgsave:将数据异步保存到... -
Resid使用一
2019-11-12 15:56:52前言 如果计划使用SpringBoot连接Redis, 请先配置好使用的redis,并建立基础的SpringBoot工程。 maven中心服务器...正文 配置Redis pom.xml加入dependency <dependency> ...org.s...
-
数据结构基本实现代码.zip
-
一周掌握FPGA Verilog HDL语法 day 4
-
Excel高级图表技巧
-
FindHotPhrase.exe
-
§10_辐射的量子理论.pdf
-
C#文件传输、Socket通信、大文件断点续传
-
Optimization Week 13: Newton method and barrier method
-
s7-200PLC应用举例.rar
-
DQL语言-连接查询
-
python办公自动化技巧
-
QQTIM案例.zip
-
android笔试面试和实战课程
-
单片机完全学习课程全五季套餐
-
Redis数据库入门与使用
-
广工EDA跑马灯Verilog设计.rar
-
跟我练内测小分队学习礼包
-
【数据分析-随到随学】Python数据获取
-
100条经典C语言笔试题目.ppt
-
Web选择日期时间控件
-
bootstrap-4.0.0.zip