Posts

Showing posts from April, 2015

python - Plot average on subplots (pandas) -

Image
i've managed plot subplots groupby. have 2 columns 'a', , 'b', want plot on subplot (1 per value in 'b') respective averages. prepare data counting, dropping duplicates, , summing (if there more elegant way it, please let me know!). df = pd.dataframe([[1, 'cat1'], [1, 'cat1'], [4, 'cat2'], [3, 'cat1'], [5, 'cat1'],[1, 'cat2']], columns=['a', 'b']) df = df[['a','b']] df['count'] = df.groupby(['a','b'])['a'].transform('count') df = df.drop_duplicates(['a','b']) df = df.groupby(['a','b']).sum() then unstack , plot subplots: plot = df.unstack().plot(kind='bar',subplots=true, sharex=true, sharey=true, layout = (3,3), legend=false) plt.show(block=true) i add mean each category, have don't know: 1. how calculate mean. if calculate on unstacked groupby, mean of count, rather value 'a'....

android - Is it possible to call method in Activity class from Application class? -

i have defined public method in activity class (lets some_method()).is possible call method in application class. you can use singleton activity this: public class youractivity extends appcompatactivity { public static youractivity instance; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_layout); instance=this; //your code } //your method public void yourmethod() { } @override protected void ondestroy() { super.ondestroy(); instance=null; } } then in application method can call method of activity this: if (youractivity.instance != null) { youractivity.instance.yourmethod(); }

javascript - jQuery event doesn't work at new created element -

i take img element class ".follow", hide , replace new created element button class ".followbutton". after "mouseout" event take new created button element, hide , replace new created img element class ".follow". have new element img same atributes initially. "mouseenter" doesn't work. , don't figure out why. $(".follow") .on("mouseenter", function() { $(this).fadeout(150, function() { var init = this; var btn = document.createelement("button"); var t = document.createtextnode("follow"); btn.appendchild(t); btn.classname = "followbutton"; $(btn).hide(); $(this).replacewith(btn); $(".followbutton").show(150); $(".followbutton").on("mouseout", function() { var imgback = $("<img />"...

C# Google API (SheetsServices) Insert new row -

how can insert new row google spreadsheet. using google api (sheetsservices). class googleapi { // if modifying these scopes, delete saved credentials // @ ~/.credentials/sheets.googleapis.com-dotnet-quickstart.json static string[] scopes = { sheetsservice.scope.spreadsheets, "email" }; static string applicationname = "google sheets api .net quickstart"; public googleapi() { usercredential credential; using (var stream = new filestream("secret.json", filemode.open, fileaccess.read)) { string credpath = system.environment.getfolderpath( system.environment.specialfolder.personal); credpath = path.combine(credpath, ".credentials/secret.json"); credential = googlewebauthorizationbroker.authorizeasync( googleclientsecrets.load(stream).secrets, ...

R Shiny eventReactive actionBotton interaction -

Image
i have actionbotton randomly pick 1 column first 5 columns dataset mtcars , plot it. now actionbotton job chart not plotted @ first place when app launched. is there way have plotted when shiny app launched. library(shiny) server <- function(input, output) { x = eventreactive(input$plot,{ mtcars }) output$plot = renderplot({ = sample(1:5,1) plot(x()[,i],ylab=names(mtcars)[i]) }) } ui <- fluidpage( actionbutton("plot","randomly plot"), plotoutput("plot") ) shinyapp(ui = ui, server = server) you can add condition button hasn't been clicked. note button works counter if hasn't been clicked value 0. library(shiny) server <- function(input, output) { x = eventreactive(input$plot,{ mtcars }) output$plot = renderplot({ = sample(1:5,1) if(input$plot == 0){ return(plot(mtcars[,i],ylab=names(mtcars)[i])) } plot(x()[,i],ylab=names(mtcars)[i]) }) } ui <- fluidpa...

Prefered syntax for verilog module declaration -

i relatively new fpgas, , looking guidance modern best practice regarding declaration of modules in verilog. i have seen 2 ways of declaring module in verilog. first reminds me of traditional c , such examples on wikipedia : module toplevel(clock,reset); input clock; input reset; /* snip */ endmodule whereas alternative syntax has input/output specifier part of argument list, not dissimilar vhdl, in this example : module fadder( input a, //data in input b, //data in b input cin, //carry in output sum_out, //sum output output c_out //carry output ); /* snip */ endmodule for newly written verilog code, syntax preferred? "preferred", in instance, means written in standard or related material (either explicitly written, or implicitly examples given in standard), or written in well-regarded style guide. question isn't asking personal preference! the second syntax form indented replace first s...

SMS Gateway to send and receive sms in Nigeria -

please me , suggest me sms gateways provide 2 way sms in nigeria. have created web application. need send , receive sms through application , maintain log same in db. thanks you can use twilio sms gateway. url: https://www.twilio.com/sms , https://www.twilio.com/sms/pricing/ng

How can I increment a date by one day in Php? -

i using this syntax increase 1 day above when put format still give me wrong date this. '01/01/1970' want format , date '25/08/2016'. $today = '24/08/2016'; $nextday = strftime("%d/%m/%y", strtotime("$today +1 day")); so please me how can this.advance thanx. you can use strtotime . $your_date = strtotime("1 day", strtotime("2016-08-24")); $new_date = date("y-m-d", $your_date); hope you.

node.js - SMS verification NodeJS -

i'am building blog nodejs , express , mongodb , simple rest api can post blogs, signup, login, etc. i want build sms verification system using twilio, pretty easy, generate code, send user phone number twilio , when user post /verify , i'm checking code , update user. my problem i'm not sure store generated code. searched can following ways: store code in user model ( user.verificationcode = generated_code ) store code in user session make new model called code , save { user: objectid(user_id), code: generated_code } but i'm not sure if best practice, can explain whats best way this? option 3 not make sense. , go option 1 or option 2 depends on how long can wait user enter code. , life of session. whether session going expire on browser close or not? generally suggest go option 2 . assuming user going feed code before session expires. typical case.

java - NumberFormatException for String while parsing float -

this error caused due different system locale. use dot decimal separator. i tried set default locale when application starts i'm getting same exception. locale.setdefault(locale.us); stacktrace: caused by: java.lang.numberformatexception: input string: "6,2" @ sun.misc.floatingdecimal.readjavaformatstring(floatingdecimal.java:2043) @ sun.misc.floatingdecimal.parsefloat(floatingdecimal.java:122) @ java.lang.float.parsefloat(float.java:451) it looks code using float.parsefloat . doesn't use locale settings. docs: returns new float initialized value represented specified string , performed valueof method of class float. and valueof has detailed grammar, , includes this: to interpret localized string representations of floating-point value, use subclasses of numberformat . so basically, default locale irrelevant here. if want parse "6,2" should using numberformat locale using comma decimal separator.

Why changes in one branch can affect the other branch in git? -

i @ master branch, i commit everything then create new branch "git checkout -b xxx" then switch master "git checkout master" then delete master branch without using "git rm" i checkouted branch xxx, during branch switching, shows long list every file had status 'd' then found branch xxx had empty folder too. it wasn't problem since can revert in branch xxx "gt reset --hard head" i wonder why deleting behavior @ 1 branch can affect other branch? doesn't branch stored everything? then tried merge 1 of branch using "git merge xxx", said "alread update date" this happen because xxx branch merged master , nothing changed in xxx after that. i checkouted branch xxx, during branch switching, shows long list every file had status 'd' you haven't commit changes , switched branch xxx , changes moved branch i wonder why deleting behavior @ 1 branch ca...

java - JPA Collection of objects with Lazy loaded field -

what way force initialization of lazy loaded field in each object of collection? at moment thing comes mind use for each loop iterate trough collection , call getter of field it's not effiecient. collection can have 1k objects , in case every iteration fire db. i can't change way fetch objects db. example of code. public class transactiondata{ @manytoone(fetch = fetchtype.lazy) private customerdata customer; ... } list<transactiondata> transactions = gettransactions(); you may define entity graphs overrule default fetch types, defined in mapping. see example below @entity @namedentitygraph( name = "person.addresses", attributenodes = @namedattributenode("addresses") ) public class person { ... @onetomany(fetch = fetchtype.lazy) // default fetch type private list<address> addresses; ... } in following query adresses loaded eagerly. entitygraph entitygraph = entitymanager.getentitygraph(...

c# - WPF - add userid as prefix to orignal mail while forwarding mail -

i have textbox shows content of mail body. while forwarding mail original mail body if content edited pressing key user id should appended. please let me know how should in wpf. before sending mail if(edits_made) // bool value indicates if changes have been made { yourtextbox.text.insert(0, userid); }

rxjs5 - Is it possible to add Teardown logic to an already existing Observable? -

for instance, i'm calling unsubscribe observable returned angular 2's http. but have custom logic surrounding it. is possible add custom teardown logic existing observable, 1 returned angular 2's http? something along lines of observable.prototype.whenunsubscribed(customteardownlogic) maybe? this might not want may help: suppose have (taken the hero guide @ angular 2 website): (typescript) @injectable() export class heroservice { private heroesurl = 'api/heroes'; // url web api constructor (private http: http) {} getheroes(): observable<hero[]> { return this.http.get(this.heroesurl) .map(this.extractdata); } private extractdata(res: response) { let body = res.json(); return body.data || { }; } } // , somewhere else in code do: let subscription = service.getheroes().subscribe( ... stuff here ); // , later on do: subscription.unsubscribe(); if want add custom tear-down logic, wrap obser...

javascript - How can I generate pdf of svg image -

in following code print working fine unable create pdf of svg image.if generate pdf getting generated blank output(blank pdf).i tried capture,js.pdf,dompdf,tcpdf not works me. function printelem(elem) { popup($(elem).html()); } function popup(data) { var mywindow = window.open('', 'parent', 'height=400,width=600'); mywindow.document.write('<html><head><title>my div</title>'); /*optional stylesheet*/ //mywindow.document.write('<link rel="stylesheet" href="main.css" type="text/css" />'); mywindow.document.write('</head><body >'); mywindow.document.write(data); mywindow.document.write('</body></html>'); mywindow.document.close(); // necessary ie >= 10 mywindow.focus(); // necessary i...

dynamic - Replace string dynamically using Regex in java code -

i want solution below in java code string inputstr = "this sample @hostname1 @host-name2 want convert string :@test host-@test1 format i.e dollar followed open braces, string , close braces."; output string need output: "this sample ${hostname1} ${host-name2} want convert string :${test} host-${test1} format i.e dollar followed open braces, string , close braces."; i tried below like public void regex(string intputstr){ string pattern = "\\s(@)\\s+"; pattern r = pattern.compile(pattern); matcher m = r.matcher(commands); string replacepattern = " \\$\\{\\s+\\} "; int i=0; while(m.find()) { pattern.compile(pattern).matcher(intputstr).replaceall(replacepattern); // system.out.println(m.group(i)); //i++; } // system.out.println(i); system.out.println(intputstr); } but exceptions , not able proceed. please help. ...

.net - Converting two loops to single LINQ query using C# -

i searched links here change nested loops single linq, tried using those, part of code not working, need expert guidance fix this, update 1: i guess wasn't clear in explanation, loops works fine! expected, getting correct results, doing optimization, instead of using 2 loops need same code converted single linq. here code : foreach (var ob in all_request_list.where(x => x.startdate != x.enddate)) { int consq_dates = ob.enddate.datediff(ob.startdate); (int = 0; <= consq_dates; i++) { combined_list.add(new { shiftid = ob.shiftid, skillid = ob.skillid, employeeid = ob.employeeid, assigndate = ob.startdate.adddays(i), profileid = ob.profileid }); } } i have problem adding increment variable i ob.startdate.adddays(i) . any appreciated. is you're looking for? var items = ob in all_request_list ob.startdate != ob.enddate let consq_dates = ob.enddate.datediff(ob.startdate) in enume...

arrays - How to Display the first 20 messages in the DB -

i found code in internet, functions message box. code works fine. however, display messages stored in file message.db. my question is, how can make display last 20 posted messages? i'm sorry asking this. have no knowledge programming. appreciate help... here snippet of code: <div class="container" ng-controller="messageboardctrl"> <form> <input type="email" placeholder="email address" ng-model="email" required/> <textarea placeholder="advertise link here free..." rows="5" style="width:90%" ng-model="message" required=""></textarea> <button class="btn btn-primary" ng-click="sendmessage()">post</button> </form> <p>{{item.message}}</p> <script> function messageboardctrl($scope, $http, $timeout) { $scope.items = []; $scope.message = ''; ...

sql - Merge date ranges -

oracle sql newbie here , first time poster. i thought simple until realized can't figure out how split return assignments. here assignments table: asgn id st_dt end_dt pos locn status wage_cd -- ---------- ---------- ----- ---- ------ ------- 12-31-2006 08-16-2009 clerk lax 3 a 08-17-2009 10-04-2009 clerk lax 0 z 10-05-2009 06-30-2010 opr nyc 3 a 07-01-2010 12-31-2010 opr nyc 3 b 01-01-2011 06-30-2012 opr nyc 3 c 07-01-2012 04-09-2013 opr nyc 3 d 04-10-2013 06-30-2013 clerk lax 3 a 07-01-2013 08-10-2014 clerk lax 3 b 07-01-2013 08-10-2014 clerk lax 3 c b 04-10-2013 05-31-2013 sup lax 3 b 06-01-2013 06-30-2014 sup lax 0 z b 07-01-2013 08-10-2014 sup lax 3 b b 08-11-2014 08-11-2014 clerk nyc 3 b 08-12-2014 01-11-2015 sup lax 3 b 01-12-2015 02-10-2016 su...

ubuntu 16.04 - ZFS storage on Docker -

i try out zfs on ubuntu(16.04) docker container. followed following https://docs.docker.com/engine/userguide/storagedriver/zfs-driver/ > lsmod | grep zfs zfs 2813952 5 zunicode 331776 1 zfs zcommon 57344 1 zfs znvpair 90112 2 zfs,zcommon spl 102400 3 zfs,zcommon,znvpair zavl 16384 1 zfs listing zfs mounts >sudo zfs list name used avail refer mountpoint zpool-docker 261k 976m 53.5k /zpool-docker zpool-docker/docker 120k 976m 120k /var/lib/docker after starting docker > sudo docker info containers: 0 running: 0 paused: 0 stopped: 0 images: 0 server version: 1.12.0 storage driver: aufs root dir: /var/lib/docker/aufs backing filesystem: zfs dirs: 0 ... wonder why still **storage driver: aufs & root dir: /var/lib/docker/aufs" in place of zfs? also how can map "/zpool-docker" ubuntu container image? ...

javascript - Uncaught TypeError: Cannot read property 'toUpperCase' of null -

my code seems right don't know why getting error: uncaught typeerror: cannot read property 'touppercase' of null here code: //the function executed after clicks "take quiz" function startquiz() { //the variable first question var firstanwser = prompt("who posted first youtube video?"); //the if statement first question if (firstanwser.touppercase() === 'jawed karim') { //if person correct dialog box says correct pops alert("correct"); //the variable second question var secondanwser = prompt("when domain name youtube.com activated?"); if (secondanwser.touppercase() === 'febuary 14, 2005') { alert("correct"); var thirdanwser = prompt("what first video on youtube called?"); if (thirdanwser.touppercase() === 'me @ zoo') { ...

apk - Not finding xml file after decompiling using apkstudio -

i wanted change package name of apk file built app inventor. used apkstudio decompile file. apkstudio creates new folder, , inside of smali , source folders , jar file. xml , other folders supposed there not. i tried downloading other versions of apkstudio problem still there. might problem? try using apktool first decompile apk , resources. generate folder placed apk file @ androidmanifest.xml inside ready edited. changing app's package name not easy modifying package string in androidmanfiest. change app's package name you're going have change package name in androidmanifest , in decompiled code. if you're using windows , have cygwin installed boot terminal , type find path/to/decompiled/apk/folder -type f -exec sed -e "s/current\\/package\\/name/new\\/package\\/name/g" {} + and find path/to/decompiled/apk/folder -type f -exec sed -e "s/current.package.name/new.package.name/g" {} +

java - How to keep the look of disabled JTabbedPane's tabs to look exactly like when they are active? -

Image
i using jtabbedpane , set of tabs disabled. @ same time need keep tabs when active. don't need them grayed in colors. move between tabs using next , previous buttons. purpose of tabs visual indicator. i tried this code answer. works, how modify correctly disabled tabs when active tabs. i mean default look of swing active tab components: by active tab mean enabled no matter whether selected or not. i set of tabs disabled. @ same time need keep tabs when active. don't need them grayed in colors. maybe can use jlayer or jtabbedpane#settabcomponentat(component) . (4) no other alternative known me use visual indicator. how using jslider . import java.awt.*; import java.awt.event.*; import java.util.*; import javax.swing.*; import javax.swing.event.*; import javax.swing.plaf.*; public class tabbedpanetest { private int prev = 0; public jcomponent makeui() { jpanel p = new jpanel(new gridlayout(0, 1, 0, 5)); p.setborder(borderf...

python - How to write list to csv, with each item on a new row -

i having trouble writing list of items csv file, each item being on new row. here have, want, except putting each letter on new row... import csv data = ['first item', 'second item', 'third item'] open('output.csv', 'w', newline='') csvfile: writer = csv.writer(csvfile) in data: writer.writerows(i) use nested list: writer.writerows([[i]]) . explanation writing data python list csv row-wise : .writerow takes iterable , uses each element of iterable each column. if use list 1 element placed in single column. so, need single column, ...

python - Putting 2 dimensional numpy arrays into a 3 dimensional array -

i want keep adding numpy arrays array in python. let's have following arrays: arraytotal = np.array([]) array1 = np.array([1,1,1,1,1]) array2 = np.array([2,2,2,2,2]) and want append array1 , array2 arraytotal. however, when use: arraytotal.append[array1] it tells me: 'numpy.ndarray' object has no attribute 'append' how can append array1 , array2 arraytotal? you should append arrays onto regular python list , convert list numpy array @ end: import numpy np total = [] in range(5,15): thisarray = np.arange(i) total.append(thisarray) total = np.asarray(total) that loop makes 2d array; you'd nest loops produce higher dimensional arrays.

c# - LINQ group by query help: Select another related table with key -

please me complete following query: var results = species in db.species join cats in db.categories on species.categoryid equals cats.categoryid join groups in db.groups on cats.groupid equals groups.groupid group groups groups g select new groupwithcategorychildren { group = g.key, categories = (cats above query same g.key group)??? }; i sql, i'm struggling linq. want end list of each group along cats joined in above/main single query, ideally without re-querying data again in separate query. thanks lot i'm not sure understood correctly think need: instead of group groups groups group cats groups , key groups , values of group matching categories. var results = species in db.species join cats in db.categories on species.categoryid equals cats.categoryid join groups in db.groups on cats.groupid equals group...

Vectorial formula for cell validation in Excel using VBA -

i writing vba formula check characters in cell "testchars" allowed, allowed means each character appears in list defined cell "allowedchars". make things harder, formula work on ranges of cells rather on single cell. the current code seems work: option explicit public function allcharsvalid(inputcells range, allowedchars string) boolean ' check characters in inputcells among ' characters in allowedchars dim char string dim index integer dim rangetestchars range dim testchars string each rangetestchars in inputcells testchars = rangetestchars.value index = 1 len(testchars) char = mid(testchars, index, 1) if instr(allowedchars, char) = 0 allcharsvalid = false exit function end if next index next rangetestchars allcharsvalid = true end function i have following questions: the formula takes range , returns single boolean. prefer...

pyspark - Best way to do aggregations in Spark -

i'm running out of memory when try aggregation. works fine, slow on small subset of data. i'm running in pyspark. there alternative way take average of column based on specific group run better? df = df.groupby("id", "timestamp").avg("accel_lat", "accel_long", "accel_vert") the other thing can think of data structure of id , timestamp. make sure 2 not strings. try reduce size of type or change schema of df.

r - A loop for log transformation -

my task write function, aims calculate logarithms of given variables ( vars ) in given data set ( dset ) levels of declared variable ( byvar ). if minimum of given variable given level of byvar greater 0, simple natural logarithm calculated. otherwise, new value of given variable given segment calculated as: new.value = log(old.value + 1 + abs(min.value.of.given.var.for.given.level) in order achieve this, wrote such code (for reproducible example): set.seed(1234567) data(iris) iris$random <- rnorm(nrow(iris), 0, 1) log.vars <- function(dset, vars, byvar, verbose = f){ # loop levels of "byvar" for(i in 1:length(unique(dset[[byvar]]))){ if(verbose == t){ print(paste0("------ level=", unique(dset[[byvar]])[i], "----")) } # loop variables in "vars" for(j in 1:length(vars)){ min.var <- min(dset[[vars[j]]][dset[[byvar]] == unique(dset[[byvar]])[i]]) # if minimum of given variable giv...

ios - How to add a tableView into a CellView in objective c? -

i want show tableview cell like: _____________________________________ | (image) ______________ | --cell 0 | | mycustomtext|--cell 0.0 | | |_____________| | | |mycustomtext2|--cell 0.1 | | |_____________| | | | | | -------------------------------------- _____________________________________ | (image) 2 | --cell 1 -------------------------------------- i'm trying add tableview in storyboard , connect new tableviewcontroller , new customcelltableview, not show in row's table. it's possible? how can declare viewcontroller or needn't add viewcontroller? thanks! i think don't need new tableview controller. in table cell, can add tableview. @interface imagecell : uitableviewcell<uitableviewdatasource,uitableviewdelegate> @property (retain, nonatomic) ibou...

winapi - In Windows API application-defined callback functions, what is the lifetime of pointer parameter data? Does it persist after the callback returns? -

as example, let's @ enumwindowstations() , requires caller pass enumwindowstationsproc() callback function. callback function invoked once every window station in current terminal session. let's @ signature of callback function: bool callback enumwindowstationproc( _in_ lptstr lpszwindowstation, _in_ lparam lparam ); the first parameter pointer string data. string buffer allocated explicitly callback invocation, , freed after callback returns, or perhaps before enumeration function returns? or, pointer point kind of persistent memory, such string buffer remain allocated , usable afterward? this important point, because if not persistent, incorrect to, example, store raw pointer in global container accessed after callback , full enumeration process have finished. instead, necessary copy underlying string data buffer controlled application, before callback returns. the official documentation not seem make clear lifetime of string data is. there's 1 line ...

java - Kurento not working on another machine -

i'm new kurento. want test hello world example. followed instructions official website, , working correctly locally. tried other kurento projects no problem. however, when try browse page different machine (vm or laptop) on same lan, remote stream not showing. this written on documentation website: these instructions work if kurento media server , running in same machine tutorial. however, possible connect remote kms in other machine, adding flag kms.url jvm executing demo. we’ll using maven, should execute following command mvn compile exec:java -dkms.url=ws://kms_host:kms_port/kurento i tried using command this: mvn compile exec:java -dkms.url=ws://127.0.0.1:8888/kurento still no chance. as log, browser displays following , hangs: page loaded ... starting video call ... creating webrtcpeer , generating local sdp offer ... spec: {"audio":true,"video":{"width":640,"framerate":15}} ff37: {"audio":true,"video...

javascript - How to call one Promise function from another Promise function in Angular 2? -

i have 1 function returns promise needs call function returns promise: getuser(): promise<user> { this.getapiuser().then(result => { ..do stuff result.. return promise.resolve(result); // doesn't work }); } getapiuser(): promise<user> { return promise.resolve({ firstname: 'jason' }); } i think doesn't work since getuser "return promise.resolve" in context of getapiuser handler. easy in angular 1, instantiate $q object , resolve object wherever needed it. can't figure out equivalent in angular 2/typescript/em6. any appreciated. your getuser method doesn't return promise @ all. when invoke then method on promise returns promise , method needs return: getuser(): promise<user> { return this.getapiuser().then(result => { ..do stuff result.. return result; }); }

swift - iOS: Remove gap between left uibarbuttonitems -

Image
i had setup 2 uibarbuttonitem on left. below screen shot of wireframes of screen, captured debugging view hierarchy. red box default button , green box menu button. from screenshot, there gap between button image , menu button. button's view occupying space. i'm trying figure out way these 2 button close each other. i removed "back" text button: let backitem = uibarbuttonitem() backitem.title = "" self.backbarbuttonitem = backitem and added menu button: let btn = uibarbuttonitem() btn.customview = menu // it's uibutton self.leftitemssupplementbackbutton = true self.leftbarbuttonitem = menu if buttons view, reduce size of views frame , go. if attribute of main bar button item give you, make custom 1 looks same , give appropriate size. if using flexible space bar button item, use fixed space bar button item , set appropriately. you can modify value of bar button view's location through insetinplace() use on frame, take e...

PHP - Convert multidimensional array to 2D array with dot notation keys -

there plenty of tips , code examples out there of accessing php arrays dot notation, opposite. take multidimensional array this: $myarray = array( 'key1' => 'value1', 'key2' => array( 'subkey' => 'subkeyval' ), 'key3' => 'value3', 'key4' => array( 'subkey4' => array( 'subsubkey4' => 'subsubkeyval4', 'subsubkey5' => 'subsubkeyval5', ), 'subkey5' => 'subkeyval5' ) ); and turn (likely through recursive function): $newarray = array( 'key1' => 'value1', 'key2.subkey' => 'subkeyval', 'key3' => 'value3', 'key4.subkey4.subsubkey4' => 'subsubkeyval4', 'key4.subkey5.subsubkey5' => 'subsubkeyval5', ...

sharpdx - How to use xbox one controller in C# application -

Image
there exists large amount of information using xbox 360 controller in c#, didn't find info xbox 1 controller. i need basic operation out of it, joystick , trigger values. the majority of information online c++ applications, rather attempting write custom library, i'd use sharpdx . how use in application? note: i'm posting share info found, documenting findings myself. i'd love hear other methods of getting controller input .net application though. the easiest way found started use sharpdx. sharpdx website : sharpdx open-source managed .net wrapper of directx api. sharpdx available on nuget , it's simple started inside visual studios. to started, go tools -> nuget package manager -> package manager console inside visual studios (i'm using 2015 community edition). then type: install-package sharpdx package manager console appears @ bottom of visual studios. visual studios download , add solution. onto code. since wan...

exception - Heap Gives Page Fault -

i getting page fault means accessing invalid address. higher half kernel design chose follow. not see leads page fault. here kernel.c++ #include "types.h" #include "gdt.h" #include "stdio.h" #include "serial.h" #include "mem.h" #include "idt.h" #include "timer.h" #include "isr.h" #include "kbd.h" #include "mouse.h" #include "irq.h" #include "string.h" #include "terminal.h" #include "multiboot.h" #include "pmm.h" #include "heap.h" //call class constructor //for global objects before //calling kernel typedef void (*constructor)(); extern "c" constructor start_ctors; extern "c" constructor end_ctors; extern "c" void callconstructors() { for(constructor* = &start_ctors; != &end_ctors; i++) (*i)(); } extern "c" void kernelmain(uint32_t kernel_virtual_end, ...

ios - Continous "Allow "App" to access your location while you use the app" alerts -

i have developed app trying current device location in delegate method "applicationdidbecomeactive" , working fine, issue came when tested same code on xcode 8 beta 6 , ios beta 10.7. screen bombarded continous alerts saying "allow "app" access location while use app". not able click on "allow"/"don't allow". code is: -(void) startlocationservice { clauthorizationstatus status = [cllocationmanager authorizationstatus]; if (![cllocationmanager locationservicesenabled] || status == kclauthorizationstatusdenied || status == kclauthorizationstatusrestricted) { dlog(@"locations disabled or status not permiting use of locations systems."); self.currentlocation = nil; [self sendnotificationforerrormessage:error_msg_location_service]; } else { [self createlocationmanager]; if ([locationmanager respondstoselector:@selector(requestwheninuseauthorization)]) { if (status == kclauthorizationstatusnot...

php - Run selenium in vagrant with browser outside virtualmachine -

i'm trying run selenium in virtual machine, when try speaks no there installed firefox, want point browser off virtual machine. how this. i use selenium server , phpunit selenium you need specify selenium host when creating webdriver , goes this: remotewebdriver::create("http://{$host}:{$port}/wd/hub", $capabilities); the port 4444 default. now, reaching anywhere inside box different matter, non-related php, phpunit or selenium.

how to zoom out on an chrome extension's popup -

Image
some extensions' popup windows don't fit nicely page. if can zoom out on popup window, can use normal, there's no apparent way this. example screenshot: you can see popup window extends below visible portion of screen. there's button on bottom says "record tab" can't manage click. my chrome build: version 52.0.2743.116 (64-bit) platform 8350.68.0 (official build) stable-channel orco firmware google_orco.5216.362.7 all page zoom set 100% , font-size set medium in about://settings menu. adjusting page zoom 75% in about://settings fixed 30 seconds popup reverted original zoom level. the accepted answer mentions going extension's options page reset zoom, many extensions don't have/need options page. if case: open popup right-click , "inspect" a "developer tools" window should open, , in title bar should name , path of popup html file, this: chrome-extension://[the extension id, long string of rando...

css - Set height of one col to the height of the other -

i have 2 divs: <div class="wrapper"> <section id="left-panel"></section> <section id="right-panel"></section> </div> i have height of right-panel equal height of left-panel . how accomplish using css only? this not same saying want them same height. want height same, maximum of left-panel height. if right panel taller, should clipped @ bottom , become overflow , still respect height of left panel. also, content of left panel not dynamic, not same across pages, cannot set max-height on left panel. i think need declare height of wrapper in pixels. declare section height 100% fill wrapper space. give section overflow-y scroll. tried in inspector (width , float place sections 1 next other): .wrapper { height: 50px; } .wrapper section { width: 10%; height: 100%; float: left; overflow-y: scroll; }

jquery - localStorage or something else? -

i trying figure out best way store dynamically loaded html within div user's next visit. i've read bit localstorage , possibly stringify info, however, not clear on implementation. however, above said, here doing , accomplish. i using code like: $(function() { $('.cordpass').click(function() { var collection = $(this).find('span').load(this.href + ' #cords'); $('#summary').append( $(collection) ); return false; }); }); this grabbing info page , adding div id of #summary . can done multiple objects on page (they on map). anyway, user can sort , kinds of stuff. works great needs. however, i'd save html within #summary next time user visits, html there. what best way that? localstorage fit me, or misunderstanding use, , there way can store html next visit? i think if data different each user store data in mysql database. if data coming page, need store link other page in database, , n...

r - Dynamic column alignment in DT datatable -

i have larger datatable output varying number of columns, chose in widget. dynamically right align columns,but found solution if number of columns fixed. hoping adjust reference in target= command make dynamic. somehow not work , not output when number of columns smaller default reference. read somewhere reactive statements not work datatable options. attached mwe. rm(list=ls()) library(shiny) library(datasets) library(datatable) dt<-data.table(matrix(abs(rnorm(100,sd=100000)),nrow=10)) server<-shinyserver(function(input, output) { # return requested dataset columns <- reactive({ switch(input$columns, all= c("v1","v2","v3","v4","v5","v6","v7","v8","v9","v10"), left= c("v1","v2","v3","v4","v5"), right= c("v6","v7","v8","v9","v10")) ...