Posts

Showing posts from May, 2013

swift - StoreKit in TVMLKit -

i trying find resources show me how either bridge storekit tvjs , use it, or sane way pass data , forth swift tvjs. i have skproducts being populated in swift , bridge between swift , js code, reason skproducts come through no data in them. so, before go deep down rabbit hole, thought ask internet if there better way? surely apple in it's wisdom has simpler way since have such nice , easy producttemplate built tvml. thanks!

c++11 - C++: What is best way to destruct this code? -

i want know proper way of destructing code i'm facing many random issues. however, piece of code working i'm calling ~cacheframe() first , assinging nullptr pagemap inside ~lrucache() #include <iostream> #include <unordered_map> #include <list> using namespace std; struct node { int pagenumber; node *next; node *prev; node(int pagenumber, node *prev, node *next) { this->pagenumber = pagenumber; this->next = next; this->prev = prev; } }; class cacheframe { const size_t maxsize; int size; node *head, *tail; public: cacheframe(int maxsize) : maxsize(maxsize) { size = 0; head = tail = nullptr; } ~cacheframe() { cout << "cacheframe destructor called" << endl; tail = nullptr; while (head) { node *temp = head->next; head->next = nullptr; head->prev = nullptr; de

Are Javascript Object Properties assigned in order? -

say have object assigns properties based off return value of function: var = 0; var f = function() { return ++i; } var foo = { a:f(), b:f(), c:f() }; is guaranteed foo.a 1, foo.b 2, , foo.c 3? know js doesn't guarantee order when iterate on object, assignment? is specified in js specification somewhere? i'm asking educational reasons. thanks. standard ecma-262 (5.1) - section 11.1.5 - object initialiser the production propertynameandvaluelist : propertynameandvaluelist , propertyassignment evaluated follows: 1. let obj result of evaluating propertynameandvaluelist. 2. let propid result of evaluating propertyassignment. ... 5. call [[defineownproperty]] internal method of obj arguments propid.name, propid.descriptor, , false. 6. return obj. so yes, order enforced standard.

swift - How to create a matrix of CAShapeLayers? -

i have code: var triangles: [[[cashapelayer]]] = array(repeating: array(repeating: array(repeating: 0, count: 2), count: 15), count: 15); but generates "cannot convert value of type..." compilation error. how can solve that? want access cashapelayers this: triangles[1][2][1].fillcolor = uicolor(red: 40/255, green: 73/255, blue: 80/255, alpha: 1).cgcolor; use optionals. var triangles: [[[cashapelayer?]]] = array(repeating: array(repeating: array(repeating: nil, count: 2), count: 15), count: 15) now there's nil instead of 0, think hinting at. every triangles[x][y][z] optional type you'll have safely unwrap. so have triangles[x][y][z] = cashapelayer() before object. edit correction. @ooper i thought more, , realized didn't really answer question. so may use loops initialize (which pain), or every time access index: if triangles[x][y][z] == nil { triangles[x][y][z] = cashapelayer() } let bloop = triangles[x][y][z]! bloop.fil

c# - Aggregate/Sum Uppercase Case Sensitive Issue -

i have following code use aggregate , sums. problem have source data populates account# column upper , lower case. i need aggregate/sum regardless of case. i have tried case insensitive dont seem have got work. i thinking maybe need clone account# column , make uppercase use clone, unsure how make column uppercase. please tell me how make code aggregate/sum regardless of case. thanks var accountgroups = completedt_svc_ro_dr.asenumerable() .groupby(x => new { accno = x.field<string>("account#"), description = x.field<string>("d e s c r p t o n . . . . . . . . . . . . x") .tostring() }) .select(grp => new { account = grp.key.accno, descrpt = grp.key.description, count = grp.sum(row => row.field<int>("cur-balance....")) }); var completedt_svc_ro_dr_cr = new datatable(); completedt_svc_ro_dr_cr.columns.add("d e s c r p t o n . .

dax - PowerBI - Measure to Summarize Daily data into Monthly Counts -

Image
i have table of defect data create measure gives me count of defects each month. know need use date table attempts far haven't worked out. what looking when works simple count month: january 125 february 225 march 220 april 120 defect table date table here measure trying build without luck... monthly defects = // totalytd(count(defects[defect]), 'date'[date]) var defectdate = firstdate(defects[created date]) var defectyear = year(defectdate) var defectmonth = month(defectdate) return calculate ( count(defects[defect]), filter ( defects, defects[created date] <= defectdate && (year (defects[created date]) = defectyear) && (month(defects[created date]) = defectmonth) ) ) here looking in end. if want count per month, measure should monthly defects=countrows(defects) this assuming have relationship between defect table , date table.

html - How to attach div to bottom of textarea using jquery -

i can have multiple html textarea boxes on web page , when textarea receives focus, i'd display (or create) div underneath it. when focus leaves want hide (or destroy) div. when different textarea receives focus want same thing occur. few details: the textareas can variety of widths , heights the div attached underside of textarea fixed , unchanging, 200px width , 40px high. won't change regardless of height/width of textarea above it. the user doesn't need interact div, , in fact shouldn't. displaying "x of xx characters used" or similar. it's display only, contents of div continuously change user types. (hopefully won't remove focus text area , hide div) only 1 "div-underneath-textarea" ever visible @ time. means 1 div need exist. , can created on fly if that's easiest. div should created when textarea receives focus. div should destroyed when textarea loses focus. contents of div must change each time key pressed. the div

java - Sort ArrayList of custom Objects by property -

i read sorting arraylists using comparator in of examples people used compareto according research method strings. i wanted sort arraylist of custom objects 1 of properties: date object ( getstartday() ). compare them item1.getstartdate().before(item2.getstartdate()) wondering whether write like: public class customcomparator { public boolean compare(object object1, object object2) { return object1.getstartdate().before(object2.getstartdate()); } } public class randomname { ... collections.sort(database.arraylist, new customcomparator); ... } since date implements comparable , has compareto method string does. so custom comparator this: public class customcomparator implements comparator<myobject> { @override public int compare(myobject o1, myobject o2) { return o1.getstartdate().compareto(o2.getstartdate()); } } the compare() method must return int , couldn't directly return boolean planning anyw

Python - PseudoCode for functions and operands -

i quite new pseudocode concept... idea of how functions , operands modulus, floor division , likes written in pseudocode. writing pseudocode code might me understand better... user_response=input("input number: ") our_input=float(user_response) def string (our_input): if (our_input % 15) == 0 : return ("fizzbuzz") elif (our_input % 3) == 0 : return ("fizz") elif (our_input % 5) == 0 : return ("buzz") else : return ("null") print(string(our_input)) your code isn't hard understand assuming knowledge of % modulus operation. floor division can written regular division. floor result, if necessary. if don't know how express them, explicitly write modulus(x, y) or floor(z) . pseudocode meant readable, not complicated. pseudocode words, , not "code". pseudo part of comes logical expression of operations

amazon web services - AWS Codebuild .NET Core building docker image -

we tried default aws codebuild image build .net core apps , worked fine. now require build docker images, default image has no docker installed. aws has option run builder image in priviledged mode can run docker-in-docker operations. i know if there image can use has both .net core , docker installed, can build code, , image. thanks!! you'll need create own docker image , provide codebuild (as part of project environment configuration). you can find codebuild's vended docker images here reference https://github.com/aws/aws-codebuild-docker-images you need create docker image has both docker daemon , .net core on same image. refer sample on how start docker daemon before starting builds in custom docker images http://docs.aws.amazon.com/codebuild/latest/userguide/sample-docker-custom-image.html

sql server - format a wbs column in sql -

how split format wbs column have prefix of zeroes using sql? example: 1.2.15 1.002.015 sample wbs column content: - 1.1 - 1.1.1 - 1.1.2 - 1.1.3 - 1.2 not beautiful code on earth, trick: declare @str varchar(100) = '1.2.15' declare @format varchar(10) = '000' declare @p1 varchar(10) declare @p2 varchar(10) declare @p3 varchar(10) declare @p4 varchar(10) declare @parts int = 1 + len(@str) - len(replace(@str, '.', '')) select @p1 = parsename(@str, @parts) select @p2 = parsename(@str, @parts - 1) select @p3 = parsename(@str, @parts - 2) select @p4 = parsename(@str, @parts - 3) select @p2 = format(cast(@p2 int), @format) select @p3 = format(cast(@p3 int), @format) select @p4 = format(cast(@p4 int), @format) select isnull(@p1, '') + isnull('.' + @p2, '') + isnull('.' + @p3, '') + isnull('.' + @p4, '') -- output 1.002.015 the key use parsename function. it's intended

ios - Checking variables in XCODE after app has crashed -

Image
my app has crashed telling index out range when use team[1] surprising because should have 2 strings in it. have looked everywhere, in xcode , internet, cannot find way see team array looks like. there anyway see this? much! click on left side of line of code contains ( team[1] ) create breakpoint. then run app. when reaches point stop executing can check going on. here screenshot on how debugging looks like you can see array content in "variables view" there example of "po" command on "console" section if want to use breakpoint everytime app crashes add exception breakpoint . should show code crashes , stop before can find out happened

c# - How do you programmatically access the Swagger.json file after it has been generated -

i trying create dynamic rest api uses swagger documentation in .netcore (using swashbuckle.aspnetcore ). dynamic in sense there 1 controller 1 possible response begin with, user can add "end points" posting service, later controller can translate new routes respond accordingly in order this, need able access , change swagger.json file have ui change reflect changes - possible? if how? note: know can access , see swagger doc navigating /{documentname}/swagger.json not allow me change it you can extend, filter , customize schema custom filters: https://github.com/domaindrivendev/swashbuckle.aspnetcore#extend-generator-with-operation-schema--document-filters i did use decorating more header-fields each request (like authorization header). i'm not sure, if it's gonna work whole endpoints. maybe it's worth try. update (edited) here sample idocumentfilter adds whole endpoints: private class documentfilteraddfakes : idocumentfilter { private

android - Play mp3 with continues from some mp3, pause and stop? -

i have mp3 files inside android internal folder. i want add feature continues, play, pause, , stop code run under still less able work well, there 1 can give solution play_murotal class public play_murotal(context context, listview listview, string nama_surat, long id_surat) { this.context = context; this.nama_surat = nama_surat; this.listview = listview; this.id_surat = id_surat; } public mediaplayer play_murotal_ayat() { final string dir_file = context.getfilesdir() + "/" + nama_surat; file root = new file(dir_file); final file[] files = root.listfiles(); // delay time play mp3 handler handler = new handler(); final list<integer> listdurasi = new arraylist<integer>(); (int = 0; < files.length; a++) { final string nama_file = files[a].getname(); // durasi total int durasi = get_duration_murotal(dir_file + &q

javascript - Correct way to open a new window in Appcelerator Titanium -

i have rather large app made in appcelerator titanium, i've not ported sdk version 3.2 because ti.ui.window's "url" property has been removed, application uses extensively. unfortunately, have not been able find new, correct way this. info i'm finding out there point removal of url property, or suggests should move alloy (which @ moment not doable me require complete rewrite of app). can point me example of right way should done? if you're not using alloy, it's 2 step process. first need handle window. done ti.ui.createwindow (see http://docs.appcelerator.com/platform/latest/#!/api/titanium.ui-method-createwindow ). have reference window, open it. so, var win = ti.ui.createwindow({title: 'my first window'}); win.open(); documentation on window object here. http://docs.appcelerator.com/platform/latest/#!/api/titanium.ui.window if have windows defined in other js files. ie. mywindow.js, can use require js window. have code in win

data binding - How to Bind a TextBox in DataGrid to a List in Wpf? -

Image
am working on new wpf project , struggling binding textbox in datagrid list of objects in wpf. can me fix? this code (simplified version) generate datagrid rows binding orders object. user can changed order items , should bind underline object. once user clicked read orders button displaying changes in textblock. issue: changes in textbox not updating orders object. observablecollection<stxordr> orders = new observablecollection<stxordr>(); private void window_initialized(object sender, eventargs e) { orders.add(new stxordr() { id = 1, desc = "order-#1", item1 = "11", item2 = "12", item3 = "13" }); orders.add(new stxordr() { id = 2, desc = "order-#2", item1 = "21", item2 = "22", item3 = "23" }); orders.add(new stxordr() { id = 3, desc = "order-#3", item1 = "31", item2 = "32", item3 = "33" }); dg2.itemssou

ms word - What is behind this difference in parentheses effect in VBA? -

i've not seen in other languages see lot in vba (which started working with). suppose have table in word , wish set rows height. if this tbl.rows.setheight inchestopoints(1), wdrowheightexactly the table's rows indeed set 72 points or 1 inch in height. however, if surround arguments in parentheses, did instinctively, vba gives error -- expected:= . i can solve using throw-away variable, this x = tbl.rows.setheight (inchestopoints(1), wdrowheightexactly) or, of course, can not surround arguments in parentheses. microsoft's documentation on setheight method doesn't mention return value, in case, behavior extensive throughout vba. it's not specific setheight method. my questions: called? should use throw-away variable or throw away parentheses? what's logic microsoft's point of view? there consequences using 1 or other, consequences can't imagine (because unknown unknowns)? definitely don't introduce "throw-away va

ios - Color of collectionView cell background is different -

i have collectionviewcells colored through storyboard menu like so. (alpha @ 1.0) background color of cell supposed become more transparent when clicked once return normal color on second click however, color on second click different initial color. in the picture provided, top cell still initial color storyboard , bottom 2 after being clicked twice. can see there slight color difference between them. believe problem opacity(the slider @ bottom of first picture) different alpha. used swift line set background color of each cell initial color: cell.backgroundcolor = uicolor(colorliteralred: 235/255, green: 123/255, blue: 45/255, alpha: 0.8) i guess since use 80% opacity , 100% alpha initial , 100% opacity , 80% alpha second click, color different. know opacity applies background of cell , not cell whole, opposed alpha decides transparency of whole cell including text in it. wrong here though. question is: how can make cells color of top cell? more specifically, there method c

excel - Concat function not available in office 2016 professional -

i'm working on spreadsheet created on different machine install of office 2016 version 1701. i'm running 2016 professional version 1707. many of new functions won't work, example concat. i've tried updating install appears have recent updates. any ideas why wouldn't have access released functions? those new functions available in subscription versions of excel (i.e. need office 365 subscription), , not 2016 versions. if want equivalent, you've got use udf. here's link concat udf wrote time back. can no doubt find equivalent udfs other new features aren't in non-subscription version via google.

swift3 - When UICollectionViewFlowLayout is used, can I change the vertical size of the header (referenceSizeForHeaderInSection)? -

god taught me. 1 simpler. @iboutlet var aa: uicollectionview! . . override func viewdidappear(_ animated: bool) { aa.reloaddata() i did :) override func viewdidappear(_ animated: bool) { xxx=2000 let aa = self.view.viewwithtag(1) as! uicollectionview aa.reloaddata() when uicollectionviewflowlayout used, can change vertical size of header (referencesizeforheaderinsection)? in following code, vertical size of collectionview's header not become 2000. want change vertical size of header after viewdidappear. is there solution addsubview uicollectionview , view uiscrollview? or use uicollectionviewlayout (custom)? want change vertical size of header. . class testo: uiviewcontroller,uicollectionviewdatasource,uicollectionviewdelegate,uicollectionviewdelegateflowlayout { var xxx:cgfloat=1000 . . override func viewwillappear(_ animated: bool) { } override func viewdidappear(_ animated: bool) { xxx=2000 self.view.setneedslayout() self.view.

vba - How to dynamically change the MS excel 2016 vlookup value by clicking on different cells? -

based on tables in ms excel 2016 spreadsheet, working sum of vlookup array function in order built sum of 2 columns given lookup value: =sum(vlookup(lookup_value, lookup_range, {2,3,4}, false)) the tables typically this: lookup_value january february march april 8/15/2020 $1.66 $1.40 $1.05 $103.00 2/15/2021 $1.50 $1.97 $0.47 $99.51 8/15/2021 $1.50 $1.96 $0.46 $99.05 2/15/2022 $1.50 $1.95 $0.45 $98.60 8/15/2022 $1.50 $1.94 $0.44 $98.15 2/15/2023 $1.50 $1.93 $0.43 $97.72 8/15/2023 $1.50 $1.93 $0.43 $97.30 for example, result of =sum(vlookup( 8/15/2020, $a$1:$g$5, {january, march}, false)) is $1.66 + $ 1.05 = $ 2.71 is there way dynamically change the lookup value clicking on different cells? need tool produces vlookup sum different date lookup values, defined when click on them. how dynamically change vlookup value base

Allow users to upload a video in WordPress -

how allow users upload video in profile , display on wordpress? know of plugin? "does know of plugin? in regards first question , topic" very similar to post: wordpress media custom post type dated 2010.. why started new post.. alot has changed.. i have set login far wp user manager , need allow user upload video link or video video displayed on profile. using advanced custom fields pro make frontend. documentation: https://www.advancedcustomfields.com/resources/create-a-front-end-form/ in wordpress there plugin called user frontend pro. allows create frontend login user give ability create custom frontend form. used advanced custom fields create custom form fields data entered form. able make custom post cpt ui , create single.php template of post being created frontend user. form allowed video custom field entered other types of information. there amount of coding need understand in php in creating template structure, list of plugins in w

c# - Syncfusion's SfSchedule doesn't handle different item types -

situation : got syncfusion sfschedule control in ui. bind list of appointments itemssource this: <schedule:sfschedule x:name="mycalendar" itemssource="{binding appointments}" ... /> my appointments property list of objects implement interface wrote: private observablecollection<icalendaritem> _appointments; public observablecollection<icalendaritem> appointments { => _appointments; private set => set(ref _appointments, value); } i have 2 implementations icalendaritem : singlecalendaritem , repetitivecalendaritem . problem : syncfusion's schedule control works , displays appointments long appointments list contains of 1 of calendar item types only, instance singlecalendaritem or repetitivecalendaritem . the second add both object types list, schedule control displays nothing. continues display nothing if bound list consists of objects of type singlecalendaritem only.

arrays - PHP > Returning allowed paths -

this question has answer here: php array url values new array combined values 3 answers i asked question published little confusing , therefore proberbly not answered. try again example, if it's fine. there original array's url's 1 in example 1 , 2. every last folder of each element of original array folder user has right view. example 1 array( 'a' 'a/b/c' 'a/b/c/d/e' 'a/y' 'b/z' 'b/z/q ) i 2 array's like: array['short']( 'a/c/e' 'a/y' 'z/q' ) array['full']( 'a/b/c/d/e' 'a/y' 'b/z/q' ) example 2 array( 'projects/projecta/books' 'projects/projecta/books/cooking/book1' 'projects/projecta/walls/wall' 'projects/projectx/walls/wall' 'projects/projectz/' 'projects/projectz/wood/cheese/bacon&

expandablelistview - How to make three level expandable List view from JSON in Android? -

hi want create 3 level expandable list view json. have creted expandable list view 2 two level 3 level did not got how please if body don please me complete it. here code have created. my main activity string tag="mainactivity"; private expandablelistview expandablelistview; arraylist<string>mainlist =new arraylist<>();; hashmap<string, list<string>> childcontent = new hashmap<string, list<string>>(); hashmap<string, hashmap<list<string>,list<string>>> subchildcontent = new hashmap<string, hashmap<list<string>,list<string>>>(); list<string> childlist; list<string> subchildlist; private list<string> parentheaderinformation; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); new releaseoverviewreleaseasynchtask().execute(); } @override protected void onresume() {

python - Scatter plot label overlaps - matplotlib -

Image
i draw scatter plot labeling. however, these labels overlapping. how can enhance can see numbers better? also, have numbers in integer, shows label values in float. wondering why. looking forward hearing guys. here's code: col = df['type'].map({'a':'r', 'b':'b', 'c':'y'}) ax = df.plot.scatter(x='x', y='y', c=col) df[['x','y','id']].apply(lambda x: ax.text(*x),axis=1)

java - Apache DBCP2 connection pool open more MYSQL connection than maxTotal on Tomcat startup -

i have configured apache dbcp2 jndi datasource in apache tomcat 8.5.16. resource tag in context.xml looks below. <resource auth="container" type="javax.sql.datasource" driverclassname="com.mysql.cj.jdbc.driver" url="jdbc:mysql://localhost:3306/mydb?autoreconnect=true&amp;usessl=false" username="root" password="mypassword" name="jdbc/myds" initialsize="5" minidle="5" maxidle="10" maxtotal="20" testoncreate="true" testonborrow="true" testonreturn="true" testwhileidle="true" validationquery="select 1 dual" validationquerytimeout="60" timebetweenevictionrunsmillis="180000" numtestsperevictionrun="10" softminevictableidletimemillis="150000" maxconnlifetimemillis="300000" logabandoned=&q

javascript - Load Failed image into HTML -

<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <script type="text/javascript"> var = 1; window.onunload = function() { debugger; } function para() { = + 1; var source = document.getelementbyid('p').src; document.getelementbyid('p').src = source.replace(i - 1, i); } </script> </head> <body> <div><img alt="image" id="p" src="images/para/p-1.jpg"></div> <div><img id="q" src="images/q/p-1-q-1.jpg" </div> <div><img id="a" src="images/a/p-1-q-1-a-1.png"></div> <input id="button1" type="button" value="next par

indexing - Solr Cassandra integration -

i trying integrate solr cassandra. have tried https://github.com/stratio/cassandra-lucene-index have compiled , run , have tried ant build external cassandra failed. https://github.com/tjake/solandra but 1 supported cassandra 1.x can 1 please suggest me how can this? indexing data in cassandra or extracing solr , index data in solr. thanks

java - Does Selenium Support automate to Desktop Applications -

i want use selenium automate desktop application desktop applications not provide locators , elements x path,how can locate elements in desktop application no, using selenium can automate web based application. selenium doesn't provide way automate desktop applications. automating desktop application can use other tools such autoit . refer here idea-> http://seleniumsimplified.com/2016/01/can-i-use-selenium-webdriver-to-automate-a-windows-desktop-application/

python - How to set image thumbnail for file stored on Google Drive -

Image
using google drive api can update writeable file's attribute using files.update() method: import datetime data = {'modifiedtime': datetime.datetime.utcnow().isoformat() + 'z'} drive_service.files().update(fileid=file_id, body=data, fields='id').execute() lets have png image posted somewhere on web: 'image':'http://pngimg.com/uploads/eagle/eagle_png1228.png' or png file saved on local drive "/users/username/downloads/my_image.png" . how set png file posted on web or png file saved on local drive thumbnail image file stored on google drive? here tried far. source.png file saved on local drive went ahead , encoded base64_encoded.png file using code (i not sure if did correctly): import base64 src = '/source.png' dst = '/base64_encoded.png' image = open(src, 'rb') image_read = image.read() encodestring = base64.encodestring(image_read) image_result = open(dst, 'wb') image_result.write

javascript - Login and Log out routing with material Sidenav -

hi i'm using angular 4 angular material 2 need assistance in routing. have login component loaded when app starts router-outlet in appcomponent , , when logged in routing takes place inside router-outlet in sidenav. sidenav inside homecomponent , when logging out cannot find parent logincomponent . how should configure routes, i'm not sure how use child routes in angular. inside app.routing const approutes: routes = [ { path: '', redirectto: '/login', pathmatch: 'full' } ]; app.component.html <router-outlet></router-outlet> home.component.html <md-sidenav-container *ngif="isloggedin$ | async isloggedin"> <md-sidenav #sidenav mode="over" opened="true"> </md-sidenav> <md-toolbar color="primary"> <md-icon class="menu" (click)="sidenav.toggle()">menu</md-icon> <span class="example-

Efficient building of Set in Scala, without o(n^2), if I know there are no duplicates -

i required pass set in scala series of functions. don't have choice, must set. i receive big list of json values: scala.list[jsonast.jvalue] the naive way use toset: val input : scala.list[jsonast.jvalue] val myset = input.toset but can expensive performance perspective. way toset works starts first element in list, , adds following ones one-by-one. each time, scans set ensure value isn't there. let's assume know fact there aren't duplicates. there way me create set more efficiently? ideally, copying list set. no changes in order or contents. as ziggystar pointed out, can have o(1) performance when converting list set if willing use adapter, , trade fast conversion (o(1)) set poor performance when calling contains (o(n)). if acceptable trade off use case, can use this: import scala.collection.abstractset class setadapter[a](val self: seq[a]) extends abstractset[a] { def +(elem: a): setadapter[a] = if (self.contains(elem)) else new seta

php - Last iteration values left in array -

if ($cart = $this->cart->contents()) { foreach ($cart $item){ $order_detail = array( 'res_id' =>$this->session->userdata('menu_id[]'), 'customer_id' =>$coustomers, 'payment_id' =>$payment, 'name' => $item['name'], 'productid' => $item['id'], 'quantity' => $item['qty'], 'price' => $item['price'], 'subtotal' => $item['subtotal'] ); } print_r($order_detail); exit; when foreach loop ends, last iteration value left. need values within array. because order_detail overwrite each time. use array instead of simple variable. $order_detail = array(); if ($cart = $this->cart->contents()) { for

excel vba - VBA Date shown as Number -

Image
i new vba , need rows out of database. problem date first time selected shown in format dd.mm.yyyy , after time date shown whole number 42814 or that. here 2 pictures better understanding and here code application.cutcopymode = false activesheet.listobjects.add(sourcetype:=0, source:= _ "odbc;dsn=opsapps;uid=alligatoah;trusted_connection=yes;app=microsoft office 2016;wsid=at000616;database=opsapps" _ , destination:=range("$a$1")).querytable .commandtext = array( _ "select tv.customer, tv.knum, tv.dmrf, tv.bom, tv.costs, tv.plnlaunch, tv.date, tv" _ , _ "_.actualcosts" & chr(13) & "" & chr(10) & "from opsapps.dbo.tv tv" & chr(13) & "" & chr(10) & "where (tv.systemmcsdate>={ts '2017-01-01 00:00:00'})" _ ) .rownumbers = false .filladjacentformulas = false .preserveformatt

iron router - Error: Unrecognized operator: $nearSphere in meteor js -

i have simple code in meteor js find near garages within 10 kilometres query works fine in mongodb database if run manually in robomongo works fine when run in routes throws error. this. error: unrecognized operator: $nearsphere in meteor jsi i see blogs said need call server side method this. use below code call server side route. router.route('/search/:name', {name:'searchlist', data:function(){ var searchedparams = this.params.name.split('-'); var lat = searchedparams.pop(); var lng = searchedparams.pop(1); return {searchvalue: centers.find({ coordinates: { $nearsphere: { $geometry: { type: "point", coordinates: [lng,lat] }, $maxdistance: 10000 } } })} } }, { where: "server" } ); if have idea pl

java - plugin with id 'com.android.application' not found. android studio jni sample -

i trying follow android-studio-jni tutorial following link: https://codelabs.developers.google.com/codelabs/android-studio-jni/index.html?index=..%2f..%2findex#2 the simple android app works fine change classpath gradle-experimental suggested in tutorial, above mentioned error. did @ other questions related none of them solved issue. these changes made(as done in tutorial example): in build.gradle (module:app) file: `proguardfiles getdefaultproguardfile('proguard-android.txt'),` `'proguard-rules.pro'`
 replaced : proguardfiles.add(file('proguard-android.txt')) in gradle-wrapper.properties (gradle version): distributionurl=https\://services.gradle.org/distributions/gradle-3.3-all.zip replaced with distributionurl=https\://services.gradle.org/distributions/gradle-4.1-all.zip in build.gradle (project:samples) file: classpath 'com.android.tools.build:gradle:2.3.3'
 replaced with classpath 'com.android.tools.build:g

python - How to add additional sum column to the DataFrame based on specific column groups? -

in such case, have dataframe like col1 col2 1 2 3 b 1 b 2 what want first groupby col1 , sum col2 columns of groups, add sum dataframe , get col1 col2 sum 1 6 2 6 3 6 b 1 3 b 2 3 option 1 transform returns result same index of original object. use assign return copy of dataframe new column. see split-apply-combine documentation more information. df.assign(sum=df.groupby('col1').col2.transform('sum')) col1 col2 sum 0 1 6 1 2 6 2 3 6 3 b 1 3 4 b 2 3 option 2 use join on results of normal groupby , sum . df.join(df.groupby('col1').col2.sum().rename('sum'), on='col1') col1 col2 sum 0 1 6 1 2 6 2 3 6 3 b 1 3 4 b 2 3 option 3 creative approach pd.factorize , np.bincount f, u = df.col1.factorize() df.assign(s

javascript - Angular NVD3: How to access the chart object defined in HTML -

i have defined multibar chart using <nvd3> directive , passing data , options defined in controller: <nvd3 options="vm.options" data="vm.data"></nvd3> now want somehow access chart object created manipulations, example, obtain xaxis scaling function. if chart defined within javascript have object: var chart = nv.models.multibarchart() .stacked(false) .showcontrols(false); // , can these scaling functions var yvaluescale = chart.yaxis.scale(); var xvaluescale = chart.xaxis.scale(); is possible them if chart defined in html? in advance.

Which gecko driver suitable for - Selenium 3.4.0 Firefox 48.0 -

i using selenium webdriver 3.4.0 , firefox 48.0 webdriver.manage().timeouts().implicitlywait(5, timeunit.seconds); tried below geckodriver version : gecko 0.14 - missing type gecko 0.15 - not number gecko 0.16 - unable find matching set of capabilities gecko 0.17 - unable find matching set of capabilities gecko 0.18 - unable find matching set of capabilities firefox 48 lowest version need test on.

angular - Upgrade JQuery version 3.2 typing file,it's throws lint error -

in application, have used interface below.it's works fine in jquery 2.0 interface jquery{ data(key: any): any; } when upgrade version jquery 3.2,it's throws below lint errors. all declarations of 'jquery' must have identical type parameters. interface jquery namespace jquery typescript version: 2.3 how resolved issue or modify interface?

docker - Can I have some keyspaces replicated to some nodes? -

i trying build multiple api want store data cassandra. designing if have multiple hosts but, hosts envisioned of 2 types: trusted , non-trusted. because of have data don't want end replicated on group of hosts rest of data replicated everywhere. i considered making node public data , 1 protected data require trusted hosts run 2 nodes , complicate way api interacts data. i building in docker container also, expect there frequent node creation/destruction both trusted , not trusted. i want know if possible use keyspaces in order achieve required replication strategy. you have 2 datacenters 1 having public data , other private data. can configure keyspace replication replicate data 1 (or both) dcs. see docs on replication networktopologystrategy however there security concerns here since nodes need able reach 1 via gossip protocol , client applications might need contact both dcs different reads , writes. i suggest configuring security perhaps ssl starters ,

java - send tomcat conf files to container using kubernetes -

i new docker , kubernetes, trying create container having tomcat7/java7 deploy webapps it. concern have tomcat/conf config files, have details of database connections , threadpool , java memory etc. what want copy these files kubernetes server docker-container , place them @ right places, while starting container. p.s: don't want via enviroment variables, going huge in numbers if keep variable every entry in config files. you add configmap in kubernetes, tomcat config (files or whole dir) kubectl -n staging create configmap special-config --from-file={path-to-tomcat-conf}/server.xml and mount on pod (kubectl create -f path/to/the/pod.yaml) apiversion: v1 kind: pod metadata: name: tomcat-test-pod spec: containers: - name: test-container image: tomcat:7.0 command: [ "catalina.sh", "run" ] volumemounts: - name: config-volume mountpath: /usr/local/tomcat/conf/server.xml volumes: - name: config-volume configmap:

vue.js - Symfony 3 routes + VueJS's index.html with F5 falls to 404 -

i try connect vue.js symfony 3, have no idea how create proper route configuration it. project tree looks that: project root - app/ - resources/ - views/ - default/ - web/ - assets/ - static/ index.html // here vue included from symfony provide rest api, routes prefixed /api/. , have routes in vue spa. problem if press f5 in browser on vue route, of course not included in routing.yml, browser returns 404 error symfony. 1 half-working decision when put content of index.html resourses/views/default/twig such route: fallback_for_vue: path: /{req} defaults: { _controller: 'appbundle:default:index' } requirements: req: ".+" , taken question , not need, because don't want frontend programmer go somewhere except web/ folder. configuration of symfony routes should use? you need wildcard address point vue.js application. otherwise when reload send request symfony, , doesn't know hoy handl

swift3 - How to parse JSON data from local JSON File swift 3? -

i trying print list of currencies , symbols json file have locally in project guard let path: string = bundle.main.path(forresource: "common-currency", oftype: "json") else {return} let url = url(fileurlwithpath: path) { let jsondata = try data(contentsof: url) let json = try jsonserialization.jsonobject(with: jsondata, options: .mutablecontainers) print(json) guard let jsonarray = json as? [any] else { return } currency in jsonarray { guard let eachcurrency = currency as? [string: any] else {return} guard let currencyname = eachcurrency["code"] else {return} guard let currencysymbol = eachcurrency["symbol_native"] else {return} print(currencyname) print(currencysymbol) } } catch { print(error) } this current code have, when run print(json) command gets executed, not other 2 prints. doing wrong? the