option

webpack打包 The 'mode' option has not been set, webpack will fallback to

我的未来我决定 提交于 2019-12-03 07:50:07
webpack 打包报错 The 'mode' option has not been set, webpack will fallback to 'production' for,Module not found: Error: Can't resolve,WARNING in configuration 运行环境: windows nodejs v10.15.3 webpack v4.38.0 我先全局安装了 webpack 和 webpack-cli: npm install -g webpack npm install -g webpack-cli 然后运行 webpack 去打包时报错: ​ 仔细看 webpack 官网手册发现,从4.0开始,运行 webpack 时一定要加参数 --mode development [开发环境 ] 或者 -- mode production [ 生产环境 ] : 不使用配置文件的用法 webpack <entry> [<entry>] -o <output> <entry> 一个文件名或一组被命名的文件名,作为构建项目的入口起点。你可以传递多个入口(每个入口在启动时加载)。如果传递一个形式为 <name> = <request> 的键值对,则可以创建一个额外的入口起点。它将被映射到配置选项(configuration option)的

Get Financial Option Data with YQL

自作多情 提交于 2019-12-03 07:48:53
I am using YQL to retrieve Financial Option data. Something like: select * from yahoo.finance.options where symbol="AAPL" and expiration="2011-07" However, the above query returns an optionsChain of data. Is there a way to retrieve just the record for a specific option symbol, e.g. symbol=AAPL110716C00155000 ? Thanks for your time. You can apply a "local filter", for your desired symbol, on the result set brought back from yahoo.finance.options in addition to the "remote filters" ( symbol and expiration ). select option from yahoo.finance.options where symbol = "AAPL" and expiration = "2011-07

Slick left outer join fetching whole joined row as option

柔情痞子 提交于 2019-12-03 07:30:41
问题 My join looks like this: def byIdWithImage = for { userId <- Parameters[Long] (user, image) <- Users leftJoin RemoteImages on (_.imageId === _.id) if user.id === userId } yield (user, image) but slick fails at runtime when user.imageId is null [SlickException: Read NULL value for column RemoteImage.url] Changing the yield to } yield (user, image.?) gives me a compile time exception, it only works on individual columns could not find implicit value for evidence parameter of type scala.slick

Convert Option to Either in Scala

谁说我不能喝 提交于 2019-12-03 06:47:59
问题 Suppose I need to convert Option[Int] to Either[String, Int] in Scala. I'd like to do it like this: def foo(ox: Option[Int]): Either[String, Int] = ox.fold(Left("No number")) {x => Right(x)} Unfortunately the code above doesn't compile and I need to add type Either[String, Int] explicitly: ox.fold(Left("No number"): Either[String, Int]) { x => Right(x) } Is it possible to convert Option to Either this way without adding the type ? How would you suggest convert Option to Either ? 回答1: No, if

jQuery Chosen: how to select 1 option value and remove the same one in another select-menu?

霸气de小男生 提交于 2019-12-03 06:33:43
I've put 2 elements next to eachother. Both of them are using the jQuery Chosen plugin. This is the code: <div class="wrapper"> <select data-placeholder="Number row 1" style="width:350px;" multiple class="chzn-select"> <option value=""></option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> </select> <select data-placeholder="Number row 2" style="width:350px;" multiple class="chzn-select"> <option value=""></option> <option value="1">1</option> <option value="2">2<

Check if a string is blank or doesn't exist in Scala

心已入冬 提交于 2019-12-03 05:40:16
问题 I have an Option[String] . I want to check if there is a string exists and if it's exists its not blank. def isBlank( input : Option[String]) : Boolean = { input.isEmpty || input.filter(_.trim.length > 0).isEmpty } Is there is a better way of doing this in Scala ? 回答1: What you should do is check using exists . Like so: myOption.exists(_.trim.nonEmpty) which will return True if and only if the Option[String] is not None and not empty. 回答2: An approach based in pattern matching, def isBlank(

购物地址选择下拉列表练习

☆樱花仙子☆ 提交于 2019-12-03 05:36:25
<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title></title> <script> window.onload = function(){ var citySelect = document.getElementById("city"); citySelect.innerHTML = "<option value=cd>成都</option><option value=my>绵阳</option><option value=ls>乐山</option>"; } function changeCity(obj){ var citySelect = document.getElementById("city"); if(obj.value == "sc"){ citySelect.innerHTML = "<option value=cd>成都</option><option value=my>绵阳</option><option value=ls>乐山</option>"; } else if(obj.value == "gz"){ citySelect.innerHTML = "<option value=gy>贵阳</option><option value=zy>遵义</option>

How to make the f.select rails selected

与世无争的帅哥 提交于 2019-12-03 04:59:47
It's my code: <%= f.select :area, options_for_select([['a','a'],['b','b'],['c','c']]), {}, {:class => 'span3 controls controls-row'}, :selected => params[:area] %> and result is: ArgumentError in Users#edit Showing /home/airson/rails_projects/friends_of_local/app/views/users/edit.html.erb where line #17 raised: wrong number of arguments (5 for 4) why.....@@? No need to use :selected just pass your params[:area] alone to options_for_select as a second argument: <%= f.select :area, options_for_select([['a','a'],['b','b'],['c','c']], params[:area]), {}, { :class => 'span3 controls controls-row' }

封装原生JavaScript的ajax

时光毁灭记忆、已成空白 提交于 2019-12-03 04:35:41
function obj2str(data) { data = data || {}; // 如果没有传参, 为了添加随机因子,必须自己创建一个对象 data.t = new Date().getTime(); var res = []; for (var key in data){ //在URL中是不可以出现中文的,如果出现了中文需要转码,可以调用encodeURIComponent方法,URL中只可以出现字母、数字、下划线 res.push(encodeURIComponent(key)+"="+encodeURIComponent(data[key])); } return res.join("&"); } function myAjax(option){ var params = obj2str(option.data);//key=value&key=value; var xmlhttp,timer; if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); }else{// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } if

echarts 图表 pc && 移动端自适应方案

天涯浪子 提交于 2019-12-03 04:16:53
因为公司主要做前端数据可视化项目的,因此有些项目需要有大屏展示的效果,所以一般公司的项目,设计那边给出的设计稿都是 1920*1080 的。 数据可视化,肯定是离不开数据图表的展示,所以有些图表,我们在技术选型上就用了开源的 echarts。 如果只是单纯的做固定尺寸的大屏页面的话,做起来肯定是很简单的,直接照着设计稿的尺寸无脑的还原就行了。 但是实际情况下,用户的需求是复杂多变的,比如最近做的这个项目,主要是三维的模型展示+二维的图表展示。但是客户的需求是,必须要适配移动端和pc端不同尺寸的设备。这个需求咋一听很无脑,细想一下,确实很无脑。 但是客户的需求,我们肯定是要解决的对不对,于是就寻找解决的方案。 首先对于 3d 拓扑图展示区域,适配起来很简单,因为我们用的是浏览器中的 webgl 技术,我们的场景的就是绘制在那块 canvas 上面的,虽然根据尺寸不同的设备,我们的 canvas 大小势必要发生变化,但是没关系,我们监听一下窗口的 resize 事件,然后动态的获取 canvas 元素尺寸,而一般的 webgl 三维框架,都会对这种尺寸变化作出适配。 比如比较有名的 webgl 框架 three.js,就是采用下面这种方式,针对 canvas 尺寸变化的时候,作出适配: function resizeRendererToDisplaySize ( renderer )