Posts

Showing posts from June, 2011

linux - How to display empty disk space -

if du -hs displays disk usage, how can know empty space well? thank much you want know how disk free? df -h disk space divided partitions, du isn't going show how space available.

Is Azure OAuth 2 auth code grant an authentication protocol -

sorry still confused, read everywhere telling me oath authorisation protocol appears using azure ad oauth code grant, promote login screen authenticate against directory, not authentication process? relationship between open id connect? thanks!! the oauth2.0 protocol has several flows identity provider (in case azure ad) may implement support auth. the auth code flow in fact 1 of these used apps access tokens api. flow quite simple, app redirects user identity providers /authorize endpoint. @ point user enters credentials, , site redirects application authorization code , can issue id token represents user (this openid connect part). app takes code, , posts /token endpoint , issued access token , refresh token . access token , app can access whatever api you've requested access for. for azure ad specifically, microsoft has built libraries handle these flows , token caching of complexity abstracted away. there's simple code samples can checkout may fi...

android - Cannot resolve symbol GsonConverterFactory -

i error message if try use gsonconvertfactory: cannot resolve symbol gsonconverterfactory i using this: return new retrofit.builder() .baseurl(base_url) .client(client) //.addconverterfactory(moshiconverterfactory.create()) .addconverterfactory(gsonconverterfactory.create(gson)) .build(); this gradle file (module: app): dependencies { ... releasecompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.1' compile 'com.google.code.gson:gson:2.7' } gsonconverterfactory resides in following dependency so, add in build.gradle dependency. compile 'com.squareup.retrofit2:converter-gson:2.3.0'

hadoop - How to fix size limit error when performing actions on hive table in pyspark -

i have hive table 4 billion rows need load pyspark. when try actions such counting against table, following exception (followed taskkilled exceptions): py4jjavaerror: error occurred while calling o89.count. : org.apache.spark.sparkexception: job aborted due stage failure: task 6732 in stage 13.0 failed 4 times, recent failure: lost task 6732.3 in stage 13.0 (tid 30759, some_server.xx.net, executor 38): org.apache.hive.com.google.protobuf.invalidprotocolbufferexception: protocol mess age large. may malicious. use codedinputstream.setsizelimit() increase size limi t. my version of hbase 1.1.2.2.6.1.0-129 , unable upgrade @ time. is there way can around issue without upgrading, maybe modifying environment variable or config somewhere, or passing argument pyspark via command line? i no. based on following jiras increasing protobuf size seems require code change since these jiras resolved code patches using codedinputstream suggested exception. hdfs-6102 lower d...

haskell - Can some explain how the following code works? -

i doing coding challenge in codewar: write function avg calculates average of numbers in given list. solution works don't quite understand 1 of solutions of others. can explain? avg :: [float] -> float avg = (/) <$> sum <*> fromintegral . length shouldn't be: avg l = pure (/) <*> sum l <*> fromintegral . length $ l this code uses applicative instance of (->) a type, defined here as: instance applicative ((->) a) pure = const (<*>) f g x = f x (g x) you can interpret implementation thinking of naryfunction <$> f1 <*> f2 <*> ... <*> fn "apply same parameter n functions , apply resulting arguments naryfunction ". in case, (/) <$> sum <*> fromintegral . length can thought \ xs -> (/) (sum xs) ((fromintegral . length) xs) sum xs / fromintegral (length xs) . you can prove expanding expression definition of (<*>) : avg = (/) <$> sum <*...

stm32 cube /iar and android studio ,send and receive data on usb otg -

i have stm32407zg have usb-otg port. have mobile have not otg,it have 1 usb port want connect mobile stm stm32407zg output otg port mobile usb wire (from st otg port mobile usb port) need send , receive data stm mobile , reverse. i use stmcube , iar software 1-i dont know send/receive code stm in air , how work stmcube , air usb otg 2-i dont know how can send/receive from/to usb port in android can communicate stm. if can please send stmcube , air project can correctly send , receive usb-otg in stm32f407zg , if can send simple android project in android studio witch can worked correctly usb send , receive can communicate stm thanks

Print Drupal menu fail with clean url -

i have drupal 7 menu print in muy page.tpl, becouse graphic design restriction no found other way do. each item menu have diferent design. problem when active clean url menu persist not clean url. my code: <div clas="menu"> <?php $menu = menu_load_links("main-menu"); for($i=0; $i<count($menu); $i++) { ?> <a href="<?php print $menu[$i]['link_path']; ?>" /><?php print $menu[$i]["link_title"]; ?></a> <?php } ?> </div>

node.js - Running node in command line w/o sudo -

i installed nodejs on ubuntu server , i'm wondering why can't use typing "node". "nodejs" works fine, "node" should work, too, right? "sudo node" works well, thought might problem path, path variables identical: root@myserver:/# node -v -bash: /usr/sbin/node: no such file or directory root@myserver:/# sudo node -v v8.2.1 root@myserver:/# echo $path /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games root@myserver:/# sudo echo $path /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games what doing wrong here? thx. i have had issue in past. started installing node on ubuntu have never had issues using node command, has worked: rm -rf /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/{npm*,node*,man1/node*} curl -sl https://deb.nodesource.com/setup_8.x | sudo -e bash - sudo apt-get install -y nodejs let me know if works. can read more here: https:...

MySQL query not deleting rows using datetime -

hi trying delete rows in mysql dates equal start , end date. problem when run query: delete taddmapp.sensorsummaryall startdate = '2017-07-14t03:01:42-04:00' , enddate = '2017-07-14t19:10:36-04:00'; i error saying "error code: 1292. incorrect datetime value: '2017-07-14t03:01:42-04:00' column 'startdate' @ row 1". the thing when run select query: select * taddmapp.sensorsummaryall startdate = '2017-07-14t03:01:42-04:00' , enddate = '2017-07-14t19:10:36-04:00'; with same dates start , end returns me rows have start , end date equal. can explain why select works delete gives me error? thank in advance time , effort.

javascript - Slot game, how to print "win" or "lose" in Paragraph tag -

i'm quite new jquery, how make prints "you have won" or " have lost". want make if hit 3 same fruits prints have won. function ezslots(id,useroptions){ var = this; //keep reference function use in callbacks //set variables options, or defaults. var options = useroptions ? useroptions : {}; this.reelcount = options.reelcount ? options.reelcount : 3; //how many reels, assume 3 this.symbols = options.symbols ? options.symbols : ['a','b','c']; this.samesymbolseachslot = true; this.startingset = options.startingset; this.winningset = options.winningset; this.width = options.width ? options.width : 100; this.height = options.width ? options.height : 100; this.howmanysymbolstoappend = 20; //how many symbols each spin adds this.endinglocation = 7; //location selected symbol... needs few smaller howmanysymbolstoappend this.time = 500; //time in millis spin take this.jqo = $("#"+id); //jquery object...

python - TypeError: 'DatetimeIndex' object is not callable -

i have following data: high date 2017-07-17 150.90 2017-07-18 150.13 2017-07-19 151.42 2017-07-20 151.74 2017-07-21 150.44 2017-07-24 152.44 i trying index putting in value inside highs.index(values) unable index. import datetime dt datetime import timedelta td import pandas pd import pandas_datareader.data web import numpy np start = dt.datetime(2017, 7, 15) df = web.datareader('aapl', 'google', start) highs = df['high'] print('index = ',highs.index(150.44)) when use print('index = ',highs.index(150.44)) type error: print('index = ',highs.index(150.44)) typeerror: 'datetimeindex' object not callable is anyway datetime index using particular value dataframe? it seems want index of column high 150.44. can this, boolean indexing : in [711]: highs[df['high'] == 150.44].index out[711]: datetimeindex(['2017-07-21'], dtype='datetime64[...

c# - MSBuild minify and embed JavaScript files -

i'm working on asp.net mvc application in visual studio 2015 , i'm trying find solution handle minifying , embedding our javascript files on release build. well, want find similar solution compiling less files , including them content in release build. main caveat here in debug build want javascript files , less files delivered make debugging easier. current "solution" currently project setup js files set "content" build action , minified counterparts set "embedded resource". keep these files in sync i'm using bundler & minifier extension. achieve debug builds using non-minified files have custom virtualpathprovider checks if file being requested js file , if exists local file, if returns local file otherwise attempts item embedded resource. currently there no solution handling less files. ideal solution ideally i'd include both js files , less files content , not have have minified/compiled counterparts part of project. ...

node.js - getting window instance with chrome-remote-interface -

i'm using chrome-remote-interface node package. need hold of window object in order bootstrap angular , wait angular event fired app code signal rendering complete. doing: const window = await runtime.evaluate({expression: 'window'}); doesn't work... there way i'm missing? thanks!

python - Join/Merge two Pandas dataframes and use columns as multiindex -

Image
i have 2 dataframes kpis date. want combine them , use multiindex each kpi can compared other 2 df. like this: i have tried extract each kpi series, rename series accordingly (df1, df2) , concatenating them using keys argument of pd.concat doesn't seems work. any appreciated. let's use pd.concat keys parameter, swaplevel , , sort_index : df1 = pd.dataframe({'a':['a0','a1','a2'],'b':['b0','b1','b2'],'c':['c0','c1','c2']},index=pd.date_range('2017-01-01',periods=3, freq='m')) df2 = pd.dataframe({'a':['a3','a4','a5'],'b':['b3','b4','b5'],'c':['c3','c4','c5']},index=pd.date_range('2017-01-01',periods=3, freq='m')) pd.concat([df1,df2],axis=1,keys=['df1','df2']).swaplevel(0,1,axis=1).sort_index(axis=1) output: ...

Django, Nginx, Gunicorn. Ubuntu 16.04 error -

i'n trying run server - https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-16-04#create-a-gunicorn-systemd-service-file when try run commands, error - sudo: unable resolve host giver.local what can problem? that error indicates wrong in /etc/hosts or etc/hostname see https://askubuntu.com/questions/59458/error-message-when-i-run-sudo-unable-to-resolve-host-none .

python - Pandas df.itertuples renaming dataframe columns when printing -

i know pandas' itertuples() return values of each including column names follows: ab=pd.dataframe(np.random.random([3,3]),columns=['hi','low','med']) in ab.itertuples(): print(i) and output follows: pandas(index=0, hi=0.05421443, low=0.2456833, med=0.491185) pandas(index=1, hi=0.28670429, low=0.5828551, med=0.279305) pandas(index=2, hi=0.53869406, low=0.3427290, med=0.750075) however, have no idea why doesn't shows columns expected set of code below: qqq equity spy equity date 2017-06-19 0.0 1.0 2017-06-20 0.0 -1.0 2017-06-21 0.0 0.0 2017-06-22 0.0 0.0 2017-06-23 1.0 0.0 2017-06-26 0.0 0.0 2017-06-27 -1.0 0.0 2017-06-28 1.0 0.0 2017-06-29 -1.0 0.0 2017-06-30 0.0 0.0 the abo...

android - Why are global proxy settings cleared after restarting the phone? -

i've built app once set device owner turns around , sets global proxy settings using setrecommendedglobalproxy() function this: string pacurl = "http://my-proxy-server.com:65011/proxy.pac?a=zgtyzwl89xyy1qazw15"; uri pacurl = uri.parse(proxypacurl); proxyinfo newproxy = proxyinfo.buildpacproxy(pacurl); try { log.i("admin", "setting global proxy " + newproxy.tostring()); mdpm.setrecommendedglobalproxy(admincomponent, newproxy); } catch (exception e) { log.w("admin", "caught exception while setting global proxy: " + e.tostring()); } it works great until restart phone , global proxy settings gone. if check global proxy settings via connectivitymanager.getdefaultproxy() , returns proxy pac url app set earlier so, no network traffic being proxified. interestingly enough, if go settings -> google -> security -> verify apps, disable "scan device security threats", reboot device, clear global pr...

postgresql - Techniques to Avoid Problems with Django Migrations? -

i'm building e-commerce website django 1.8 , postgresql 9.4. i'm interested in learning techniques can use when change database avoid having problems django migrations, particularly in event can't migrations run , have delete migrations, rebuild database, , restore backups. in development, i've found when change database schema , re-run migrations, run 50% of time. i'm doing things wrong. what's worse when migrations don't work, it's not easy understand why failed , how modify migration files run. in situations, have delete database , start over. acceptable in development it's not strategy when go production. what "best practices" or "do's , don'ts" follow when modify model classes/database schema increase probability django migrations run? , there steps take ensure can restore database in event migrations won't run , have rebuild database scratch? should add i'm one-person startup don't have co...

cpu - nagios-cloudwatch-plugin CPUUtilization icinga2 -

i use plugin (nagios-cloudwatch-plugin) https://github.com/fastsociety/nagios-cloudwatch-plugin/ checking aws metrics ec2 instances. the problem if run command (just manual): check_cloudwatch.py -r eu-west-1 -n aws/ec2 -m cpuutilization -p 600 -w 0:75 -c 0:90 -d instanceid=i-123 -s average --delta 222222 i following result: cloudwatchmetric ok - cloudwatch metric aws/ec2:cpuutilization dimensions {'instanceid': 'i-123'} | cloudwatchmetric=2.304percent;75;90 the problem 2.304percent not valid value. should 2.304% tried bit around , if add delta --delta 1 correct , uses % sign not percent. is there possibility make plugin working or icinga2 accepts percent value? thanks

java - SSL Exception <kik.botframework.com> -

i using bot connector rest api , having trouble kik channel. when try respond message, receiving error: javax.net.ssl.sslexception: hostname in certificate didn't match: <kik.botframework.com> != <*.azurewebsites.net> or <*.azurewebsites.net> or <*.scm.azurewebsites.net> or <*.azure-mobile.net> or <*.scm.azure-mobile.net> the service url using " https://kik.botframework.com ". i running off of local server @ moment. did not have trouble connecting skype channel in configuration, kik giving me trouble. i don't have solution, can explain reason behind , may have double check on side. so, in short, happening because of sni (server name indication) , because of client's inability support sni. check answer insight issue https://serverfault.com/questions/594368/openssl-returns-different-ssl-certificate-to-that-shown-by-chrome in case, same ip hosting bunch of domains , certificates. of modern browsers support ...

wpf - HwndHost doesn't display content when Desktop Composition is enabled -

i'm using hwndhost embed external application in wpf window. noticed on windows 7 machines, if aero theme selected , desktop composition enabled, external application starts, flickers on screen split second , disappears. if turn off desktop composition or use basic theme, application embedded inside wpf window. this code use in class derived hwndhost: [dllimport("user32.dll", setlasterror = true)] private static extern intptr setparent(intptr hwndchild, intptr hwndnewparent); [dllimport("user32.dll", setlasterror = true)] private static extern int setwindowlong(intptr hwnd, int nindex, int dwnewlong); private const int gwl_style = (-16); private const int ws_child = 0x40000000; private const int ws_ex_appwindow = 0x00040000; [dllimport("user32.dll", setlasterror = true)] private static extern bool showwindow(intptr hwnd, int ncmdshow); protected override handleref buildwindowcore(handleref hwndparent) { while (process.mainwindowhandle =...

Python masking of 1d array -

say have 2 numpy arrays a = [0, 2, 4, 6] and b = [0.03, 0.78, 0.25, 0.47, 0.98, 0.58, 0.63] i want return 3rd array checks indices of array in b , returns value of indices in b below: c = [0.3, 0.25, 0.98, 0.63] i have tried for in range(len(b)): if b[i] == a.any(): c=[i] but 0's. simply use c = b[a] this view b, if change c, change b. if don't want this, use .copy() c = b[a].copy()

c# - How to deserialize string to object (string in format in similar to object notation) -

Image
i have string looks this. it's not json , not xml. {foo={name=my foo value, active=true, date=20170630}, bar={name=my bar value}, key space={name=foo bar, active=false}} here assumptions: objects enclosed {} keys can have space in name keys separated space , comma ( , ) values assigned keys equal sign keys can have multiple values , values enclosed {} , values inside value separated space , comma ( , ). example, single key 3 values: {my foo key={one=true, two=true, third value=false}} my strategy deserialize dictionary<string, object @ first, worry recursion later. suggestions (existing library?) appreciated! here have var stringcontenttrimmed = stringcontent.substring(1, stringcontent.length - 2); var objects = stringcontenttrimmed.split(',') .select(x => x.trim()) .where(x => !string.isnullorwhitespace(x)); tldr . split function splitting values, isn't want. i created method getobjects below returns dictionary...

Versioning a PHP Lithium API -

goal i've been tasked versioning pretty large php lithium api. the end result i'm looking use namespacing separate versions. for example, lithium route looked this: router::connect('/{:controller}/{:action}/{:id:\d+}'); could have following url, map following php call: http://www.fungames.com/game/view/2 app\controllers\game::view($gameid) but create following mapping: router::connect('/{:version}/{:controller}/{:action}/{:id:\d+}'); such following 2 calls made: http://www.fungames.com/v1/game/view/2 app\controllers\v1\game::view($gameid) http://www.fungames.com/v2/game/view/2 app\controllers\v2\game::view($gameid) problem unfortunately, lithium documentation doesn't make mention of api versioning. there's brief mention here example of continuation routes. approach required making if statements in controllers version api, , consider poor approach. tldr what best way achieved namespaced api versioning when using php l...

How to get the thumbnail stream by microsoft.onedrive.sdk -

i'm trying item's medium thumbnail stream. can correct thumbnails content null. how content can return stream? var thumbnail= await onedriveclient.drive.items[item.id].thumbnails.request().getasync(); var thumbnailset=thumbnail.firstordefault();

Couchbase: What is the most efficient way to find the parent of a nested document? -

assume: { "id":"parent1", "name":"parent-name", "children":[ { "id":"child1", "name":"child1-name" }, { "id":"child2", "name":"child2-name" } ] } knowing child1 id, formulate query find out id of parent. i have seen satisfies condition looking more ways efficiently figure out parent since creating query satisfies clause iterate through children (linear).

apache - Reference: mod_rewrite, URL rewriting and "pretty links" explained -

"pretty links" requested topic, explained. mod_rewrite 1 way make "pretty links", it's complex , syntax terse, hard grok , documentation assumes level of proficiency in http. can explain in simple terms how "pretty links" work , how mod_rewrite can used create them? other common names, aliases, terms clean urls: restful urls, user-friendly urls, seo-friendly urls, slugging, mvc urls (probably misnomer) to understand mod_rewrite first need understand how web server works. web server responds http requests . http request @ basic level looks this: get /foo/bar.html http/1.1 this simple request of browser web server requesting url /foo/bar.html it. important stress not request file , requests arbitrary url. request may this: get /foo/bar?baz=42 http/1.1 this valid request url, , has more nothing files. the web server application listening on port, accepting http requests coming in on port , returning response. web server entirely...

sql server - Count Consecutive Days where value greater than 0 -

using sql server 2012, trying create query provides me with, say, top 10 longest wet (or dry) periods climate database. my temp table provides following data output: select monthid [id], date, rain_today #raindays order monthid asc, date asc output: id date rain_today ------------------------------- 1 24 dec 2014 2.4 1 25 dec 2014 0 1 26 dec 2014 8.7 1 27 dec 2014 1.8 1 28 dec 2014 0.3 1 29 dec 2014 0 1 30 dec 2014 0 1 31 dec 2014 0.3 2 01 jan 2015 0.3 2 02 jan 2015 0.3 2 03 jan 2015 18.3 2 04 jan 2015 0.3 etc. etc. i return ranked table count period rain_today > 0, (or rain_today = 0) i.e: rank start_date end_date wet period ---------------------------------------- 1 31 dec 2014 04 jan 2015 5 2 26 dec 2014 28 dec 2014 3 ... the closest have got reviewing other similar queries following (this dry days): select #raindays.monthid id, min(#raindays.date)...

swift - What does "fatal error: unexpectedly found nil while unwrapping an Optional value" mean? -

Image
my swift program crashing exc_bad_instruction , error. mean, , how fix it? fatal error: unexpectedly found nil while unwrapping optional value this post intended collect answers "unexpectedly found nil" issues, not scattered , hard find. feel free add own answer or edit existing wiki answer. this answer community wiki . if feel made better, feel free edit it ! background: what’s optional? in swift, optional generic type can contain value (of kind), or no value @ all. in many other programming languages, particular "sentinel" value used indicate lack of value . in objective-c, example, nil (the null pointer ) indicates lack of object. gets more tricky when working primitive types — should -1 used indicate absence of integer, or perhaps int_min , or other integer? if particular value chosen mean "no integer", means can no longer treated valid value. swift type-safe language, means language helps clear types of values cod...

vba - Requery a subform within a tab control -

i have several controls on form in addition tab control 3 separate pages. want subform(s) within each page requery when value selected on page above. so purposes of explaining this.. i have event on_click() on field called address_id . it's meant take tha value of id in addition 2 other ids, cust_id , location_id , , requery subform order_sub within orders page. i've named tab control pretty blandly, tabctl . so far i've tried every way imaginable reference subform, no avail. forms!record_details!orders!orders_sub.requery that doesn't work, assume should. gives? steve you not need reference tab control in code. reference , requery subform itself forms.record_details.form.orders_sub.requery

python - What is the purpose of `or None` in this code? -

i've been browsing code of pyparsing library. in there, found following fragment: result = instring[loc] == self.firstquotechar , self.re.match(instring,loc) or none if not result: raise parseexception(instring, loc, self.errmsg, self) loc = result.end() ret = result.group() to boil down more, understanding of result in there is: result = firstcharacteriscorrect(...) , self.re.match(...) or none here don't understand: why have or none in there? if first character not correct, without or none false . if correct, regexp fails none failed match anyway. in either case (with false or none) if not result right thing. so why add or none ? missing? why none preferable false ? the author wants result none or match object. without or none , if first test fails result false due short-circuiting rules.

In python for loops every caracter printing -

trharfler ="şçöğüıİ" buyukharfler="qazwsxedcrfvtgbyhnujmikÖolÇpŞĞİÜ" sayilar="0123456789" ozelkarakterler="<>'£#^+$%½&/{}()[]=*?\-_|" parola = input("parolanız: ") karakter in parola: if karakter in trharfler: print("parolanızda tükçe harf kullanmayınız") if karakter in ozelkarakterler: print("Özel karakter kullanmayınız") if not karakter==buyukharfler: print("büyük harf kullanın") if not karakter==sayilar: print("sayı kullanın") print("paralonız oluÅŸturuldu: ",parola) result: parolanız: mahir%ü büyük harf kullanın sayı kullanın büyük harf kullanın sayı kullanın büyük harf kullanın sayı kullanın büyük harf kullanın sayı kullanın büyük harf kullanın sayı kullanın Özel karakter kullanmayınız büyük harf kullanın sayı kullanın parolanızda tükçe harf kullanmayınız büyük harf kullanın sayı kullanın paralonız oluÅŸturuldu: ...

sql - Php count registered users -

this question has answer here: php: “notice: undefined variable”, “notice: undefined index”, , “notice: undefined offset” 23 answers reference - error mean in php? 29 answers i learning php , creating basic site "control panel". right i'm encountering error code while attempting amount of registered users. database: -- phpmyadmin sql dump -- version 4.2.12deb2+deb8u2 -- http://www.phpmyadmin.net -- -- host: localhost -- generation time: jul 25, 2017 @ 06:10 pm -- server version: 5.5.55-0+deb8u1 -- php version: 5.6.30-0+deb8u1 set sql_mode = "no_auto_value_on_zero"; set time_zone = "+00:00"; /*!40101 set @old_character_set_client=@@character_set_client */; /*!40101 set @old_character_set_results=@@character_set_results */; /*!40101 set @ol...

android - How to replace a fragment by itself on MarkerClick GoogleMap -

hello know how can replace fragment when click on same marker on googlemap. when click first time, fragment appears when click second time on it, app crash. this fragment : public class infowindowfragment extends fragment { public infowindowfragment() {} @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view v = inflater.inflate(r.layout.fragment_info_window, container, false); return v; } } this fragment declaration : fragment fragment = new infowindowfragment(); private final fragmentmanager fragmentmanager = getsupportfragmentmanager(); private final fragmenttransaction fragmenttransaction = fragmentmanager.begintransaction(); this onmarkerclick function : @override public boolean onmarkerclick(marker marker) { if (marker.equals(franprixmap)) { fragmenttransaction.replace(r.id.infowindow, fragment); fragmenttransaction.addto...

twig - gulp-data results in empty html -

the views:build task includes templates before data gets injected, resulting in blank html page. doing wrong? this code: gulp.task('views:build', ['views:templates'] , () => { return gulp.src(config.views.src + '*.twig') .pipe($.data(function() { return json.parse(fs.readfilesync('src/data/timber.json')) })) // load data base json file .pipe($.twig()) .pipe(gulp.dest(config.views.tmp)) .pipe(reload({stream: true})); }); gulp.task('views:templates', () => { return gulp.src(config.views.src + 'templates/*.twig') .pipe($.data(function(file) { return json.parse(fs.readfilesync('src/data/' + path.basename(file.path).replace('.twig', '') + '.json')); })) .pipe($.twig()) .pipe(gulp.dest(config.views.tmp)) });

bash - sed is adding character to start of word vs end -

so i'm trying add "!" end of every word in placescapex file placescap file this looks like: yugoslavian zambia zambian zomba this want like: yugoslavian! zambia! zambian! zomba! i've tried sed 's/$/\!/' wordlists/placescap > wordlists/placescapex , sed 's/$/!/' wordlists/placescap > wordlists/placescapex what happens when run , cat wordlists/placescapex outputs !ugoslavian !ambia !ambian !omba i've done research , stated being unix thing never went detail your simpler sed command should work fine text file end-of-line single newline character. have "dos" format files here (carriage return / linefeed). consider: $ cat zippy zippy $ od -c zippy 0000000 z p p y \r \n 0000007 $ sed 's/$/!/' zippy !ippy $ sed 's/$/!/' zippy | od -c 0000000 z p p y \r ! \n 0000010 you're seeing effect of \r displayed on terminal: move cursor start of line, print '!', ne...

I want to consume a GraphQL web API in .NET -

i want consume data graphql api. how can achieve that? new webapi , appreciated assuming api want consume uses http, should able use curl, wget, charles, postman or url bar in browser make request. to write first query, can start following: query thenameofmyquery { } now have named query, can start populating whatever fields graphql server exposing. blog example, might have this: query thenameofmyquery { posts { title author } } now, turn can request, need url encode , add url. typical url looks this: https://www.someserver.com/?query=...&variables=... so above example, have above query https://www.someserver.com/?query=query%20thenameofmyquery%20%7b%0d%0a%20%20posts%20%7b%0d%0a%20%20%20%20title%0d%0a%20%20%20%20author%0d%0a%20%20%7d%0d%0a%7d some resources: evolution of api design - video explains of concepts of graphql , why exists. howtographql.com - amazing set of tutorials every implementation imagine

scala - Case insensitive search in array type column spark dataframe -

i have spark data frame following: +----------+-------------------------------------------------+ |col1 |words | +----------+-------------------------------------------------+ |an |[an, attractive, ,, thin, low, profile] | |attractive|[an, attractive, ,, thin, low, profile] | |, |[an, attractive, ,, thin, low, profile] | |thin |[an, attractive, ,, thin, low, profile] | |rail |[an, attractive, ,, thin, low, profile] | |profile |[an, attractive, ,, thin, low, profile] | |lighter |[lighter, than, metal, ,, level, ,, and, tes] | |than |[lighter, than, metal, ,, level, ,, and, tww] | |steel |[lighter, than, metal, ,, level, ,, and, test] | |, |[lighter, than, metal, ,, level, ,, and, test] | |level |[lighter, than, metal, ,, level, ,, and, test] | |, |[lighter, than, meta...

opengl - GLFW - One context for all windows -

i want draw opengl graphics multiple windows. windows 'lead' same 'world' far know there 2 options: share context between windows. it's pretty straightforward task glfw , have progress that, however, code becomes more , more obscure , know opengl isn't multithreaded there no benefit rendering multiple contexts multiple threads. i saw advice have single context , use rendering of windows 1 one, i.e. render first window, swap buffers, render second one, swap buffers, render first 1 again , on. however, cannot determine possible go option 2 glfw. window , context tightly tied each other in library's concept. you can create multiple contexts , "share lists", see the documentation : when creating window , opengl or opengl es context glfwcreatewindow , can specify window context new 1 should share objects (textures, vertex , element buffers, etc.) with. glfwwindow* second_window = glfwcreatewindow(640, 480, "seco...

sql - pulling data from max field -

i have table structure columns similar following: id | line | value 1 | 1 | 10 1 | 2 | 5 2 | 1 | 6 3 | 1 | 7 3 | 2 | 4 ideally, i'd pull following: id | value 1 | 5 2 | 6 3 | 4 one solution following: select a.id, a.value mytable inner join (select id, max(line) line mytable group id) b on a.id = b.id , a.line = b.line given size of table , part of larger pull, i'd see if there's more elegant / simpler way of pulling directly. this task olap-functions: select * mytable qualify rank() -- assign rank each id on (partition id order line desc) = 1 might return multiple rows per id if share same max line. if want return 1 of them, add column order by make unique or switch row_number indeterminate row.

How to call AdWords API from Android -

i trying create app calling adwords api, need to: have ability enable/pause campaign via switch in app using adwords api update campaign targeting within proximity of device location @ 3 min intervals how can call adwords api android?

javascript - How do I get the UI Fabric Command Bar contextual Menu to work? -

i have been trying use office ui fabric's command bar control in office.js api microsoft word application. the buttons seen in main bar work intended when app displayed in maximum width of task pane. when re-size task pane smaller width , buttons move '...' (ellipsis) drop down stop working. i've tried explicitly adding copies of buttons in code ms-commandbar-overflowbutton container, take functionality of first item , duplicates every other item. i've used code ui fabric js documentation page , i'm not sure why buttons stop working when moved context menu. office ui fabric version: 1.2.0 office ui fabric core version: 4.1.0

python - CERTIFICATE_VERIFY_FAILED when using urllib to connect to almerys.com -

i trying connect server, token, when trying check connection, getting above error. 1 know why or how make connection kind of secure servers? here code: import requests import json import urllib.request import os req0 = "http://127.0.0.1:8000/" reqvar = "https://santeintegration.almerys.com/vfcapi/" #data = {"ip":"1.1.2.3"} headers = {"authorization":"bearer {eyjhbgcioijsuzi1niisinr5cci6ikpxvcj9.eyjpc3mioijtywmtbgxvewqilcjhdwqioijodhrwczovl3nhbnrlaw50zwdyyxrpb24uywxtzxj5cy5jb20vdmzjyxbplyisim5izii6mtuwmtawndyymcwizxhwijoxntaxmdi2mje3lcjzdwiioijnyxlhiiwiywrtaw4ionrydwv9.kg3duwuqgusywoc9bnezfoqvepzkwkpzhfrbs94skkv86tyys_qip5wzbg53cqmbhsheymzptvnhv6zcad9e9hxt0ibywfn7mdp9wmb60zpddd88tpwpvuxgkescrwhenld-udpwynpeca3wm1htr-cz_d3npm2bdhqjkguyra_zuc3f-xvlvkoc4scv0kd9-qwr-e9cgxctrkcczq4hr13rundc4z6__a13xmaujh4wweci57fsrhumtnjb83t2rdaiesfuwmjxnjrxyehbwgawp5yzwadcjmavqqlty34p5ejtcadb9idfdtaai2sqku_dcvzntm3wm9ows50bjw}"} request...