Posts

Showing posts from April, 2011

php - Custom Fields not showing in custom post type post -

Image
i have custom post type named "designer" each posts using different unique advanced custom fields each posts has unique templates.with below code able give rules each posts in designer post type , save custom fields not displaying on post edit pages on backend. code should ork no idea happend code please help. add_filter('acf/location/rule_types', 'acf_location_rules_types'); function acf_location_rules_types( $choices ) { $choices['custom post types']['cpt_parent'] = 'custom post type parent'; return $choices; } add_filter('acf/location/rule_values/cpt_parent', 'acf_location_rules_values_cpt_parent'); function acf_location_rules_values_cpt_parent( $choices ) { $args = array( 'hierarchical' => true, '_builtin' => false ); $posttypes = get_post_types( $args ); if( $posttypes ) { foreach( $posttypes $posttype ): if( $posttyp

xml - R - Iterating xpathApply issue -

this first post on se use often! i have been having hard time trying extract information pmc xml files using r. i have been trying replicate this code find rather iterating through article set , extracting items once per article, multiple_papers function returns whole list each article (in example there 6 articles , list printed 36 times). sample xml file library(xml) searchresults <- xmlroot(xmltreeparse('pmc_se_examp.xml', useinternal=true)) parse_title <- function(paper){ print (xpathapply(paper, '//title-group/article-title', xmlvalue)) } parse_multiple_papers <-function(papers){ thispaper <- xpathapply(papers, "//pmc-articleset/*", parse_title) } x <- parse_multiple_papers(searchresults) i cannot life of me figure out why happening , wondered if shed light on me? in advance! after spending few hours retracing steps , consulting original code, have managed behaviour looking for. aim extract author, titl

php - How to download file from server and zip him -

zip , download file hi, want download file server , save him rar. example: have file xy contains file img.jpg , untitled.php. want download xy , make .rar (xy.rar). how download file server , make him .rar (zip)? help.. you can try use method: http://php.net/manual/en/ziparchive.addfile.php all avaliable methods , features php offers when want zip files, mentioned here: http://php.net/manual/en/book.zip.php

mysql - Select data which contains value in 1 of 4 columns -

i want select rows contain value of variable '$filter_objekt' in sql column 'objekt1' or 'objekt2' or 'objekt3' or 'objekt4'. this current query: $filter_objekt = "lorem"; $ergebnis = mysqli_query($db, "select * aktionen jahr '$filter_jahr' , kunde '$filter_kunde' , kampagne '$filter_kampagne' , objekt1 '$filter_objekt' or objekt2 '$filter_objekt' or objekt3 '$filter_objekt' or objekt4 '$filter_objekt' or mediamix '$filter_mediamix' , kosten '$filter_kosten' , schulnote '$filter_schulnote' , feedback_status '$filter_feedback' order kunde asc, aktionsname asc"); at moment script returns every row of table, no matter if contains value of '$filter_objekt' or not. any

java - Assets behaviour in multiplatform libGDX application -

what best practice store resources in libgdx library. i'm know can use assetmanager , e.g. can link resources android folder ios, dont know how behaviour on multiplatform devices. resources scale according screen size/operating system, or need manually set diffrent size or resulution in each platform resource folder.i want avoid ovelaying or stretch behaviour. there many ways go , there no "best" solution. if build android use android assets folder. default , used other builds (due default libgdx project configurations). the resources scale if tell them too. can choose use viewport (a fit/fill viewport not stretch can add black/background bars not have default aspect ratio). can choose implement screen dependency using aspect ratio , scale. for instance: a 1080x1920 mobile phone vs 1440x1920 tablet if use fit viewport have unused space on tablet. if use fillviewport might lose stuff on phone. if take phone default aspect ratio , calculate width offset

adding event handlers on dynamically created WPF controls -

i have wpf application , using dynamic wpf controls. how add event button or image onresize? thanks you hook event handler event of button or image using += syntax: image image = new image(); image.sizechanged += (s, e) => { /* handle event */ };

swift - Coufused about using UserDefaults to make administrator ID -

i used userdefaults make login screen. question need administrator let apple's examiner can direct sign in app without register again. should next? please me!thanks! here code: //this register's code @iboutlet weak var userregistertextfield: uitextfield! @iboutlet weak var userregisterpasswordtextfield: uitextfield! @iboutlet weak var repeatpasswordtextfield: uitextfield! @ibaction func registerbutton(_ sender: any) { let userregister = userregistertextfield.text let userregisterpassword = userregisterpasswordtextfield.text let userrepeatpassword = repeatpasswordtextfield.text // save data user register in. userdefaults.standard.set(userregister, forkey: "userregister") userdefaults.standard.set(userregisterpassword, forkey: "userregisterpassword") userdefaults.standard.synchronize() } //this login's code. @iboutlet weak var username: uitextfield! @iboutlet weak var userpassword: uitextfield! @iboutl

Liferay Serivce Builder: Not able to run dynamic query -

i have 2 plugin portlets. first has service builder entities. second portlet using service's jar file execute dynamic query. i using first's service jar in second plugin portlet interact database. in jar file there not impl class. thats why getting error impl class not found. below reference: dynamicquery dynamicquery = dynamicqueryfactoryutil.forclass(xxx.class, portletclassloaderutil.getclassloader()); try { xxxlocalserviceutil.dynamicquery(dynamicquery); } catch (systemexception e1) { // todo auto-generated catch block e1.printstacktrace(); } error: [dynamicqueryfactoryimpl:96] unable find model com.compass.model.impl.xxximpl java.lang.classnotfoundexception: com.compass.model.impl.xxximpl nomal functions working fine of service builder just don't use dynamicqueryfactoryutil xxxlocalserviceutil way dynamicquery dynamicquery = xxxlocalserviceutil.dynamicquery() try { xxxlocalserviceutil.dynamicquery(dynamicquery); } catch (systemexc

html - Is there a way to tell Facebook to show nothing when link shared? -

there meta tag tell facebook image show , text display when link shared. have page want keep element of surprise until opening link. have tried leaving meta tag content blank, i.e. <meta property="og:title" content="" /> <meta property="og:image" content="" /> <meta property="og:description" content="" /> however, facebook automatically content site. there way tell facebook want show nothing when link shared?

javascript - Pentaho Data Integration: How to load and call method of external library JS at Pentaho(using in Modified Java Script Value Step)? -

currently, have js library splits user agent string in request heads components browser, browserversion, operatingsystem, device, os, , on. have library (.js), can me how add , use in modified java script value? plz. want see simple example of or similar. enter image description here this file js: https://drive.google.com/file/d/0b5fsakwz2dztcjrjcg15utfjyue/view?usp=sharing you can use loadscriptfile(jsfilepath) function in order load execute js script file. you can call function on start script tab avoid executing entire script every input row, call uaparser constructor on transform script tab. example: start script (executed once, after first input row arrives. create start script, right-click on "script1" tab header, select "add new", select new tab, right-click on it, select "set transform script") // assuming, ua-parser.js in transformation directory: var transformationpath = getvariable("internal.transformation.filen

Neural network model prediction in Keras without using GPU -

my neural networks model built in keras on theano using gpu. storing using pickle future use, possibly on computer. is possible use model prediction without gpu? sure. it's common use-case. gpus boost training, aren't available in production (for example, if run on customer's phone). i don't know theano much, might have equivalent tensorflow.serving . can serialize trained model object , read other machine. to serialize, can either use: the built-in keras.models.save_model , keras.models.load_model dumps models hdf5 files. if need/prefer pickle - it's not supported keras, can use trick - http://zachmoshe.com/2017/04/03/pickling-keras-models.html

Circular rotation of a list in python: terminated due to timeout -

i have tried circulation rotation of list a , tried print elements of list, program getting terminated when test cases used large numbers n, k, q . n,k,q = raw_input().strip().split(' ') n,k,q = [int(n),int(k),int(q)] = map(int,raw_input().strip().split(' ')) b=list(a) a0 in xrange(q): m = int(raw_input().strip()) j in xrange(k): #print l=a[n-1] in range(n-2,-1,-1): a[i+1] = a[i] a[0] = l print a[m] a=list(b)

python - Building a stacked bar chart from a list within a dictionary matplotlib -

Image
i have dictionary contains list each value, example: countries = {'ng': [1405, 7392], 'in': [5862, 9426], 'gb': [11689, 11339], 'id': [7969, 2987]} is there way build stacked bar chart dictionary using each value bit of stack each key? as in bar_stacked example matplotlib site, use bottom argument bar shift bars, 1 on top of other. import matplotlib.pyplot plt import numpy np countries = {'ng': [1405, 7392], 'in': [5862, 9426], 'gb': [11689, 11339], 'id': [7969, 2987]} c = [] v = [] key, val in countries.items(): c.append(key) v.append(val) v = np.array(v) plt.bar(range(len(c)), v[:,0]) plt.bar(range(len(c)), v[:,1], bottom=v[:,0]) plt.xticks(range(len(c)), c) plt.show()

javascript - How to watch a child component data not coming from a parent component (Angularjs 1.5 or 1.6)? -

in following codes: var app = angular.module('app', []) // navigation template app.component('onchanges', { bindings: { name: '<' }, template: '<h1>{{$ctrl.greeting}}</h1><br><h2>{{origin}}</h2> ', controller: function($scope) { $scope.origin = 'international'; this.$onchanges = function(obj) { if (obj.name && this.name) { var prefix; (obj.name.currentvalue.tolowercase() === 'thomas') ? prefix = 'howdy ': prefix = 'hello '; this.greeting = prefix + this.name; (prefix === 'hello ' || !prefix) ? $scope.origin = 'american': $scope.origin = 'australian'; } // if name undefined clear greeting if (!this.name) { this.greeting = '' } }; $scope.$watch('$scope.or

ubuntu - Pixelated window borders and buttons -

Image
i have no idea how happening, upon returning sleep computer messes floating windows , right-click menus. weird pixelations happens around window border , close/minimize/maximize-buttons, not when window maximized. problem goes away after reboot, reappears after system return sleep. any suggestions how troubleshoot this, appreciated! i tried changing theme default, doesn't help, don't think it's related theme. looks more hardware-issue :-/ i can't link duplicate questions / answers, here , assuming have nvidia graphics card, permanent fix downgrade nvidia driver version 375 361. full instructions available in linked post. otherwise, temporary fix restart unity (just type unity in shell).

How to generate date for next 14 days in java? -

public class datefornext14days { public static void main(string[] args) { final calendar c = calendar.getinstance(); int day=c.get(calendar.day_of_month); (int = 1; i<=14; i++) { system.out.println(day); c.add(c.get(calendar.day_of_month), 1); } } } while executing code got following error:- exception in thread "main" java.lang.illegalargumentexception @ java.util.gregoriancalendar.add(unknown source) @ todaydate.main(todaydate.java:28) i wanted output - start current day , iterate next 14 days. remove c.get( . first parameter of add constant unit c.add(calendar.day_of_month, 1); for more informations see javadoc . and output day in following way: system.out.println(c.get(calendar.day_of_month)); so code must like: public static void main(string[] args) { final calendar c = calendar.getinstance(); (int = 1; <= 14; i++) { system.out.println(c.ge

.net - how to bind checkbox dynamically in list type model mvc 5 -

i have class public class custombenefitcommittee { public int planoptionid { get; set; } public bool ischecked { get; set; } public string planoptionname { get; set; } } and have took class list type of model in razer view @model list<mihr.business.customclasses.custombenefitcommittee> @{ int counter = 0; } <table class="table table-bordered" id="tblplanlst"> <thead> <tr> <th> select </th> <th> benefit option </th> </tr> </thead> <tbody> @foreach (var enrol in model) { <tr> <td> <input type="checkbox" name="custombenefitcommittee[@counter].ischecked" class="clscheck" /></td>

php - How in Yii 2 access AR object as component? -

actually, want have access ar object in anywere. want access ojb yii component. like yii using user: yii::$app->user->identity - user component contains user ar object. i want store page ar in component. so, it's something: yii::$app->page->page - page ar propery of page component. not nice :(. way? in config can set it. user set , adapt requirements. $config = [ ... 'components'=>[ .... 'user' => [ 'class'=>'yii\web\user', 'identityclass' => 'common\models\user', ... ], ... ], ... ]; read more in yii2 documentation on link

git - Prevent Jenkins to rebuild the entire project everytime -

sometimes have start jenkins manually (when add new plugins example) make sure works properly. normally, build setup run @ midnight. in order work faster, know, if start build jenkins, without having go through whole process : pull git, clear database, composer update etc... because adding features jenkins, , not source code itself. i use ant build project. depending on job type build, should able specify directory in file system workspace location. can rebuild of program. depending on make tool should rebuild files changed last build, e.g. git pull. see e.g. https://ingorichter.blogspot.de/2012/02/jenkins-change-workspaces-and-build.html , custom workspace in jenkins

how to put in variable a promise http (service angularjs) -

i have big problems, want put service in variable in controller but there probleme, when call service http inside give me $$state object (impossible take value of one) this code service , controller routeappcontrollers.factory('servicesms', function($http,token) { var key = token.createtoken() var myservice = { async: function() { var data = 'token=' + encodeuricomponent(key); var promise = $http({ method: 'post', url: 'phpfunction/getsms.php', data: data, headers: {'content-type': 'application/x-www-form-urlencoded'}, cache: true }) .then(function(data) { // function here opportunity modify response // console.log(data.data); // return value gets picked in controller. return data.data; }) // return promise controller return promis

Android call intent with '#' sign as number, prevent Uri.parse remove # -

i want call number '*140*123456#' or ' 141 #123456#'. uri.parse(phonenumber) method removes '#' signs , numbers after it. it's solution? use uri.encode(phonenumber) to encode unresevered characters take @ https://developer.android.com/reference/android/net/uri.html#encode(java.lang.string, java.lang.string)

fluent assertions - FluentAssertions: check a list contains an object, excluding a property -

i have several event classes implement ievent. check actual event against expected event use actualevent.shouldbeequivalentto(expectedevent,opt => opt.respectingruntimetypes() .excluding(e => e.datecreated)); the events have datecreated property ignore actual , expected created @ different times. how check if expectedevent exists @ least once in list of actualevents? i following; actualevents.should().contain(expectedevent,opt => opt.respectingruntimetypes() .excluding(e => e.datecreated)); but not possible. can done in fluentassertions? i had similar scenario had list of items (an object properties) , wanted check if list contained local item testing for. i found solution on question: fluentassertions, making sure ienumerable contains single element i simplified solution writing following statement: foolist.should().contain(fooitem

ios - OperationQueue is not removing the operations from queue if I call cancelAllOpeartions -

i have opeationqueue on calling cancelallopeations if ask opearationqueue.operationcount not returing me zero. i overriding cancel method working opertioncount not zero.is expected? see apple's api document nsoperation cancel method (emphasis mine): this method not force operation code stop. instead, updates object’s internal flags reflect change in state. if operation has finished executing, method has no effect. canceling operation in operation queue, not yet executing, makes possible remove operation queue sooner usual . the cancel method either mark operation 'ready' if in queue, or mark finished if not in queue. since operations in queue, means cancelled operations start 'sooner'. if sub-classed correctly, cancelled operations should mark finished , generate final kvo notifications. operations dequeued. see responding cancel command more information cancelling custom operations. if need know when operation queue has 0 operati

php - How not to display the error stack when catching fatal errors -

Image
i set set_exception_handler , set_error_handler handle exceptions , errors, still not catch 'fatal error'. i tried this: register_shutdown_function( "fatal_handler" ); function fatal_handler() { flashmessages::flashit( 'message', 'fatal error' ); include( settings::abspath . '/src/views/message.php' ); $error = error_get_last(); if ( $error !== null ) { $errno = $error[ "type" ]; $errfile = $error[ "file" ]; $errline = $error[ "line" ]; $errstr = $error[ "message" ]; var_dump( $error ); } } and i'm indeed able dump error, there no way avoid full stack error on top of page. how avoid displaying error stack ? register_shutdown_function( "fatal_handler" ); function fatal_handler() { $error = error_get_last(); if ( $error[ "type" ] == 1) { //only fatal errors $errno = $error[ "type"

ruby - create nested hash from a list -

i have got list l = [:foo, :bar, :baz] , want assign varible hash h ={} programmatically. hash should like { foo: { bar: { baz: some_value } } } note: keys variables! question: how can this? you use inject on reversed list : l = [:foo, :bar, :baz] h = l.reverse.inject(:some_value) |value, key| { key => value } end p h # {:foo=>{:bar=>{:baz=>:some_value}}} reverse used in order build innermost hash first, , keep building nested hash outwards.

BIRT report custom font not shown -

my birt-eclipse 4.6.0 editor displays custom fonts correctly. i'm trying understand why custom fonts displayed while other not (falling standard) when report generated pdf (or other format) on birt runtime 4.4.2 server. i'm registering custom fonts using below method when server starts: com.lowagie.text.fontfactory.register("/font/path") same problem happens when click run -> view report -> pdf in eclipse-editor. example avenirnextltpro-mediumcn.otf displayed, avenirltstd-medium.otf not. same happens *.ttf fonts - displayed correctly, others not. visible in birt-eclipse editor. editor , runtime server running on same machine - ubuntu 16.04, fonts copied /usr/share/fonts , registered fc-cache -fv command. why fonts not visible in pdf? could not find exact cause of problem, think somehow related font naming. solution worked me: com.lowagie.text.fontfactory.register(string path, string alias) there "register" method accep

Making Twilio calls with TwiML in Delphi -

i'm using twilio call people delphi xe2 application. calls arrive can't seem use personal xml url inform person i'm calling. here code: purl := 'https://api.twilio.com/2010-04-01/accounts/' + accountsid+'/calls'; allparams.add('from=' + phonenumberfrom); allparams.add('to=' + ptonumber); allparams.add('url=' + pxmlurl); idhttp1.post(purl, allparams) if use https://demo.twilio.com/welcome/voice/ url works well. full message , everything. if use url server doesn't. xml looks like: <?xml version="1.0" encoding="utf-8" ?> <response> <say>an urgent ticket has been posted in support portal. please see it.</say> </response> also i've created twiml httpget in twilio console , if use applicationsid instead of url in application second sentence when answer call. would have idea going on? i've found answer. i had add: allparams.add('method=get&#

Make ipython always execute command when I press return key? -

after migrating ipython, noticed return key causes line break instead of executing command. example if have cursor before ) in print() , result in: print( ) how can make run print() in , other cases? this happens when in multiline mode, e.g. in [200]: in range(3): ...: print(i) ...: you either need move end of block ( <end> ) , return twice (or more if editing has accumulated bunch of blank lines); or use <esc><return> . it shouldn't happen in single line entry. wrapped lines maybe. in case <end> , <esc> work. key press cost of multiline editing convenience.

ios - IBM Mobile First Platform - Sending Push Notification from adapter -

i developing ios app using ibm mobilefirst platform 8.0 sdk have push notification capabilities i managed send notification via postman, process obtaining token mobilefirst platform server , send notification via rest api along token the tutorial link have follow is, server side - https://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/8.0/notifications/sending-notifications/ client side - https://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/8.0/notifications/handling-push-notifications/cordova/ get token - https://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/8.0/authentication-and-security/confidential-clients/#obtaining-an-access-token for now, trying send push notification when app triggers adapter call i stuck on sending notification using wl.server.invokehttp, below more adapter code function sendpushnotification(message) { var result = gettoken(); var access_token = "bearer " + result["access_toke

spring - Annotation injection and XML injection -

regarding spring framework implementation of inversion of control (ioc) principle... annotation injection performed before xml injection or other way around ? thus latter configuration override former properties wired through both approaches ? it seems have read spring documentation: annotation injection performed before xml injection, latter configuration override former properties wired through both approaches. annotation-based container configuration

tsql - SQL debug in vs code -

i have installed vs code tool on windows , exploring functionality. far, i'd awesome tool has cool features traditional ssms. difficulty i'm facing is, usage of debug in vs code. when click debug, giving me blank side windows next activity bar callstack,breakpoints etc., , seems standard vs code installer supports 4 languages. not able see sql in bar. can guide me on howto debug sql objects stored procs, functions inside console? thanks

c++ - OpenCL find Max in vector of 1.8 million records -

i have find minimum , maximum of vector on 1.8 million records in it, current method this: __kernel void minimum(__global const double* temperaturevalues, __global double* c) { int id = get_global_id(0); int n = get_global_size(0); (int = 0; < n; i++) { if (temperaturevalues[i] < c[0]) { c[0] = temperaturevalues[i]; } } } but linear search crashes computer when working on full dataset (works on smaller dataset of around 180,000 records). got suggestions on how adapt work large dataset?

android - Reading and Writing to a SQLITE3 database from a ListView populated by a CursorAdapter -

Image
i made android app online program part of. app supposed track inventory. app uses cursoradapter populate listview 3 inventory details - productname, product price , quantity. part of assignment add button on each list item when clicked quantity decreased 1 , new value stored in database. problem having each listitem populated cursoradapter, code not in activity. know how read , write database activity not cursoradapter. assuming cursoradapter need put code because place there logic textviews shown in each list item. tried has failed. unfortunately can't show have tried because @ point decided delete , start scratch. here each list item should like. here code cursoradapter: public class inventorycursoradapter extends cursoradapter { private uri mcurrentinventoryuri; /** * constructs new {@link inventorycursoradapter}. * * @param context context * @param c cursor data. */ public inventorycursoradapter(context context, cursor c) { super(context, c, 0 /* fl

New #access_denied with Facebook Login (ASP.NET MVC) -

i'm facing strange problem facebook login on website. it's new, facebook login has worked correctly , it's still working on android , ios app. i have link in website like: http://myurl/api/account/externallogin?provider=facebook&response_type=token&client_id=self&redirect_uri=http://myurl/home/register? obviously in developer.facebook.com have set like, in oauth address have: http://myurl http://myurl/home/register http://myurl/home/register? and have localhost (that worked correctly since couple of days ago) my app requires access: var facebookauthenticationoptions = new facebookauthenticationoptions() { appid = "[hidden security reason]", appsecret = "[hidden security reason]" }; facebookauthenticationoptions.scope.add("email"); facebookauthenticationoptions.scope.add("user_friends"); facebookauthenticationoptions.scope.add("

c# - Why might this Tuple not work? -

Image
in documentation section of site there piece on tuples , tuple support in c#7.0. in there simple example of tuple close start. public (int sum, int count) gettallies() { return (1, 2); } i added simple example class in project , have made sure system.valuetuple referenced , yet intellisense telling me not fit compile. has seen sort of behaviour before , shed light on why might happening. in visual studio 2017.

typescript - How to listen for a click-and-hold in Angular 2? -

in link , can find example in angularjs. but how work in angular 2? a simple implementation this. @component({ selector: 'my-app', template: ` <div> <h2 (mousedown)="mousedown()" (mouseup)="mouseup()" (mouseleave)="mouseup()">hello {{name}}</h2> </div> `, }) export class app { name: string; timeouthandler: number; constructor() { this.name = 'angular!' } public mouseup() { if (this.timeouthandler) { cleartimeout(this.timeouthandler); this.name = "canceled"; this.timeouthandler = null; } } public mousedown() { this.timeouthandler = settimeout(() => { this.name = "has been long pressed" this.timeouthandler = null; }, 500); } } it sets timeout canceled if user clicks away before set amount of time. you can find working plnkr here . if want happen on click on hold it's pretty easy we

unit testing - Unexpected PHP error [fclose() expects parameter 1 to be resource, boolean given] severity [2] in [simpletest/socket.php line 255] -

i have been using simpletest basic testing of project. want basic checks on pages make sure things continue working develop. have hit few issues though. first tried using class webtestcase, received 403 when attempting connect google , same error below. switched using normal unittestcase , simplebrowser helper class provided simpletest. using this, can connect google no issue, still same error when attempting reach own site. unexpected php error [fclose() expects parameter 1 resource, boolean given] severity [2] in [simpletest/socket.php line 255] class testofbasicfunctionality extends unittestcase { function testgooglebrowser() { $browser = &new simplebrowser(); $browser->get('https://www.google.com'); $this->assertequal($browser->gettitle(), 'google'); $this->assertequal($browser->getresponsecode(), 200); } function testindexbrowser() { $browser = &new simplebrowser();

selenium - Need to click on Pause button on tapping on video while doing getting error -

Image
need click on pause button on tapping on video while doing getting error. error as: org.openqa.selenium.webdriverexception: unknown error: element not clickable @ point (25, 312). other element receive click. xpath: driver.findelement(by.xpath("//button[@class='togglepaused']/descendant::i[@class='fa fa-pause']")).click(); html code: <button class="toggle-paused"> <i class="fa fa-pause"> ::before </i> </button>

difference # and {} or nohing in item on SASS -

$list: (orange, purple, teal); //add each-loop here @each $item in $list { .{$item} { background: $item; } } $list: (orange, purple, teal); //add each-loop here @each $item in $list { .$item { background: $item; } } $list: (orange, purple, teal); //add each-loop here @each $item in $list { .#{$item} { background: $item; } } i new sass,when practising gave me same result.what difference between them?# {} or nothing why use nothing only $item when don't want add more. sass use #{} separate code css. if want select class need .#{$item} .

awk - how to map and compare filename in shell script -

i'm using below code map filename function insert_data() { file in `ls -lrt added_to_* | awk '{print $9}'` echo "running file: $file" map_file="mapping_rule_categories.txt" path=`ls -lrt added_to_* | awk '{print $9}'` output=`cat $map_file | awk -f "|" -vnick="$path" '{if("$8"=="$nick") print $9}'` echo $output done } insert_data; where mapping_rule_categories.txt having mapping removed_from_drop.rules|disabled_in_drop.rules | disabled_and_modified_in_drop.rules | modified_inactive_in_drop.rules|modified_active_in_drop.rules | enabled_and_modified_in_drop.rules | enabled_in_drop.rules | added_to_drop.rules | drop.rules and files in directory like: added_to_botcc.rules added_to_compromised.rules added_to_drop.rules i need output should print filename after using map file : botcc.rules compromised.rules

shell - rpm un-installs with warning unlink messages -

i have created spec file can install/upgrade/uninstall package .but , on uninstallation , uninstalls package warnings warning: erase unlink of /var/hudson/master/plugins/publish-over-cifs/help/global/username.html failed: no such file or directory warning: erase unlink of /var/hudson/master/plugins/publish-over-cifs/help/global/timeout.html failed: no such file or directory warning: erase unlink of /var/hudson/master/plugins/publish-over-cifs/help/global/remoterootdir.html failed: no such file or directory warning: erase unlink of /var/hudson/master/plugins/publish-over-cifs/help/global/port.html failed: no such file or directory warning: erase unlink of /var/hudson/master/plugins/publish-over-cifs/help/global/password.html failed: no such file or directory how can resolve error ? there way ignore such warning in spec file ?

Tomcat Exception on Startup: java.lang.ClassNotFoundException: javax.faces.webapp.FacesServlet -

i'm working tomcat 8.0.41 , i've run problem i've been unable solve. when start tomcat, following exception message in log, no web applications deployed. 28-mar-2017 09:03:45.659 info [localhost-startstop-1] org.apache.catalina.core.applicationcontext.log marking servlet faces servlet unavailable 28-mar-2017 09:03:45.659 severe [localhost-startstop-1] org.apache.catalina.core.standardcontext.loadonstartup servlet [faces servlet] in web application [] threw load() exception java.lang.classnotfoundexception: javax.faces.webapp.facesservlet @ org.apache.catalina.loader.webappclassloaderbase.loadclass(webappclassloaderbase.java:1333) @ org.apache.catalina.loader.webappclassloaderbase.loadclass(webappclassloaderbase.java:1167) @ org.apache.catalina.core.defaultinstancemanager.loadclass(defaultinstancemanager.java:518) @ org.apache.catalina.core.defaultinstancemanager.loadclassmaybeprivileged(defaultinstancemanager.java:499) @ org.apache.catalina.core.d

javascript - Using toggleClass to toggle between image heights, 250px - 450px? -

i building website image heavy, portfolio site. i have masonry type gallery each image set 250px height default. wish create hyperlink/button let user decide if want view images @ normal size (250px) or @ larger size (450px). the images loaded inside div called #imagegallery , understand best way have button once clicked, add/toggle/remove class resize images in div 450px. seems basic usage of toggleclass jquery function. $('#togglebtn').click(function(){ $('.item').toggleclass( "expand" ); }); .item{ height:250px; } .expand{ height:450px; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <button id="togglebtn">toggle</button> <div id="imagegallery"> <img class="item" src="https://encrypted-tbn0.gstatic.com/images?q=tbn:and9gcrabcf7stpcrmmzxkwuyopewievnyqzvvtj_f79-zj0tfscn5njuq" /> &

Angular 2 CSRF cookie not set in POST response header in Spring Security -

i have angular2 application works spring. backend (spring) runs on other port configured cors follow. public globalcorsfilter() { super(); } @override public final void dofilter(final servletrequest req, final servletresponse res, final filterchain chain) throws ioexception, servletexception { final httpservletresponse response = (httpservletresponse) res; response.setheader("access-control-allow-origin", "http://localhost:4200"); // without header jquery.ajax calls returns 401 after successful login , ssessionid being succesfully stored. response.setheader("access-control-allow-credentials", "true"); response.setheader("access-control-allow-methods", "post, put, get, options, delete"); response.setheader("access-control-max-age", "3600"); response.setheader("access-control-allow-headers", "x-requested-with, authorization, origin, content-type, version"); response.setheader(&

ruby on rails - Is there a way to test in-app browsers / safari browsers in Cucumber / Capybara? -

i still pretty new using cucumber , capybara . have seen can use capybara.page.current_window.resize_to(x,y) modify window size want to, when using firefox/chrome. is there way me run tests accurately, use in-app browser (like facebook app browser) , see results? thank you! the in-app browser on ios using webkit engine. size of in-app browser window depends on device running on , size of webview displayed in. shouldn't try set specific size, make sure use mobile viewport size (depends on targeted devices). if render pages in chrome close thing users might see using in-app browser. help? that give me accurate representation of facebook / in-app browser? i don't know sure, cannot think of better way.

javascript - Chart.js - Display data label leader lines on a pie chart -

i have been playing lot chart.js trying hardest avoid getting canvas due time constraints , personal preference of svg route of d3 et al. i have mixture of charts on dashboard page, , looks fantastic except 1 issue - have hover on pie segment in order see underlying % or value. for dashboard view, users prefer see data labels on segments - excel - possibly easier explain image: https://support.office.com/en-gb/article/display-or-hide-data-label-leader-lines-in-a-pie-chart-d7e7c62e-aaa5-483a-aa00-6d2c437df61b the problem other solutions i've found here displaying value in segment, segments small way forward. there other solutions displayed tooltips - there lot of overlapping , looked quite horrible. i happy if legend display data next it, don't understand why lot more people haven't requested same functionality - missing something? this feature isn't available far, there no quick solution that.

Plotting Location data in R -

can please tell me how plot location data in r language? suppose have data "date-time" x , y coordinates (latitude , longitude) mentioned below;i trying in r language. date: 2016-02-25 17:21:09.147, location (2.39, 48.71) to visualise 3d data, can use plot3d , combine datetick format time axes.

node.js - NodesJS SocketIO - How can I make sure websockets are being used? -

background i'm working connect unity application socketio application unity using socketio plugin (only uses websockets, not polling/xhr) to connect websocket unity i'm using ws://localhost:3000/socket.io/?eio=4&transport=websocket . if hit link via browser see following: {"code":3,"message":"bad request"} at point forced websockets nodejs application io.set('transports', ['websocket']); application stopped working. question how can make sure websockets available nodejs+socketio? code app.js var app = require('express')(); var http = require('http').server(app); app.get('/', function(req, res){ res.sendfile(__dirname + '/index.html'); }); var server = app.listen(3000, function () { var host = server.address().address var port = server.address().port }); var io = require('socket.io').listen(server); //io.set('transports', ['websocket'

Cassandra issue with delete between filter() and save() -

i have issue delete between loading item , saving cassandra causes columns not updated deleted. class testitem(model): uuid = columns.integer(primary_key=true) data_1 = columns.text() data_2 = columns.text() testitem.create(uuid=1, data_1='data_1', data_2='data_2').save() item = testitem.filter(uuid=1).first() testitem.objects(uuid=1).delete() item.data_2 = 'data_2_deleted' item_b.save() # stdout: # testitem(uuid=1, data_1=u'data_1', data_2='data_2_deleted') testitem.filter(uuid=1).first() # stdout: # testitem(uuid=1, data_1=none, data_2=u'data_2_deleted') i expect data_1 still present. is intended behaviour? can change code somehow either item deleted or saved values queried before. the issue cassandra driver writes rows changed. in use case wanted write rows, changed or not, used: testitem.create(**dict(item_b)).save()

c# - Create implicit cast for enum value -

i've created own messagebox own enum messageboxbutton : public enum mymessageboxbutton { ok = messageboxbutton.ok, okcancel = messageboxbutton.okcancel, yesnocancel = messageboxbutton.yesnocancel, yesno = messageboxbutton.yesno, nowlatercancel = 5, } as can see, it's system.windows.messageboxbutton 1 value more. for class mymessagebox, have function : public static messageboxresult show(string caption, string message, mymessageboxbutton button, messageboximage icon) { ... } is there way call show messageboxbutton , implicitly cast value mymessageboxbutton ? you can create converter method converts messageboxbuttons mymessageboxbutton , create overload of show method takes messageboxbuttons , , in method conversion , call existing show method. since don't have matching enum values items (like abortretryignore ), have decide button combination show if selects 1 of those: public static mymessageboxbutton converttomymessa

oracle - Ranking / Finding Dates -

i have these records: phot 1/16/2017 20170118 0.01 phot 1/16/2017 20170117 0.0103 phot 1/16/2017 20170116 0.0101 phot 1/16/2017 20170115 0.0101 phot 1/16/2017 20170114 0.0105 . . . msrt 12/31/2016 20170327 0.855 msrt 12/31/2016 20170324 0.87 msrt 12/31/2016 20170323 0.87 msrt 12/31/2016 20170322 0.88 msrt 12/31/2016 20170321 0.89 . . . basically need record closest date in column 3 <= date in column 2. it should partitioned column 1.i need 1 record, being 1 has closed column 2 date column 1 date. can done dense_rank? or should using row_number? the following query should help: select * ( select row_number() on (partition t.col1 order abs(t.col2-to_date(t.col3, 'yyyymmdd'))) rw, t.* tbl t t.col2 >= to_date(t.col3, 'yyyymmdd')) rw = 1; explanation: the inner query use to_date function on col3 format date same pattern col2. then can compare col2 in claus

.net - Crystal reports Command for date Range in Visual Studio 2012 -

i editing application made in visual studio 2012. trying create crystal report user selects date range. added command simple sql server query, runs fine in sql management studio. select customerid, orderid, orderdate tblorders orderdate between convert(datetime, '01/01/2015 00:00:00', 102) , convert(datetime, '01/01/2016 11:59:59', 102) i created parameters , dates , substituted dates: select customerid, orderid, orderdate tblorders orderdate between convert(datetime, '{?from} 00:00:00', 102) , convert(datetime, '{?to} 11:59:59', 102) i following error using same dates: failed retrieve data database. details: ado error code 0x80040e14 source microsoft ole db provider sql server description: incorrect syntax near '2015'. sql state: 42000 native error: 102 [database vendor code 102] i tried query without convert function, same result. this not correc

carousel - Flexslider r a n d o m i z e: t r u e --> how to get C a r o u s e l - i m a g e s in the s a m e o r d e r -

*flexsliders function randomize:true makes images changing every new visit - that's need , works fine, but... how can carousel-images (preview-images below slider) in same order? $(window).ready(function() { $('#carousel').show(); $('#carousel').flexslider({ animation: 'slide', controlnav: false, animationloop: false, slideshow: false, itemwidth: 210, itemmargin: 5, asnavfor: '#slider' }); $('#slider').flexslider({ namespace: "flex-", selector: ".slides > li", animation: "slide", easing: "swing", direction: "horizontal", reverse: false, animationloop: false, smoothheight: false, slideshow: false, slideshowspeed: 8000, animationspeed: 2000, /*neu****/ sync: "#carousel"

node.js - Partial Load in express and pug without reloading the layout.pug -

is possible layout.pug not refreshing on page switch example /page1 or /page2 ? layout.pug: doctype html html head title pug example meta(name="viewport" content="width=device-width, initial-scale=1") script(src="/js/vendor/jquery.min.js") body div.container h1#test= 0 script. var count = 0; setinterval(function() { count++; $('#test').text(count); console.log(count); },1000); block content page1.pug: extends layout block content .row .col-md-8 p page 1 a(href='/test2') link page2.pug: extends layout block content .row .col-md-8 p page 2 a(href='/test1') link on every switch /page1 or /page2 script should not reset , content should rendered. express: app.get

php - Laravel - Javascript - save all quantities and id's in a multidimensional array -

i have problem save product_id's related quantitie in multidimensional array. i have laravel foreach loop gives me every product bigger products array. every single product has data-id attribute , <input type="number"> element select quantitie. thats how data-id's , quantities : $('.update').on('click', function() { var ids = $('.list').map(function () { return $(this).data("id"); }).get(); var quantities = $('input[type=number]').map(function () { return $(this).val(); }).get(); }); output of ids variable: 55,65 output of quantities variable: 1,2 my problem need multidimensinal array gives me right product related quantitie. something like: var product_data = [ [0] = "id":55, "quantitie":1, [1] = "id":65, "quantitie":2 ]; i wasn't able need it. i'm still new javascript. thanks , sorry b

javascript - How to Filter by Category via Modal using checkbox Ionic / Angularjs? -

i have 3 types of filters: one of research: <div class="bar bar-subheader bar-assertive"> <label class="item-input-wrapper textbox-search"> <i class="icon ion-search placeholder-icon"></i> <input ng-model="q" placeholder="procurar" aria-label="filter restaurantess" /> </label> </div> where ng-model filter is: | filter: q one per order by: <!-- order --> <button class="button button-stable button-block icon-left ion-android-restaurant" modal-select="" ng-model="somemodel" options="selectablenames" option-property="role" modal-title="ordenar por..." has-search="true">ordenar <div class="option"> <h2>{{option.name}}</h2> </div> </button> where filter is: