Get the file name from the file path Solution: var fileName = fullPath.replace(/^.*[\\\/]/, ''); // This will handle both \ or / in paths.…
Stick button in right side in html Solution: //In the html <div class="float__button" > </div> // In the css file .float__button{ margin-right: 5%; float: right; } Set the size of textarea in CSS. Solution: //In the html <div clas…
Web Scraping爬虫 for Mac urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:581)> Solution:  if 1) does not work, then try to use 2).  Reference is here. 1) pip install --upgrade certifi 2) open /A…
模板: Split string into parts based on new line in java Solution:   Reference is here. 1) get out of the first part of a string until meet "<" Solution:   Reference is public String[] split(String regex). 1)  s = "boo:and:foo";     St…
在对Set进行方法扩展的时候,无法覆盖size属性 情景:定义一个SingletonSet,继承自Set,size只能为1,并且不能add和remove //首先是extend函数 var extend = (function () { //检查是否存在bug for (var p in { toString: null }) { //如果进来了,那说明没有bug return function extend(o) { for (var i = 1; i < arguments.length;…
JavaScript is a general purpose programming language that was introduced as the page scripting language for Netscape Navigator. It is still widely believed to be a subset of Java, but it is not. It is a Scheme-like language with C-like syntax and sof…
Outline Sometimes we cannot handle some conditions or problems with Webdriver, web controls don’t react well against selenium commands. In this kind of situations, we use Javascript. It is useful for custom synchronizations, hide or show the web elem…
http://www.powerobjects.com/2015/09/23/dynamics-crm-alert-and-notification-javascript-methods/ Before CRM 2013, if you wanted to alert a user on a form within the browser, the only method available was the standard JavaScript alert. This method would…
Shallow copy pattern function extend(parent, child) { var i; child = child || {}; for (i in parent) { if (parent.hasOwnProperty(i)) { child[i] = parent[i]; } } return child; } Deep copy pattern function extendDeep(parent, child) { var i, toStr = Obje…
JavaScript 数组map()方法创建一个新的数组使用调用此数组中的每个元素上所提供的函数的结果.语法 ? 1 array.map(callback[, thisObject]); 下面是参数的详细信息: callback : 从当前的元素函数产生新的数组的元素. thisObject : 对象作为该执行回调时使用 返回值: 返回创建数组兼容性: 这种方法是一个JavaScript扩展到ECMA-262标准;因此它可能不存在在标准的其他实现.为了使它工作,你需要添加下面的脚本代码在顶部:…