Posts

Showing posts from September, 2012

scala - what is the scalaz filterM method? -

this scalaz tutorial provides example of using filterm method, not explain it. list(1, 2, 3) filterm { x => list(true, false) } res19: list[list[int]] = list(list(1, 2, 3), list(1, 2), list(1, 3), list(1), list(2, 3), list(2), list(3), list()) i see can pass boolean list of size. filterm method? also, there book/tutorial of scalaz bit more explanations? this pretty old question. i'll answer in case else wondering. you can find pretty explanation learn haskell good! . search filterm in link referenced. in book, says following (you can kind of make out haskell syntax): the filter function pretty bread of haskell programming (map being butter). takes predicate , list filter out , returns new list elements satisfy predicate kept. type this: filter :: (a -> bool) -> [a] -> [a] the predicate takes element of list , returns bool value. now, if bool value returned monadic value? whoa! is, if came context? work? instance, if every true o

sql server - T-SQL : Script to create view with columns from a select statement -

i have bulk views create entire database. to create view general syntax follows: create view [table_name] select [column1], [column2], [column3], [column4] [table_name] check option; i set column names in script above querying column names ( [colulmn1] , [column2] , etc) information_schema.columns . is there way achieve table name? coalesce friend programmer. want csv list of columns. using dynamic sql can auto generate rest of code. declare @columns varchar(max) select @columns = null select @columns = coalesce(@columns+',','')+c.name syscolumns c inner join sysobjects o on c.id = o.id o.name = 'change me table name' select @columns select ' create view ' + 'cool view name' + ' ' + ' select ' + @columns + ' '+ ' change me table name '+ ' check option;' edit i purposely didn't declare view anywhere. if want declare view execute scripts so. but should n

Django {% if custom_template_tag > 0 %} does not work -

i've got these template tags @register.assignment_tag def test1(): return 2 @register.simple_tag def test2(): return 2 in template i've got this {% test1 test1_var %} {% if test1_var > 0 %}test1{% endif %} {% if test2 > 0 %}test2{% endif %} results in test1 what want template tag appears if greater 0, cannot believe assignment_tag right solution that. why test2 not work? the test2 inside if statement not call template tag; can refer (non-existent) context variable. that's why assignment tag works, because set such variable. if don't assignment tag, might consider doing whole comparison inside tag, outputs test1/test2 value directly.

r - sum in function not working properly -

this question has answer here: dynamically select data frame columns using $ , vector of column names 4 answers i want create function count values in variable in subsetted dataset, function not working supposed to. selected_cyl_6 <- subset(mtcars, mtcars$cyl==6) selected_cyl_4 <- subset(mtcars, mtcars$cyl==4) count <- function(group,variable) { sum(group$variable == 4) } count(selected_cyl_6,gear) # [1] 0 the answer should 4. however, if use sum directly correct answer sum(selected_cyl_6$gear==4) # [1] 4 another example count(selected_cyl_4,gear) # [1] 0 sum(selected_cyl_4$gear==4) # [1] 8 what doing wrong? it's using dollar sign shortcut in function. see fortunes::fortune(343) . some options, using bracket notation. first, standard evaluation give variable name in quotes when use function. count <- function(group, va

C++ stuck in while loop -

this question has answer here: why non-equality check of 1 variable against many values returns true? 2 answers hello doing simple while loop in c++ , can not figure out why stuck in when proper input give. string itemtype = ""; while(!(itemtype == "b") || !(itemtype == "m") || !(itemtype == "d") || !(itemtype == "t") || !(itemtype == "c")){ cout<<"enter item type-b,m,d,t,c:"<<endl; cin>>itemtype; cout<<itemtype<<endl; } cout<<itemtype; if can point out on looking i'd appreciate it. suppossed exit when b,m,d,t or c entered. your problem in logic. if @ conditions while loop, loop repeat if item type not "b" or not "m" or not "d" etc. means if item type "

linux - Copying a local file from Mac to an ssh session in terminal -

i'm new using bash commands , having trouble. i'm ssh'ing linux box contains of work files. have local file on mac need copy onto server. here steps i've gone through far: 1) ssh usrname@orgname.edu 2) entered password 3) pwd 4) working directory: home/usrname i'm stuck after this. have local folder in documents in mac. want copy working directory on server i"m ssh'ed into. appreciate help. when ssh remote machine, it's if sitting in front of other machine , execute commands in it. while in state, cannot copy file (or from) it. instead have use different tool, scp , belongs in ssh family , in fact calls ssh behind scenes. how copy local directory remote machine: scp -rp /path/to/local/dir usrname@orgname.edu:/path/to/remote/dir i used -r mode (which stands recursive) copy directory recursively. see manual of scp more details

javascript - Is it possible to add a custom hover color to Raised Buttons? -

working on project using material-ui library of components , i've gotten request custom button hover color outside of normal convention of mui theme. i found relevant block of code in raised button source, https://github.com/callemall/material-ui/blob/master/src/raisedbutton/raisedbutton.js#l98 . setting custom labelcolor change hover state, still not satisfy current need have button hover color different of label color. overlay: { height: buttonheight, borderradius: borderradius, backgroundcolor: (state.keyboardfocused || state.hovered) && !disabled && fade(labelcolor, amount), transition: transitions.easeout(), top: 0, }, is there way override overlay background color other way can use separate custom color? to clarify i'm looking using inline styling or through overriding prop on button. appending class , using external css not option. i able solve giving classname prop raisedbutton component , specifying :hover attribut

How to retrieve help for Pandas methods using '??' -

Image
i new pandas, trying learn basics lecture videos. in 1 of these presenter demonstrates 1 can call on methods using ??. example if have loaded dataframe df typing df. getitem ?? should print docstring source code console. great have doesn't work me! tried different variants of command , tried find comment online on this, without success. what need type in order retrieve docstring source code of pandas method? lot ! (i using python 3.5 , pycharm in case makes difference) i believe lecturer using ipython support dynamic object information . instance output in ipython when df.__getitem__?? see following: i recommend ipython interactive python development, you'll find lot of devs using data exploration , analysis, workbook useful saving commands , output

asp.net - RequiredFieldValidator not working with jQuery Plugins -

i using theme on asp.net webforms project contains , loads bootstrap/jquery 1.11 / jquery ui libraries on master page. using different plugins jquery datatables & appendgrid data display purpose. facing weird problem on pages if add requiredfieldvalidator control of controls, browser says "datatables not function" or "appendgrid not function". both libraries start working remove requiredfieldvalidator control page. issue can replicated on master page control page. code present in head tag <asp:placeholder runat="server"> <script type="text/javascript" src="/bundles/themejs?v=0"></script> <script type="text/javascript" src="/bundles/modernizr?v=0"></script> </asp:placeholder> <link href="/content/mycss" rel="stylesheet" /> <link rel="stylesheet" href="//cdn.datatables.net/1.10.9/css/jquery.datatables.min.css" typ

mod rewrite - Wordpress permalinks only work if logged in -

i have strange issue in wordpress (current version). when set custom permalink such /post/%post_id% , works only when logged in wordpress. when not logged in, 404 error (the route seems overwritten ?p=%post_id% fails match rewrite rules). i've tried sorts of things without success ( .htaccess ok , permissions fine). have idea? on top of that, if reset permalinks basic pattern ( ?p= etc.), these not work if not logged in either! this own stupidity! wordpress not allow access 'future' posts if not logged in or privileged, design. there ways override this. way chose force 'published' status future posts, want people see upcoming events.

apache - limitinternalrecursion wordpress permalinks -

i have nginx server proxy_pass-ing urls end in /blog ip address have wordpress instance running apache. the issue having when enable permalinks limitinternalrecursion error. when don't enable permalinks works expected , can access of blog pages through proxy. here contents of .htaccess file: # begin wordpress <ifmodule mod_rewrite.c> rewriteengine on rewritebase /blog/ rewriterule ^index\.php$ - [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /blog/index.php [l] </ifmodule> # end wordpress edit: i found out rewrite rule provided wordpress needed changed to: <ifmodule mod_rewrite.c> rewriteengine on rewritebase / rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.+)$ /index.php/$1 [l,qsa] </ifmodule>

visual studio - Distribute application with .NET and Crystal Runtime -

my visual studio app requires crystal runtime , .net framework. want user able use app without installing both of these. how can accomplish this? for reports, you'll need distribute free crystal reports viewer . for publishing .net apps without .net dependency, you'll want check this answer .net linker . although it's worth noting .net framework rather easy install , commonplace enough having end user install might better option.

python - How does one configure a proxy upstream of browsermob on osx? -

i'm looking configure upstream proxy browsermob, preferably programmatically within python or shell script. it doesn't python bindings browsermob include upstream-proxy configuration command or method. there method can use? the python bindings allow configure upstream proxy. when creating proxy using create_proxy , can set value of httpproxy ip address , port of upstream proxy (see params parameter on create_proxy details).

MySQL - How to count the number of inserts/updates to a table -

i'm looking mysql performance issues , generate report of how many inserts/updates made each table in database on period of time. i have lots of data available regarding server performance in general such rds's disk i/o metrics. mysql's show status command show queries , innodb_data_writes , these @ entire server level, not granular @ all. i'd detail down table level. perhaps there buried in information_schema or performance_schema databases can turn on or use? the performance schema keeps statistics of table io, on table (and index) granularity. see table performance_schema.table_io_waits_summary_by_table https://dev.mysql.com/doc/refman/5.7/en/table-waits-summary-tables.html#table-io-waits-summary-by-table-table

javascript - TypeError ... is not a Constructor -

i have following, start of parser function. has dependency on jquery extend. trying remove jquery dependency when do, 'vastparser not constructor'. think need rework how create base object make work. thoughts? var vastparser = $.extend(function(){}, { constructor: function() { // work once... if (vastparser._instance) { this.parse = null; this.parsevast = null; throw "vastparser singlton. access via getinstance()"; } vastparser._instance = this; console.log("vastparser instantiated.", "", "vast"); }, parse: function(xml) { console.log(xml); } }); // create static getinstance() vastparser.getinstance = function() { if (!vastparser._instance) { vastparser._instance = new vastparser(); } console.log(vastparser._instance); return vastparser._instance; }; // call it, prevent constructor being succeeding via direct calls again vastparser.getinstance(); per comment,

ios - XCode8, Swift 2.3 - dequeue reusableCellWithIdentifier breaking with Accessibility Inspector on -

device/environment information: i'm running on mbp xcode 8 gm, building on swift 2.3 ipad air 2 simulator running ios 9.2. same behavior manifests on other simulators, , did not manifest on xcode 7. more curiously, had 4 consecutive passes of test before first failure, , has failed consistently (n>20) since. i'm not sure changed, since working on different issue, plausibly have purged deriveddata and/or pods , rebuilt. in app, there's commentsviewcontroller dequeues commentstableviewcells in totally standard way nib that's registered variable ( reuseidentifier ) used dequeue cells. file has not changed in substantial amount of time. this registration of nib: [self.tableview registernib:[uinib nibwithnibname:@"commentstableviewcell" bundle:nil] forcellreuseidentifier:reuseidentifier]; and dequeueing of tableviewcell: commentstableviewcell *cell = [tableview dequeuereusablecellwithidentifier:reuseidentifier forindexpath:indexpath]; when runn

ruby on rails - Bizarre ActiveRecord issues - like generating invalid SQL -

recently deployed new version of our app, , since we've been seeing weird issues activerecord. example, here's snippet of query generates hundreds of times per day, correctly: `entries`.`style` t1_r25, `entries`.`pdf_visibility` , `entries`.`web_visibility` t1_r27 that's not typo, t1_r26 missing there although there's space should be. 1 time. that's not hand-written sql, either, that's activerecord writing query , deciding on placeholder variables. has botched other queries leaving things blank shouldn't blank (shouldn't possible), once in while. of time it's fine. we're seeing lot of instances complains things table_alias or reflection being undefined variable or method on false:falseclass. that's true...but thing falseclass should have been activerecord model. have no clue how of happening, or how possibly have written bug in our rails code of (especially invalid query above). we're on rails 4.1.16 (we upgraded 4.1.8 w

javascript - Nested Polymer Components Content Issue -

foo.html: <link rel="import" href="bar.html"> <dom-module id="p-foo"> <template> <p-bar> <content select=".mycontent"></content> </p-bar> </template> <script> polymer( { is: 'p-foo', } ) </script> </dom-module> bar.html: <dom-module id="p-bar"> <template> bar open <content select=".mycontent"></content> bar closed </template> <script> polymer( { is: 'p-bar', } ) </script> </dom-module> demo.html: <!doctype html> <html> <head> ... <link rel="import" href="foo.html"> </head> <body> <p-foo><div class="mycontent"><strong>hello<

Ruby - How do I shorten my method -

i have hash here: valid_choices = { 'r' => 'rock', 'p' => 'paper', 'sc' => 'scissors', 'l' => 'lizard', 'sp' => 'spock' } and method compares here: def win?(first, second) (first == 'sc' && second == 'p') || (first == 'p' && second == 'r') || (first == 'r' && second == 'l') || (first == 'l' && second == 'sp') || (first == 'sp' && second == 'sc') || (first == 'sc' && second == 'l') || (first == 'l' && second == 'p') || (first == 'p' && second == 'sp') || (first == 'sp' && second == 'r') || (first == 'r' && second == 'sc') end how can rewrite method in short concise code means same thing? idea? possi

java - LibGDX Multiple Fullscreen Windows -

i writing program display text on 2 monitors. right method launch libgdx window on both monitors, control each separately. however, when both in fullscreen, 1 window can have focus. out-of-focus window gets hidden. how solve this? specs: windows 10 java 1.8 libgdx 1.9.3, using lwjgl 3 backend code: in applicationlistener: @override public void show() throws runtimeexception { // throws exception if set go monitor 1 , not exist if (external && gdx.graphics.getmonitors().length < 2) throw new runtimeexception("cannot extend secondary monitor."); gdx.graphics.setfullscreenmode(gdx.graphics.getdisplaymode(gdx.graphics.getmonitors()[external ? 1 : 0])); } then, open window: @override public void openwindow(applicationlistener a) { lwjgl3windowconfiguration config = new lwjgl3windowconfiguration(); config.settitle(title); config.setwindowlistener(new lwjgl3windowlistener() { @override public void iconi

How can I change a body tag ID based on the page title in rails? -

using ruby on rails (5) want use if statement change id of body tag based on view rendering. want use background image on home page only, , not on other. want fill screen, if put on page it's self comes border. want attache body tag in application.html.erb view id tell css load background image. can't :title tell erb there , make statement true. i using provide on view page so: <% provide(:title, "home") %> then in application.html.erb page trying use if statement put in body tag or without css id background image based on provided :title, so: <!doctype html> <html> <head> <title><%= yield(:title) %></title> ... </head> <% if :title == "home" %> <body id="home-background"> <% else %> <body> <% end %> but doesn't seem work. title 'yield' , display in address bar, not in if statement. have tried put yield(:title) i

c# - Unity Add Default Namespace to Script Template? -

i got question. found unitys script template c# scripts. , script name write #scriptname# looks this: using unityengine; using system.collections; public class #scriptname# : monobehaviour { void start () { } void update () { } } than create script right name, there somthing #foldername# can put in right namespace dirrectly when creating script? there no built-in template variables #foldername# . according this post , there 3 magic variables. "#name#" "#scriptname#" "#scriptname_lower#" but can hook creation process of script , append namespace using assetmodificationprocessor . here example adds custom data created script. //assets/editor/keywordreplace.cs using unityengine; using unityeditor; using system.collections; public class keywordreplace : unityeditor.assetmodificationprocessor { public static void onwillcreateasset ( string path ) { path = path.replace( ".meta&quo

c# - POCO objects to UML representation -

i want correctly represent poco classes of entity framework in uml diagram. instance, have following relationships : public class schoolgroup { public int id {get;set;} public string groupname {get;set;} public subject groupsubject {get;set;} public teacher groupteacher {get;set;} public icollection<student> attendeestudents {get;set;} } here see school group entity contains of instances of subject, teacher , collection of students. according post difference between association, aggregation , composition : association - have relationship object. foo uses bar. composition - own object , responsible lifetime, when foo dies, bar. aggregation - have object i've borrowed else. when foo dies, bar may live on. so, how should represent schoolgroup in uml notation : composition or aggregation?

How do I calculate the sum of odd positive integers in MIPS? -

how calculate sum of odd positive integers in mips? have mips simulator @ home , use book verify work. university has computer lab has hardware provided outside company. idea suppose university "pimps out" hardware students through classes. part of problem me want verify code work properly, while using board @ school seems easier verify code works @ home. anyway, think code should read this: andi $t8, $s0, 1 #value $s0 , add 1 it. place in $t8 register bnez $t8 #this should determine if odd beqz $79 #this should determine if even: addi $t7, $t8, -1 bnez $t7, odd odd: addi $t6, $t7, -2 rt6, loop is there easier way this? need write main routine in @ end of execution perform v0 =the sum of odd positive integers between 1 , 1000 . $t8 $v0 in case. helpful suggestions considered closely. here's annotated code sum of both odd and values. has example of subroutine. .data array: .word 17767, 9158, 39017, 18547 .word 56401, 23807, 3

enterprise guide - Converting Excel file into SAS Dataset -

i'm trying import dataset sas enterprise guide, having trouble 'converting' excel file new sas dataset file. easy way this? this: libname libraryname 'filesource...' data project2 set exdata.project; <math> run; but file have data in excel file... , can't find it you close, if have ability access local files may work. may need play around sheet name. open library once it's assigned see how sas refers sheets. libname mylib xlsx 'path xlsx file'; data want; set mylib.sheet_name; run; libname mylib; otherwise if using eg on server , excel file local can import using gui tool.

java - Using a ToggleButton with a while loop JavaFX -

i'm making javafx application has toggle button. want while loop run long button toggled , stop when button toggled off. right in program, while loop activates when press button loop not stop when toggle off button. there i'm missing make loop stop when toggle off button? import java.util.hashmap; import java.util.map; import java.util.concurrent.atomic.atomicboolean; import javafx.application.application; import javafx.scene.scene; import javafx.scene.control.togglebutton; import javafx.scene.layout.borderpane; import javafx.stage.stage; public class main extends application{ private borderpane layout; private scene scene; togglebutton button = new togglebutton("button"); atomicboolean running = new atomicboolean(); public static void main(string[] args) { launch(args); } @override public void start(stage window) throws exception { layout = new borderpane(); scene = new scene(layout, 450, 80);

plsql - why no data is getting inserted for this stored pl/sql -

i have created following function check whether date exist in valid format. create or replace function dt_valid(p_dstrng in varchar2, p_dfmt in varchar2) return boolean v_dtval date; begin v_dtval := to_date (p_dstrng, p_dfmt); return true; exception when others return false; end; the function called pl/sql procedure fetches metadata information table tmp_to_dest , if field fetches date ( identified column transform_function = 'txt2dtf' ) checks format 'dd-mon-yy' rows column in table.it same column in table temp_med. if format not present row should inserted in data_quality_chk . create or replace procedure data_quality_check ( id number default null ) x varchar2(4000); begin o in ( select temp_field_name,dest_field_name,transform_function tmp_to_dest ) loop if o.transform_function = 'text2df' /// fetches column name metadata table tmp_to_dest , loop through each column check valid date m in

algorithm - Calculating cannibalization/attribution in R -

i have metric distributed among 4 categories a, b, c, d . over period of time track movement in metric each category. sum of these movements represents quantity has either left or entered system elsewhere ('external'). # setup ------------------------------------------------------------------- categories <- letters[1:4] set.seed(1) movements <- lapply(categories, function(...) {round(runif(10, -10,10))*10}) names(movements) <- categories movements[['external']] <- reduce(`+`, movements)*-1 problem <- as.data.frame(movements) problem b c d external 1 -50 -60 90 0 20 2 -30 -60 -60 20 130 3 10 40 30 0 -80 4 80 -20 -70 -60 70 5 -60 50 -50 70 -10 6 80 0 -20 30 -90 7 90 40 -100 60 -90 8 30 100 -20 -80 -30 9 30 -20 70 40 -120 10 -90 60 -30 -20 80 where categories have undergone positive movements , others have undergone negative movements, can

html - CSS for checked="checked" radio button not for only checked -

i have 1 css apply checked radio button not working when radio button checked checked="checked" try this.. input[type="radio"]:checked + label { background:red; } <input type="radio" name="r1" /> <label for="r1">radio</label>

Find and print the number between the parentheses in C++ using Regex -

i using code find number between parentheses in c++. i want number extracted out huge file contain these type of data: successful candidates indicated within paranthesis against roll number , marks given [maximum 5 marks] raise grades in hardship cases indicated plus[+] sign , grace marks cases indicated caret[+] sign 600023[545] 600024[554] 600031[605] 600052[560] *********** grade : d govt. degree boys college, surjani town 600060[877] *********** *********** *********** *********** ///// in 2nd iteration when [554] found. m.size() not reset 0 cause error. how can solve it? how search globally whole file numbers in parenthesis [###] #include <iostream> #include <fstream> #include <string> #include<conio.h> #include<regex> using namespace std; int main () { ifstream myfile; myfile.open("test.txt") ; if(!myfile) {

Find List of binded property in a Depedency Property in WPF C# -

i'm having wpf custom control <local:supercontrol> <local:supercontrol.sbitem> <multibinding stringformat="{}name: {0} ({1})"> <binding path="name" /> <binding path="id" /> </multibinding> </local:supercontrol.sbitem> </local:supercontrol> the viewmodel property public string name { get; set; } public string id { get; set; } consider value property name = "john"; id = "stk001"; the custom control public class supercontrol : itemscontrol { public static readonly dependencyproperty sbitemproperty = dependencyproperty.register("sbitem", typeof(string), typeof(bautocomplete), new propertymetadata(null)); public string sbitem { { return (string)getvalue(sbitemproperty); } set { setvalue(sbitemproperty, value); } } public override void onapplytemplate() { string name

django-rest-auth custom registration failed to save extra fields even after changing save() method -

i trying integrate user registration , login custom fields. using django-rest-auth. have added fields model , in modelserializer have inherited rest_auth.registration.serializers.registerserializer although registration process successful,but custom fields not getting saved. models.py from django.db import models phonenumber_field.modelfields import phonenumberfield class vendor(models.model): login_type = ( ('1', 'my_form'), ('2', 'facebook'), ('3', 'google'),) status = ( ('0', 'signed_up'), ('1', 'otp_verified'), ('2', 'activated'),) device_type_choices = ( ('1', 'android'), ('2', 'ios'),) phone = phonenumberfield(unique=true) device_token = models.charfield(max_length=250) device_type = models.charfield(max_length=1, choices=device_type_choices) login_t

php - How to use array value in where clause in SQL -

i have array $rest_id have 3 ids, when foreach , put in sql query there 1 value appears when debug it. here code. $ids = array(); foreach ($rest_id $value) { $ids[] = $value->id; $nearest_rest = db::select("select *, (3956 * 2 * asin(sqrt( power(sin(( 28.5812674 - lat) * pi()/180 / 2), 2) +cos( 28.5812674 * pi()/180) * cos(lat * pi()/180) * power(sin(( 77.3181059 - lng) * pi()/180 / 2), 2) ))) distance restaurant_details id in ('" . implode("','",$ids) . "') having distance order distance asc limit 1"); dd($nearest_rest); } i think need this, if want nearest restaurant out of 3 ids: $ids = array(); foreach ($rest_id $value) { $ids[] = $value->id; } $nearest_rest = db::select("select *, (3956 * 2 * asin(sqrt( power(sin(( 28.5812674 - lat) * pi()/180 / 2), 2) +cos( 28.5812674 * pi()/180) * cos(lat * pi()/180) * power(sin(( 77.3181059 - lng) * pi()/180 / 2), 2) ))) distance restaurant_details id

Iterating over object values in JavaScript -

this question has answer here: how properties values of javascript object (without knowing keys)? 19 answers what efficient / elegant way iterate object values in javascript? as example, assume following object: let myobj = {p1: "v1", p2: "v2"} ecmascript 2017: if target platform supports object.values : object.values(myobj).foreach(value => /* */) if need property names well, can use object.entries in combination array destructuring : object.entries(myobj).foreach(([key, value]) => /* */) ecmascript 5: if need backwards compatible , don't want use polyfill: object.keys(myobj).map(prop => myobj[prop]).foreach(value => /* */) older versions: note for...in statement iterates on prototype's properties well, need filter them out using object.prototype.hasownproperty . for (var key in myobj) { if (

c++ - Narrowing from literal doesn't cause warning -

int = 0; short b{a}; short c{0}; the compiler gives waring short b{a} . can understand this, because int narrowed short . however, doesn't give warning short c{0} , weird me. remember literal integers, type of 0 should @ least int . narrowing int short happening here. why doesn't compiler give warning? for short c{0}; , narrowing conversion doesn't occur. because 0 constant expression , can stored in short . (emphasis mine) list-initialization limits allowed implicit conversions prohibiting following: ... conversion integer or unscoped enumeration type integer type cannot represent values of original, except source constant expression value can stored in target type relevant explanations , examples standard, $8.6.4/7 list-initialization [dcl.init.list] : (emphasis mine) a narrowing conversion implicit conversion ... from integer type or unscoped enumeration type integer type cannot represent values of ori

devkit - Custom Icon for custom mule connector development -

i need change default icon of custom connector. tried @icon not supported 308 version. getting imported 3.6 version. so, how can change icon in mule 3.8. in package explorer there folder called icons , please replace icon image file file same resolution. if need more details please free ask me thank you

javascript - Jquery, on click on header, open panel body -

i have panel: <div class="panel"> <div class="panel-heading" style="cursor:pointer"> blablabla <div class="pull-right"><a href="#" data-perform="panel-collapse"><i class="ti-plus"></i></a> <a href="#" data-perform="panel-dismiss"></a></div> </div> <div class="panel-wrapper collapse" aria-expanded="true"> <div class="panel-body"> unicorn </div> </div> </div> i've wrote jquery: <script> $('.panel').on('click', function() { $(this).children().toggleclass('panel-wrapper collapse, panel-wrapper collapse in'); }); </script> but close panel, no matter i'm clicking it. want panel opens, if click on panel-heading. ( whole

mongodb - Clojure - Monger Operators - missing multiple field concat and query support with Date conversion -

i have data set on mongo like: {"month": 9, "year": 2015, "name": "mr a"} {"month": 9, "year": 2015, "name": "mr b"} {"month": 10, "year": 2015, "name": "mr b"} {"month": 11, "year": 2016, "name": "mr b"} i trying minimum date using monger, without luck. the best coming distinct month , year using: (mc/aggregate mongo-connection collection-name [{$group { :_id { :month "$month", :year "$year" } } }])) which gave result like: [{"_id":{"year":2016,"month":11}}, {"_id":{"year":2016,"month":10}}, {"_id":{"year":2016,"month":9}}] and using clojure libraries minimum date. there direct way using monger? to in monger sort result first year ascending, month ascending, pick first result. here's m

Python: Accessing YAML values using "dot notation" -

i'm using yaml configuration file. code load config in python: import os import yaml open('./config.yml') file: config = yaml.safe_load(file) this code creates dictionary. problem in order access values need use tons of brackets. yaml: mysql: user: pass: secret python: import os import yaml open('./config.yml') file: config = yaml.safe_load(file) print(config['mysql']['user']['pass']) # <-- i'd prefer (dot notation): config('mysql.user.pass') so, idea utilize pystache render() interface. import os import yaml open('./config.yml') file: config = yaml.safe_load(file) import pystache def get_config_value( yml_path, config ): return pystache.render('{{' + yml_path + '}}', config) get_config_value('mysql.user.pass', config) would "good" solution? if not, better alternative? additional question [solved] i've decided use ilja ever

vb.net - mschart: Could not load file or assembly 'System.Windows.Forms.DataVisualization - vs2015 - winform -

i have windows form application (framework 3.5) uses mscharts. since have upgraded our project vs2008 vs2015 following error on other computers deploy program (and mschart not installed): system.io.filenotfoundexception: not load file or assembly 'system.windows.forms.datavisualization', version=3.5.0.0, culture=neutral, publickeytoken=31bf3856ad364e35' or 1 of dependencies. system cannot find file specified. file name: 'system.windows.forms.datavisualization, version=3.5.0.0, culture=neutral, publickeytoken=31bf3856ad364e35' we using 'microsoft visual studio 2015 installer projects' create installer (.msi) program. in setup project i'm not seeing 'mschart/datavisualization' items in 'detected dependencies' list, maybe problem? don't know if required. thank you. had manually add .dll's assemblies in setup project.

jQuery add text to span when div is visible -

<div class="box"> <span class="test"></span> </div> <div class="row"></div> <input type="button" value="add" id="button"> <style type="text/css"> .box { display: none; } </style> above div not visible when page load. making div visible after button click. want append text span when div visible. $('#button').on("click",function(e){ e.preventdefault(); $('.box').clone().show().append('.row'); }); i tried 1) $(".box").closest(".test").text("hello"); 2) $(".box").find(".test").text("hello"); but not adding text span. try : $(document).ready(function(){ $("button").on("click",function(){ $(".box").find(".test").text("hello"); $(".box").show(500

javascript - How to overcome of passing single static value to the function? -

i'm displaying many buttons number of rows in query. every row has it's own names & properties. when click on of buttons, should pass particular value function. but, when tried following code, passes first value if click on buttons. <?php while ($rec = mysql_fetch_array($query)) { echo "<figure>"; echo "<button onclick='change()' title='".$rec["username"]."' class='fa fa-user' id='mybutton1' value='".$rec["username"]."' style='font-size:100px;color:red'></button>"; echo "<figcaption>".$rec["username"]."</figcaption>"; echo "</figure>"; //echo "</a>"; } ?> <script type="text/javascript"> function change() { var elem = document.getelementbyid("mybutton1"); alert(elem.value);

mysql - java - validate database with an array and execute after that -

i have code code show joptionpane "ga kenek" on second array int rows = jtable1.getrowcount(); (int = 0; < rows; a++) { string namaop = jtable1.getvalueat(a, 0).tostring(); string tgl = jtable1.getvalueat(a, 1).tostring(); string pn = jtable1.getvalueat(a, 2).tostring(); string nama = jtable1.getvalueat(a, 3).tostring(); string sql = "insert `tbl_coba`(`a`, `b`, `c`,`d`)" + " values ('" + namaop + "','" + tgl + "','" + pn + "','"+nama+"')"; string sql1="select `tbl_coba`"; try { statement st=con.createstatement(); resultset rs=st.executequery(sql1); if (rs.next()) { statement st1=con.createstatement(); if (namaop.equals(rs.getstring("a")

pipe - How to use multiple checkbox to filter data in Angular 2 -

i'm creating filter page angular 2. data being filtered depending on checkboxes checked. this html <input required type="checkbox" name="checkbox" value="value1" (change)="togglefilter(kind.value)" #kind/> filter option 1 <input required type="checkbox" name="checkbox" value="value2" (change)="togglefilter(kind2.value)" #kind2 /> filter option 2 <input required type="checkbox" name="checkbox" value="value3" (change)="togglefilter(kind3.value)" #kind3 /> filter option 3 <div *ngfor="let item of (items | filterpipe: filterformat)"> {{item.id}} {{item-title}} </div> this piece of item component. in togglefilter() i'm population array filteroptions values of checkbox. get filterformat() returns populated array , places argument in filterpipe (which located in html) filteroption

how to pass input parameters to controlller actions in php mvc with $.get() or $.post() methods ajax jquery? -

how pass input parameters controlller actions in php mvc $.get() or $.post() methods ajax jquery? in php code how can send $username parameter checkusername action? can send parameter option data parameter in $.get() or $.pos() ajax? //my class. class users class user extends controller { // construct class function __construct() { parent::__construct(); } // action. actin check username in database public function checkusername($username) { // enter code here } } with post method function get_username() { $.ajax({ url:'controller/method', type: "post", data: { 'username': username, }, success: function(data) { }, }); } <?php public function checkusername() { $username = $_post['username']; or $username = $_get['username'];

c++ - Strange behavior of add_property in Boost.Python -

i met strange behavior when using add_property of boost.python. here example codes, add 2 properties (read-only & read-write) wrapped class. #include <boost/python.hpp> using namespace boost::python; struct x { x( int value ) : val( value ) {} int get_value() const { return val; } void set_value(int value) { val = value; } int val; }; boost_python_module(hello) { class_<x>("x", init<int>() ) // note order .add_property( "val_r", &x::get_value ) // read-only first .add_property( "val_rw", &x::get_value, &x::set_value ) // read-write second ; } and build command: $ g++ -i/usr/include/python2.7 -shared -l/usr/local/lib -o bp.dll bp.cpp -lboost_python -lpython2.7 i'm working in cygwin x86_64, file extension .dll . ubuntu change output extension .so . when importing bp module, crashes segmentation fault . core dump file doesn't contain call

Plotting two categories in ggplot2 violin R -

i have data set different categories. let's a,b,c , d. here how data set looks like v1 v2 v3 1 na 1 0.1 2 2 2 0.2 3 3 na 0.1 4 4 4 0.3 5 na na 0.4 6 na na 0.8 7 7 7 0.2 8 na 8 0.1 9 9 na 0.6 10 na na 0.1 the lines that: v1 column not na in category a v2 column not na in category b (v1 column not na or v2 column not na )are in category c all line in dataframe in category d in case of example above: there lines fall , c @ same time(like line 3). line 1 in category b , c. therefore, number of category c may less number of a+b. 10 lines in category d. i want use ggplot2 plot violin plot of category a,b,c , d according values in v3. (that b c d in x-axis , v3 in y-axis) does got hint? tried ggplot2 seems can't not deal overlapped categories. if data have column specified categories, work fine: v1 v2 v3 group 1 na