首页 文章 精选 留言 我的

精选列表

搜索[列状态],共10017篇文章
优秀的个人博客,低调大师

Slack 进入微软内部禁用服务清单,GitHub 也在其列?

近日有微软员工惊讶地发现自己在工作中无法使用 Slack——微软将其列入了禁止/不鼓励使用的软件及在线服务清单。外媒 GeekWire 获得了这份清单并已核实过它的真实性。 先来说说被称为“美国版钉钉”的 Slack,它集聊天群组、大规模工具集成、文件整合和统一搜索的功能于一身,可以把各种碎片化的企业沟通和协作集中到一起。Slack 创建于 2014 年,被认为是“有史以来发展最快的 SaaS 公司”。今年 6 月 20 日,Slack 在纽交所直接上市,上市首日股份就大涨近 50%。 作为竞争对手,微软和 Slack 之间的拉锯战已经持续了两年多。微软在 2017 年推出 Teams 时,Slack 就在纽约时报刊登了一整页的讽刺广告以示祝贺。去年,微软在年度 10-K 报告中正式将 Slack 列入竞争对手名单。 有意思的是,今年 4 月,Slack 推出了一系列与 Microsoft Office 365 的集成。不过,Slack 没有直接与微软合作,而是依靠后者的 API 和其他服务来整合产品。没过多久,Slack 就在 IPO 文件中正式将微软列为“主要竞争对手”。 微软此次将 Slack 放入禁用清单,可以说是在预料之中。显然有竞争因素存在,但微软给出的理由还包括安全因素,它认为 Slack 的部分服务“无法提供必要的控件来正确保护 Microsoft 知识产权(IP)”。 除了 Slack,被禁用的服务还包括 Grammarly 语法检查程序和 Kaspersky 安全软件等工具。 另一方面,有部分软件被微软列入“不鼓励使用”的范畴,其中包括亚马逊网络服务、谷歌文档、PagerDuty,甚至是 GitHub 的云版本。 最令人意外的是 GitHub 也在此列,毕竟微软去年才以 75 亿美金的高昂价格收购 GitHub。 不过对于 GitHub 来说,这不是一个彻头彻尾的禁令。微软警告员工不要使用 GitHub 的云版本,以保障高度机密类型的信息或代码的安全。内部 GitHub 版本仍然可以正常使用。 此外,亚马逊网络服务是微软 Azure 云平台的竞争对手,谷歌文档则是 Office 365 的竞争对手,但微软对这二者没有对 Slack 那么狠,只表示“不鼓励使用”,但同时“强烈建议员工先启动 Azure 迁移计划”。 “这不仅仅是谷歌试图从存储在他们服务器上的数据中找到商业机密的风险”, 曾在安全技术领域工作了 20 年的 Christopher Budd 认为,微软也有可能会面临黑客入侵犯罪或政治间谍带来的的风险。 GeekWire 指出,“微软希望将员工留在生态系统中,但这也是一种风险。Slack 是开发人员、工程师和其他技术人员的热门话题,对这些高价值的员工使用的工具施加太多限制可能是一种错误”,并预测该行为可能会对竞争激烈的招聘环境产生影响。 参考:GeekWire

优秀的个人博客,低调大师

Java值类型的当前状态

甲骨文一直在努力向Java中加入值类型,这项工作包含在Valhalla项目中,Valhalla是“一个探索和孵化候选高级Java虚拟机和语言特性的地方”。InfoQ之前已经报道了这个项目以及向Java中引入值类型的工作进展。 值类型旨在成为未来Java版本中的第三种数据类型,当前已有的两种类型分别是原始类型和对象引用。经常有人说,Java值类型应该“写起来像类,用起来像int”。这意味着它们应该是一个复合数据类型(代码与类相似),只是少了标识,并且如果有可能的话不提供对象头部(像int一样)。 以Java平台目前的情况来看,运行环境不会提供这种对内存布局的底层控制形式——它可能类似于C语言当中的struct,但JVM并不支持。所以,在当前版本中,所有组合数据类型都必须通过引用来访问。 如果要将Java平台扩展为包含值类型,那么自然会产生这样的问题:值类型是否可用作类型参数(type parameter)值。如果不是,那么这似乎大大限制了它们的用处。因此,值类型的设计一直包含这样的假设,即在增强的泛型中,值类型可以作为类型参数的值。 这与Java类型系统缺少顶级类型(top type)有关——Object和int不存在共同的超类型。换句话说,Java类型系统不是单根(single-rooted)的。由于这个原因,Java泛型类型的类型参数只能是引用类型。如果可能引入值类型,那么就必须解决这个问题(并且还要考虑泛型的类型擦除)。 从Java 8开始,其设计目标之一就是提高JDK中某些引用类型可能会在后续版本中发展成为值类型的可能性,所以这也是需要考虑的一个设计约束。两个明显的候选例子是Optional和LocalDateTime——它们都具有值类型所期望的属性。例如,它们都是不可变的,并且都具备了值类型语义,即当且仅当所有字段的值都相等时,两个对象才相等。 如果JDK类型有可能演变为值类型,那么问题来了:值类型在类文件中应该怎样表示?在当前版本的JVM中,引用类型为L<qualified type>;,所以Optional使用描述符Ljava/util/Optional;来表示。在过去的几年中,为了确定在类文件中如何表示值类型,开发者们已经评审过不同的提案和设计方案。 甲骨文JVM架构师John Rose最近简要描述了过去的历史、已经尝试过的各种方案以及遇到的问题。 当前的方向继续使用与引用类型相同的描述符语法来描述值类型(而不是像Qjava/util/Optional;这样)。这种方法具有保持向后兼容的优点,向后兼容从一开始就是Java的首要设计原则。 但是,该设计存在一个问题,因为类型描述符实际上是一种不完整的描述,因为它不区分特定类型是否是真正的值类型。为了解决这个问题,目前的提议是对JVM类文件格式进行扩展,增加一个新的片段(ValueTypes),该片段详细说明文件中的哪些类型实际上是值类型。John Rose已经对此进行了详细的描述,不过v​​alhalla-dev邮件列表上仍然在针对一些细节问题进行热烈的讨论。Stephen Colebourne和其他人最近还讨论了Java值类型的可空性(nullability)问题。 与此同时,实现方面的工作进展顺利,预计适用于JVM研究者、框架作者和喜欢跟字节码打交道的人的原型将很快推出。通常情况下,对于主要特性,甲骨文不会承诺在任何特定Java版本或特定日期交付预期功能。 欢迎工作一到五年的Java工程师朋友们加入Java架构开发:468947140 点击链接加入群聊【Java-BATJ企业级资深架构】:https://jq.qq.com/?_wv=1027&k=5zMN6JB 本群提供免费的学习指导 架构资料 以及免费的解答 不懂得问题都可以在本群提出来 之后还会有职业生涯规划以及面试指导

优秀的个人博客,低调大师

FragmentTabHost中切换Fragment保存状态

import android.content.Context; import android.content.res.TypedArray; import android.os.Bundle; import android.os.Parcel; import android.os.Parcelable; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentTransaction; import android.util.AttributeSet; import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; import android.widget.LinearLayout; import android.widget.TabHost; import android.widget.TabWidget; import java.util.ArrayList; public class FragmentTabHost extends TabHost implements TabHost.OnTabChangeListener{ private final ArrayList<TabInfo> mTabs = new ArrayList<>(); private FrameLayout mRealTabContent; private Context mContext; private FragmentManager mFragmentManager; private int mContainerId; private OnTabChangeListener mOnTabChangeListener; private TabInfo mLastTab; private boolean mAttached; static final class TabInfo { private final String tag; private final Class<?> clss; private final Bundle args; private Fragment fragment; TabInfo(String _tag, Class<?> _class, Bundle _args) { tag = _tag; clss = _class; args = _args; } } static class DummyTabFactory implements TabContentFactory { private final Context mContext; public DummyTabFactory(Context context) { mContext = context; } @Override public View createTabContent(String tag) { View v = new View(mContext); v.setMinimumWidth(0); v.setMinimumHeight(0); return v; } } static class SavedState extends BaseSavedState { String curTab; SavedState(Parcelable superState) { super(superState); } private SavedState(Parcel in) { super(in); curTab = in.readString(); } @Override public void writeToParcel(Parcel out, int flags) { super.writeToParcel(out, flags); out.writeString(curTab); } @Override public String toString() { return "FragmentTabHost.SavedState{" + Integer.toHexString(System.identityHashCode(this)) + " curTab=" + curTab + "}"; } public static final Creator<SavedState> CREATOR = new Creator<SavedState>() { public SavedState createFromParcel(Parcel in) { return new SavedState(in); } public SavedState[] newArray(int size) { return new SavedState[size]; } }; } public FragmentTabHost(Context context) { // Note that we call through to the version that takes an AttributeSet, // because the simple Context construct can result in a broken object! super(context, null); initFragmentTabHost(context, null); } public FragmentTabHost(Context context, AttributeSet attrs) { super(context, attrs); initFragmentTabHost(context, attrs); } private void initFragmentTabHost(Context context, AttributeSet attrs) { TypedArray a = context.obtainStyledAttributes(attrs, new int[] { android.R.attr.inflatedId }, 0, 0); mContainerId = a.getResourceId(0, 0); a.recycle(); super.setOnTabChangedListener(this); } private void ensureHierarchy(Context context) { // If owner hasn't made its own view hierarchy, then as a convenience // we will construct a standard one here. if (findViewById(android.R.id.tabs) == null) { LinearLayout ll = new LinearLayout(context); ll.setOrientation(LinearLayout.VERTICAL); addView(ll, new LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); TabWidget tw = new TabWidget(context); tw.setId(android.R.id.tabs); tw.setOrientation(TabWidget.HORIZONTAL); ll.addView(tw, new LinearLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT, 0)); FrameLayout fl = new FrameLayout(context); fl.setId(android.R.id.tabcontent); ll.addView(fl, new LinearLayout.LayoutParams(0, 0, 0)); mRealTabContent = fl = new FrameLayout(context); mRealTabContent.setId(mContainerId); ll.addView(fl, new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, 0, 1)); } } /** * @deprecated Don't call the original TabHost setup, you must instead * call {@link #setup(Context, FragmentManager)} or * {@link #setup(Context, FragmentManager, int)}. */ @Override @Deprecated public void setup() { throw new IllegalStateException( "Must call setup() that takes a Context and FragmentManager"); } public void setup(Context context, FragmentManager manager) { ensureHierarchy(context); // Ensure views required by super.setup() super.setup(); mContext = context; mFragmentManager = manager; ensureContent(); } public void setup(Context context, FragmentManager manager, int containerId) { ensureHierarchy(context); // Ensure views required by super.setup() super.setup(); mContext = context; mFragmentManager = manager; mContainerId = containerId; ensureContent(); mRealTabContent.setId(containerId); // We must have an ID to be able to save/restore our state. If // the owner hasn't set one at this point, we will set it ourself. if (getId() == View.NO_ID) { setId(android.R.id.tabhost); } } private void ensureContent() { if (mRealTabContent == null) { mRealTabContent = (FrameLayout)findViewById(mContainerId); if (mRealTabContent == null) { throw new IllegalStateException( "No tab content FrameLayout found for id " + mContainerId); } } } @Override public void setOnTabChangedListener(OnTabChangeListener l) { mOnTabChangeListener = l; } public void addTab(TabSpec tabSpec, Class<?> clss, Bundle args) { tabSpec.setContent(new DummyTabFactory(mContext)); String tag = tabSpec.getTag(); TabInfo info = new TabInfo(tag, clss, args); if (mAttached) { // If we are already attached to the window, then check to make // sure this tab's fragment is inactive if it exists. This shouldn't // normally happen. info.fragment = mFragmentManager.findFragmentByTag(tag); if (info.fragment != null && !info.fragment.isDetached()) { FragmentTransaction ft = mFragmentManager.beginTransaction(); // ft.detach(info.fragment); ft.hide(info.fragment); ft.commitAllowingStateLoss(); } } mTabs.add(info); addTab(tabSpec); } @Override protected void onAttachedToWindow() { super.onAttachedToWindow(); String currentTab = getCurrentTabTag(); // Go through all tabs and make sure their fragments match // the correct state. FragmentTransaction ft = null; for (int i=0; i<mTabs.size(); i++) { TabInfo tab = mTabs.get(i); tab.fragment = mFragmentManager.findFragmentByTag(tab.tag); // if (tab.fragment != null && !tab.fragment.isDetached()) { if (tab.fragment != null) { if (tab.tag.equals(currentTab)) { // The fragment for this tab is already there and // active, and it is what we really want to have // as the current tab. Nothing to do. mLastTab = tab; } else { // This fragment was restored in the active state, // but is not the current tab. Deactivate it. if (ft == null) { ft = mFragmentManager.beginTransaction(); } // ft.detach(tab.fragment); ft.hide(tab.fragment); } } } // We are now ready to go. Make sure we are switched to the // correct tab. mAttached = true; ft = doTabChanged(currentTab, ft); if (ft != null) { ft.commit(); mFragmentManager.executePendingTransactions(); } } @Override protected void onDetachedFromWindow() { super.onDetachedFromWindow(); mAttached = false; } @Override protected Parcelable onSaveInstanceState() { Parcelable superState = super.onSaveInstanceState(); SavedState ss = new SavedState(superState); ss.curTab = getCurrentTabTag(); return ss; } @Override protected void onRestoreInstanceState(Parcelable state) { SavedState ss = (SavedState)state; super.onRestoreInstanceState(ss.getSuperState()); setCurrentTabByTag(ss.curTab); } @Override public void onTabChanged(String tabId) { if (mAttached) { FragmentTransaction ft = doTabChanged(tabId, null); if (ft != null) { ft.commit(); } } if (mOnTabChangeListener != null) { mOnTabChangeListener.onTabChanged(tabId); } } private FragmentTransaction doTabChanged(String tabId, FragmentTransaction ft) { TabInfo newTab = null; for (int i=0; i<mTabs.size(); i++) { TabInfo tab = mTabs.get(i); if (tab.tag.equals(tabId)) { newTab = tab; } } if (newTab == null) { throw new IllegalStateException("No tab known for tag " + tabId); } if (mLastTab != newTab) { if (ft == null) { ft = mFragmentManager.beginTransaction(); } if (mLastTab != null) { if (mLastTab.fragment != null) { // ft.detach(mLastTab.fragment); ft.hide(mLastTab.fragment); } } if (newTab != null) { if (newTab.fragment == null) { newTab.fragment = Fragment.instantiate(mContext, newTab.clss.getName(), newTab.args); ft.add(mContainerId, newTab.fragment, newTab.tag); } else { // ft.attach(newTab.fragment); ft.show(newTab.fragment); } } mLastTab = newTab; } return ft; } }

优秀的个人博客,低调大师

hive中表状态数据的获取

在做容量规划的时候,我们需要关注hive中表的占用空间大小,文件数量,平均文件大小,已及存储格式,虽然在hive中也有statistcs的功能,但是值并准确(相比mysql的show table status相差很多) 我们可以通过一些简单地方法去拿到这个值,比如通过hadoop fs -du 来获取表占用的空间大小,通过hadoop fs -count获取表的文件数量,然后定期取值并load到数据库中。 在元数据库中,通过创建view来获取数据库,hdfs路径,表类型,存储格式等信息 1 2 3 4 5 6 7 8 9 10 11 12 13 CREATE OR REPLACE VIEW table_location_type AS SELECT CONCAT_WS( '.' ,a. NAME ,b.TBL_NAME) AS db_table,SUBSTR(c.LOCATION,18) AS db_location,b.TBL_TYPE AS type,SUBSTRING_INDEX(c.INPUT_FORMAT, '.' ,-1) AS IN_FOR FROM dbsa,tblsb,sdsc WHERE a.DB_ID=b.DB_ID AND b.SD_ID=c.SD_ID; 数据如下: select * from table_location_typelimit5; + ----------------------------------+---------------------------------------------------------+---------------+-------------------+ |db_table|db_location|type|IN_FOR| + ----------------------------------+---------------------------------------------------------+---------------+-------------------+ |xxxx|/bip/hive_warehouse/cdnlog.db/dnion_log_origin|MANAGED_TABLE|TextInputFormat| |xxxx|/bip/hive_warehouse/cdnlog.db/chinacache_log_origin|MANAGED_TABLE|TextInputFormat| |xxxx|/bip/hive_warehouse/cdnlog.db/chinanetcenter_log_origin|MANAGED_TABLE|TextInputFormat| |xxxxx|/bip/hive_warehouse/cdnlog.db/dnion_log|MANAGED_TABLE|RCFileInputFormat| |xxxx|/bip/hive_warehouse/cdnlog.db/chinanetcenter_log|MANAGED_TABLE|RCFileInputFormat| + ----------------------------------+---------------------------------------------------------+---------------+-------------------+ 然后通过和我们自己收集的信息做join就可以获取相关的数据: 比如文件数量最多top 20 1 2 3 select a.db_table as tb,round(b. size /(1024*1024*1024),2) as size ,c. size as num,round(b. size /(c. size *1024*1024),2) as avg , a.type,a.in_for from table_location_typea,file_sizeb,file_numc where a.db_location=b.location and a.db_location=c.location and c.dt= '20140325' and b.dt= '20140325' and c. size >0 and b. size >1000000000 order by c. size +0 desc limit20; 在实际的使用中,我们收集了文件数最多的表,占用空间最大的表,平均文件最小的表,并通过报表的形式方式处理,这样就可以简单了解到hive中表的一些信息,另外还会收集一些job的信息,比如job的map和reduce的数量,使用情况等,对job做详细的分析和优化。 报表如下: 本文转自菜菜光 51CTO博客,原文链接:http://blog.51cto.com/caiguangguang/1385603,如需转载请自行联系原作者

资源下载

更多资源
Mario

Mario

马里奥是站在游戏界顶峰的超人气多面角色。马里奥靠吃蘑菇成长,特征是大鼻子、头戴帽子、身穿背带裤,还留着胡子。与他的双胞胎兄弟路易基一起,长年担任任天堂的招牌角色。

Nacos

Nacos

Nacos /nɑ:kəʊs/ 是 Dynamic Naming and Configuration Service 的首字母简称,一个易于构建 AI Agent 应用的动态服务发现、配置管理和AI智能体管理平台。Nacos 致力于帮助您发现、配置和管理微服务及AI智能体应用。Nacos 提供了一组简单易用的特性集,帮助您快速实现动态服务发现、服务配置、服务元数据、流量管理。Nacos 帮助您更敏捷和容易地构建、交付和管理微服务平台。

Rocky Linux

Rocky Linux

Rocky Linux(中文名:洛基)是由Gregory Kurtzer于2020年12月发起的企业级Linux发行版,作为CentOS稳定版停止维护后与RHEL(Red Hat Enterprise Linux)完全兼容的开源替代方案,由社区拥有并管理,支持x86_64、aarch64等架构。其通过重新编译RHEL源代码提供长期稳定性,采用模块化包装和SELinux安全架构,默认包含GNOME桌面环境及XFS文件系统,支持十年生命周期更新。

WebStorm

WebStorm

WebStorm 是jetbrains公司旗下一款JavaScript 开发工具。目前已经被广大中国JS开发者誉为“Web前端开发神器”、“最强大的HTML5编辑器”、“最智能的JavaScript IDE”等。与IntelliJ IDEA同源,继承了IntelliJ IDEA强大的JS部分的功能。

用户登录
用户注册