Posts

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...