持有实体nosql(hadoop / hbase / hive)(Persist entity nosql (hadoop/hbase/hive))
我是hadoop的新手,我想在我的情况下将实体持久化到一个nosql数据库是Hbase使用hiveQL! 我做了与hadoop,hbase,hive相关的所有配置,并且一切正常使用shell现在我正在尝试实现一个允许我将实体持久化到hbase的类(CRUD操作)所以我该如何定义数据库模式,我可以使用哪个数据库驱动程序! 如果有任何其他配置我应该加入我的程序!
谢谢
I'm new to hadoop and I want to persist an entity to a nosql database in my case is Hbase using hiveQL! I did all the configuration related to hadoop , hbase,hive and everything works fine using the shell Now I'm trying to implement a class that allows me to persist an entity to hbase (CRUD operations) So how can I define the database schema , which data base driver can I use! and if there is any other configuration should I put in my program!
Thanks
原文:https://stackoverflow.com/questions/27655716
最满意答案
好的,这里是你的解决方案。
检查它,让我知道这是否工作...
TextArea.java
public class TextArea extends android.support.v7.widget.AppCompatEditText { public static final int TYPEFACE_NORMAL = 0; public static final int TYPEFACE_BOLD = 1; public static final int TYPEFACE_ITALICS = 2; public static final int TYPEFACE_BOLD_ITALICS = 3; public static final int TYPEFACE_UNDERLINE = 4; public static boolean underline = false; private int currentTypeface; private int lastCursorPosition; private int tId; public TextArea(Context context) { super(context); lastCursorPosition = this.getSelectionStart(); } public TextArea(Context context, AttributeSet attrs) { super(context, attrs); } public int gettId() { return tId; } public void settId(int tId) { this.tId = tId; } public void changeTypeface(int tfId) { currentTypeface = tfId; lastCursorPosition = this.getSelectionStart(); } @Override protected void onTextChanged(CharSequence text, int start, int lengthBefore, int lengthAfter) { Spannable str = this.getText(); StyleSpan ss; UnderlineSpan tt = new UnderlineSpan(); int endLength = text.toString().length(); underline = false; Log.d("onTextChanged ", text.toString()); switch (currentTypeface) { case TYPEFACE_NORMAL: ss = new StyleSpan(Typeface.NORMAL); break; case TYPEFACE_BOLD: ss = new StyleSpan(Typeface.BOLD); break; case TYPEFACE_ITALICS: ss = new StyleSpan(Typeface.ITALIC); break; case TYPEFACE_UNDERLINE: underline = true; ss = new StyleSpan(Typeface.NORMAL); tt = new UnderlineSpan(); break; case TYPEFACE_BOLD_ITALICS: ss = new StyleSpan(Typeface.BOLD_ITALIC); break; default: ss = new StyleSpan(Typeface.NORMAL); } if (underline) { // str.setSpan(ss, lastCursorPosition, endLength, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); str.setSpan(tt, lastCursorPosition, endLength, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); } else { // Runtime Error Fix! if (endLength > lastCursorPosition) str.setSpan(ss, lastCursorPosition, endLength, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); } } }
活动
bold = findViewById(R.id.bold); italic = findViewById(R.id.italic); boldItalic = findViewById(R.id.boldItalic); editText = findViewById(R.id.editText); normal = findViewById(R.id.normal); underline = findViewById(R.id.underline); typefaceStyle = TextArea.TYPEFACE_NORMAL; editText.changeTypeface(typefaceStyle); normal.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { typefaceStyle = TextArea.TYPEFACE_NORMAL; editText.changeTypeface(typefaceStyle); } }); bold.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { typefaceStyle = TextArea.TYPEFACE_BOLD; editText.changeTypeface(typefaceStyle); } }); italic.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { typefaceStyle = TextArea.TYPEFACE_ITALICS; editText.changeTypeface(typefaceStyle); } }); boldItalic.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { typefaceStyle = TextArea.TYPEFACE_BOLD_ITALICS; editText.changeTypeface(typefaceStyle); } }); underline.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { typefaceStyle = TextArea.TYPEFACE_UNDERLINE; editText.changeTypeface(typefaceStyle); } });
Ok buddy here is your solution.
Check it and let me know if this works ...
TextArea.java
public class TextArea extends android.support.v7.widget.AppCompatEditText { public static final int TYPEFACE_NORMAL = 0; public static final int TYPEFACE_BOLD = 1; public static final int TYPEFACE_ITALICS = 2; public static final int TYPEFACE_BOLD_ITALICS = 3; public static final int TYPEFACE_UNDERLINE = 4; public static boolean underline = false; private int currentTypeface; private int lastCursorPosition; private int tId; public TextArea(Context context) { super(context); lastCursorPosition = this.getSelectionStart(); } public TextArea(Context context, AttributeSet attrs) { super(context, attrs); } public int gettId() { return tId; } public void settId(int tId) { this.tId = tId; } public void changeTypeface(int tfId) { currentTypeface = tfId; lastCursorPosition = this.getSelectionStart(); } @Override protected void onTextChanged(CharSequence text, int start, int lengthBefore, int lengthAfter) { Spannable str = this.getText(); StyleSpan ss; UnderlineSpan tt = new UnderlineSpan(); int endLength = text.toString().length(); underline = false; Log.d("onTextChanged ", text.toString()); switch (currentTypeface) { case TYPEFACE_NORMAL: ss = new StyleSpan(Typeface.NORMAL); break; case TYPEFACE_BOLD: ss = new StyleSpan(Typeface.BOLD); break; case TYPEFACE_ITALICS: ss = new StyleSpan(Typeface.ITALIC); break; case TYPEFACE_UNDERLINE: underline = true; ss = new StyleSpan(Typeface.NORMAL); tt = new UnderlineSpan(); break; case TYPEFACE_BOLD_ITALICS: ss = new StyleSpan(Typeface.BOLD_ITALIC); break; default: ss = new StyleSpan(Typeface.NORMAL); } if (underline) { // str.setSpan(ss, lastCursorPosition, endLength, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); str.setSpan(tt, lastCursorPosition, endLength, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); } else { // Runtime Error Fix! if (endLength > lastCursorPosition) str.setSpan(ss, lastCursorPosition, endLength, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); } } }
Activity
bold = findViewById(R.id.bold); italic = findViewById(R.id.italic); boldItalic = findViewById(R.id.boldItalic); editText = findViewById(R.id.editText); normal = findViewById(R.id.normal); underline = findViewById(R.id.underline); typefaceStyle = TextArea.TYPEFACE_NORMAL; editText.changeTypeface(typefaceStyle); normal.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { typefaceStyle = TextArea.TYPEFACE_NORMAL; editText.changeTypeface(typefaceStyle); } }); bold.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { typefaceStyle = TextArea.TYPEFACE_BOLD; editText.changeTypeface(typefaceStyle); } }); italic.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { typefaceStyle = TextArea.TYPEFACE_ITALICS; editText.changeTypeface(typefaceStyle); } }); boldItalic.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { typefaceStyle = TextArea.TYPEFACE_BOLD_ITALICS; editText.changeTypeface(typefaceStyle); } }); underline.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { typefaceStyle = TextArea.TYPEFACE_UNDERLINE; editText.changeTypeface(typefaceStyle); } });
相关问答
更多-
XFontStyle是一个enum类型。 您可以使用按位逻辑来组合值。 const XFontStyle ItalicUnderline = XFontStyle.Italic | XFontStyle.Underline ; const XFontStyle BoldItalicUnderline = XFontStyle.Bold | XFontStyle.Italic | XFontStyle.Underline ; XFontStyle is an enum type. You can use ...
-
好的,这里是你的解决方案。 检查它,让我知道这是否工作... TextArea.java public class TextArea extends android.support.v7.widget.AppCompatEditText { public static final int TYPEFACE_NORMAL = 0; public static final int TYPEFACE_BOLD = 1; public static final int TYPEFACE_I ...
-
你需要使用NSUnderlinePattern或NSUnderlineStyle来使其工作( 请参阅Apple文档 ) 尝试这个: [attrString addAttributes:@{ NSShadowAttributeName : shadow, // shadow NSUnderlineColorAttributeName : diagColor, // color ...
-
问题是你假设font.Font(underline=1)返回TLabel使用的完全相同的字体,但打开了下划线位。 根据平台及其配置方式,这可能会也可能不会成立。 如果您需要基于TLabel使用的字体的自定义字体,您应该首先复制字体而不是依赖默认值。 例如: original_font = font.nametofont(style.lookup("TLabel", "font")) f = font.Font(**original_font.configure()) f.configure(underlin ...
-
我迟迟不回答。 但无论如何,我会在这里发布它。 也许这对别人有帮助。 JButton button = new JButton("Label"); HashMap
textAttrMap = new HashMap (); textAttrMap.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON); textAttrMap.put(TextAttribute ... -
有一个很好的替换flex inline-block .footerblock2 li a { color: #535353; display: flex;/*change at inline-block;*/ } Thanks for all the answers! I managed to get it to work with the following CSS: .list-unstyled { padding-left: 0; list-s ...
-
而不是使用文本装饰使用底部边框:
22nd of May 2017
Instead of using a text decoration use a bottom border:22nd of May 20 ...
-
删除下划线:悬停:之前(remove underline with :hover:before)[2022-06-06]
我发现,从生成的内容中删除(通常)继承的样式的唯一方法是使用简化的演示(来自注释)给出它的position: absolute : a:link { text-decoration: none; position: relative; margin-left: 1em; } a:hover { text-decoration: underline; } a:before { content: '#'; position: absolute; rig ... -
更改UITextView字体没有删除粗体/下划线/斜体格式(Change UITextView Font w/o Removing Bold/Underline/Italics Formatting)[2023-10-11]
我会用Objective-C解决方案回答,因为我没有在Swift中编码,但它应该很容易转换成Swift。 NSAttributedString “effects”存储在NSDictionary 。 所以它是一个关键:价值体系(具有Key的独特性)。 粗体/斜体(来自您的示例)位于NSFontAttributedName的值内。 这就是为什么你不能像这样再次设置它。 主要关键是使用enumerateAttributesInRange:options:usingBlock: :: [attr enumerate ... -
您可以使用Style类为Label设置粗体字体和文本修饰。 例如 : Font fnt = Font.createTrueTypeFont("abc.ttf", "abc.ttf"). derive(4, Font.STYLE_BOLD); /* * I set up all styles in this case (Unselected,Selected,Pressed,Disabled), * but btw you can edit each style independ ...