Posts

Showing posts from February, 2013

php - Yii2 controller render() function only render the layouts/main? -

in sitecontroller under namespace repo/controllers call return $this->render('index'); it render /views/layouts/main.php need render /views/site/index.php alone layouts files. if change return $this->renderpartical('index'); it renders /views/site/index.php without problem. what's problem render() function?? please, make sure didn't missed <?= $content ?> @ layouts/main.php. should render content

android - How to run a javascript inside of Bobik and return a JSON -

i'm tired of web-scrapping in android app. takes long, unstable: fast, slow, freezes , eats traffic. so best thing have found out bobik. takes care of , got json. have 1 problem: page contains javascript runs , afterwards have information need extract. in examples, have html page google.com , expedia.com json //title //h1 //img/@src but, example, page: http://www.washington.edu/calendar/ not contain parameters need. html not have time , event_name , location , how run javascript? or should want , bobik team take care of rest?

php - Send an image with CURL -

is possible send image curl outputs imagepng? ob_start(); imagepng(imagecreatetruecolor(800, 600)); $file = ob_get_clean(); $curl = curl_init(); curl_setopt($curl, curlopt_url, $remotehost); curl_setopt($curl, curlopt_post, true); curl_setopt($curl, curlopt_postfields, [ 'file1' => ? ]); curl_setopt($curl, curlopt_returntransfer, 1); $contents = curl_exec($curl); curl_close($curl); thank you! you need put @ character before file path, , path must full path. curl_setopt($curl, curlopt_postfields, array( 'file1' => '@' . '/var/tmp/img.png' )); if request accepts image inside post body raw data, case can place inside post mentioning whatever content-type requires. $image_data = file_get_contents('/var/tmp/img.png'); curl_setopt($curl, curlopt_postfields, $image_data); curl_setopt($curl, curlopt_httpheader, array('content-type: text/plain')); // example

java - 2D Movement Simulator (Similar to American Football Playbook) -

i new programming , wanted create program allows users create , model movements on 2d plain. relatively simple such x's , o's moving based on user's direction. want user able create , direct movement of each individual unit (the x's , o's). trying decide language allow me create not have steep learning curve, since learning scratch project. not sure if makes difference, want able share program on website. suggestions? since want use program on website, unity choice. quite simple , have lot of examples. when build program can build windows,mac,mobile or web. you can code in unity script (similar js) , c#. https://unity3d.com/

meaning of Scala operator "<=>" -

i new scala , have solve null error case. have been suggested use <=> solve it. google no materials or reference related it. can me understand meaning of <=> , how use it. documentation of helpful google not able find it. specifically, meaning of below statement. val filtereddf = df.filter(df("column") <=> (new column(literal(null))))

ios9 - Are xcode 2x assets possible to use as 3x? -

i'm building iphone app , made designs in dimensions iphone 5 (640x1136px), while i'm complete app ios 9 , iphone 6+ released , requires 3x assets. have re-do designs in iphone 6+ dimensions (1242x2208px) ? used photoshop instead of illustrator. if you're using photoshop edit image size (image > image size) , resave different name. when resizing image, enter new measurements in pixel dimensions area @ top of image size window.

javascript - off() not working in firefox but working in chrome -

i using beforeonload function want when user submits form beforeunload shouldn't work. here code, works fine in chrome not in firefox. window.form_submitted = ''; jquery(document).ready(function() { jquery(window).on('beforeunload', function() { if (form_submitted == '') { return "are sure leave page"; } }); }); jquery('#form').on('submit', function (e) { e.preventdefault(); jquery(window).off('beforeunload'); form_submitted = 1; site_redirect(resp.payment_url); } return false; }); you have several syntax issues, , have place submit block inside domready handler, otherwise js attempt bind event element doesn't yet exist in dom. note can remove the global flag variable unbinding beforeunload event on form submission. try this: jquery(document).ready(function($) { $(window).on('beforeunload', function() { return "are sure...

jquery - upgrade to Chrome 48 removes SVGGraphicsElement.getTransformToElement() -

after upgrading chrome version 48 - ever have used : svggraphicselement.gettransformtoelement() in js; i getting js error : typeerror: elem.gettransformtoelement not function(…) how can fix 1 ? fixed ! found answer @ https://github.com/webcomponents/webcomponentsjs/issues/192 running problem , current work around rd-secretstuff: // include after webcomponents.js // if shadow dom polyfill used... if (window.shadowdompolyfill) { var svgelement = document.createelementns("http://www.w3.org/2000/svg", "g"); svgelement.__proto__.gettransformtoelement = function gettransformtoelement(p_element) { return window.shadowdompolyfill.unwrap(this).gettransformtoelement(window.shadowdompolyfill.unwrap(p_element)); }; }

python - how to add hour to pandas dataframe column -

i have pandas dataframe time column following. segments_data['time'] out[1585]: 0 04:50:00 1 04:50:00 2 05:00:00 3 05:12:00 4 06:04:00 5 06:44:00 6 06:44:00 7 06:47:00 8 06:47:00 9 06:47:00 i want add 5 hours , 30 mins above time column. doing following in python. pd.datetimeindex(segments_data['time']) + pd.dateoffset(hours=5,minutes=30) but gives me error. typeerror: object of type 'datetime.time' has no len() please help. this gnarly way of doing it, principally problem here lack of vectorised support time objects, first need convert time datetime using combine , apply offset , time component back: in [28]: import datetime dt df['new_time'] = df['time'].apply(lambda x: (dt.datetime.combine(dt.datetime(1,1,1), x,) + dt.timedelta(hours=3,minutes=30)).time()) df out[28]: time new_time index 0 04:50:00 08:20:00...

c++ - HttpQueryServiceConfiguration always return me ERROR_INSUFFICIENT_BUFFER -

#include "stdafx.h" #include "http.h" #pragma comment (lib,"httpapi.lib") int _tmain(int argc, _tchar* argv[]) { httpapi_version httpapiversion = httpapi_version_1; ulong ret = no_error; hresult hr = s_ok; httpapi_version ver = httpapi_version_1; ret = httpinitialize(ver,http_initialize_server|http_initialize_config,null); if(ret!=no_error) { return 0; } http_service_config_id configid = httpserviceconfigiplistenlist; http_service_config_ip_listen_query* query=null; ulong size=1000; ulong re = httpqueryserviceconfiguration(null,configid,null,null,query,null,&size,null); printf("re = %d",re); getchar(); return 0; } this re result 122 (error_insufficient_buffer) . don't know reson. link of httpqueryserviceconfiguration function: https://msdn.microsoft.com/en-us/library/windows/desktop/aa364491 according reference link to, size pass pointer function pretur...

cocos2d iphone - Game center didChangeState and didReceiveData fromRemotePlayer remote player is not calling in ios 8 & ios 9 -

i making realtime multiplayer game in cocos 2d-x ios . according flow doing following things of link ios game center gamekit programmatic invite matchmaking : step 1: authenticate player step 2: right after authentication set invitehandler. step 3: list of friend playerids (not alias) step 4: fourth, setup gkmatchrequest this... inviting friends. step 5: fifth, use request call findmatchforrequest:withcompletionhandler . step 6: sixth, sends request other player , if accept "invitehandler" second step gets called. step 7: seventh, "invitehandler" second step gets match gkinvite! step 8: eighth, "inviteeresponsehandler" fourth step gets called finished match! till here code working fine after it. 3 steps after these steps not working can please me out ? step 9: ninth, create didchangestate gkmatchdelegate handle finalization of match. step 10: send message step 11: eleventh, create didreceivedata gkmatchdelegate ...

javascript - connecting socket to a specific path -

i have path localhost:3000/home want pass messages via socket.io. mu js file `var express = require('express'); var app = express(); var http = require('http').server(app); var path = require("path"); var io = require('socket.io')(http); app.get('*', function (req, res){ res.sendfile(path.join(__dirname, '/public')); }); app.use('/home',express.static(path.join(__dirname,'/public'))); //app.use('/static', express.static(__dirname + 'index.html')); io.on('connection', function (socket) { socket.on('message', function (data) { console.log(data) socket.emit('news', { hello: 'world' }); }); socket.on('another-message', function (data) { socket.emit('not-news', { hello: 'world' }); }); }); http.listen(3000, function(){ console.log('listening on *:3000'); });` my html file <html> <h1>working<...

java - Click is not working with appium test is passing but no action is performed -

Image
i want click on logout button. have tried following things perform click action using tap webelement logout = driver.findelementbyname("log out"); touchaction act = new touchaction(driver); act.tap(logout, 1, 1); simple click webelement logout = driver.findelementbyname("log out"); logout.click(); press touchaction act = new touchaction(driver); act.press(logout).perform() ; for press giving an unknown server-side error occurred while processing command. also tried mobileelement logout = (mobileelement) driver.findelementbyname("log out"); logout.tap(1, 10); which gives same unknown server-side error let me know if doing wrong anywhere. thanks in advance. here server log > info: [debug] [bootstrap] [debug] finding log out using name contextid: multiple: false > info: [debug] [bootstrap] [debug] using: uiselector[description=log out, instance=0] > info: [debug]...

mysql - SQL - How to add this custom order for my select query? -

i'm using mysql, , want add custom order select query. for example i'm having table name a, there column 'a' , 'b'. , can assure 'b' bigger 'a'. |a|b| |3|4| |1|9| |2|7| |6|9| |8|9| |2|6| |4|8| i want select them out , order value c = 5, order rule is: if c less both , b weight 1. if c between , b weight 2. if c bigger both , b weight 3. and order weight value. (the order of same weight not need considered here.) so result should be: |a|b| |6|9| -> weight 1 |8|9| -> weight 1 |1|9| -> weight 2 |2|6| -> weight 2 |2|7| -> weight 2 |4|8| -> weight 2 |8|9| -> weight 3 so how write select query? ps: doesn't have specify weight 1, 2 , 3 in query, weight 'invented' above myself address order rule! you can use case this: order case when @c < , @c < b 1 when < @c , @c < b 2 when @c > , @c > b 3 end

lisp - clojure - resolve a symbol inside let -

how write function resolve symbol in lexical environment? (let [foo some-var] (let [sym 'foo] (resolve-sym sym))) i want var 'foo bound to. i not sure why want this, looks can done. http://clojuredocs.org/circumspec/circumspec.should/local-bindings (defmacro local-bindings "produces map of names of local bindings values. now, strip out gensymed locals. todo: use 1.2 feature." [] (let [symbols (remove #(.contains (str %) "_") (map key @clojure.lang.compiler/local_env))] (zipmap (map (fn [sym] `(quote ~sym)) symbols) symbols))) (let [foo 1 bar 2] (local-bindings)) => {foo 1, bar 2}

apache - Mod_auth_kerb: Warning: received token seems to be NTLM, possible issues? -

i'm trying set mod_auth_kerb debian/apache , windows2008 active directory. works: kinit -k -t /etc/krb5.keytab http/myhost.domain.local see valid ticket in klist, service principal krbtgt/myhost.mydomain.local@mydomain.local this in apache error log: [sun mar 24 16:41:11 2013] [debug] src/mod_auth_kerb.c(1628): [client 10.50.109.64] kerb_authenticate_user entered user (null) , auth_type kerberos [sun mar 24 16:41:11 2013] [debug] mod_deflate.c(615): [client 10.50.109.64] zlib: compressed 528 355 : url /private/auth.php [sun mar 24 16:41:11 2013] [debug] src/mod_auth_kerb.c(1628): [client 10.50.109.64] kerb_authenticate_user entered user (null) , auth_type kerberos [sun mar 24 16:41:11 2013] [debug] src/mod_auth_kerb.c(1240): [client 10.50.109.64] acquiring creds http@myhost [sun mar 24 16:41:11 2013] [debug] src/mod_auth_kerb.c(1385): [client 10.50.109.64] verifying client data using krb5 gss-api [sun mar 24 16:41:11 2013] [debug] src/mod_auth_kerb.c(1401): [client 10.5...

regex - 301 redirect to full path -

i have lot incorrect links, links pointing to: http://www.domain.com/tags/keyword while correct path is http://www.domain.com/tags/keyword/ there hundreds of those...how 301 redirect wrong links correct links? thank in advance you can try code: rewritebase / rewriterule ^tags/([^/]+)$ /tags/$1/ [l,r=301] rewritebase / tells apache uri starts / . if site in subfolder should write rewritebase /subfolder/ instead. ^tags/([^/]+)$ : search uri starting tags/ followed [^/]+ means characters except / . ( ) around there capture , use in redirection. capture characters not / between tags/.../ in uri. ( ^ marks start of string while $ marks end) /tags/$1/ redirection. $1 means first previous captured element (the 1 witch between ( ) ). [l,r=301] indicates apache should stop process other rules , redirect 301 header code.

mysql - Database update query -

this query did earlier fetch sum select e.id staffid, sum(ic.amountreceived) totalamount,inv.invoicetype accounttype invoice_collection ic,employee e ,invoice inv ic.collectedby=e.id , ic.operatorcode=#operatorcode# , inv.invoiceno=ic.invoiceno , e.id=#staffid# , ic.journalfetchstatus=1 , txndate > #createdon# group inv.invoicetype; i trying solve update issue same conditions update invoice_collection set journalfetchstatus=0 ic.collectedby=e.id , ic.operatorcode=#operatorcode# , inv.invoiceno=ic.invoiceno , e.id=#staffid# , txndate > #createdon# group inv.invoicetype; try this: update invoice_collection ic inner join employee e on ic.collectedby=e.id inner join invoice inv on inv.invoiceno=ic.invoiceno set journalfetchstatus=0 ic.operatorcode=#operatorcode# , e.id=#staffid# , txndate > #createdon#;

c# - What is a NullReferenceException, and how do I fix it? -

i have code , when executes, throws nullreferenceexception , saying: object reference not set instance of object. what mean, , can fix error? what cause? bottom line you trying use null (or nothing in vb.net). means either set null , or never set @ all. like else, null gets passed around. if null in method "a", method "b" passed null to method "a". the rest of article goes more detail , shows mistakes many programmers make can lead nullreferenceexception . more specifically the runtime throwing nullreferenceexception always means same thing: trying use reference, , reference not initialized (or once initialized, no longer initialized). this means reference null , , cannot access members (such methods) through null reference. simplest case: string foo = null; foo.toupper(); this throw nullreferenceexception @ second line because can't call instance method toupper() on string reference pointing null ....

java - SLF4J: The requested version 1.6 by your slf4j binding is not compatible with [1.5.5, 1.5.6] -

i trying write excel file using jxls template file , corresponding jar has dependency slf4j 1.6 , resolve during compilation. jar has dependancy slf4j 1.5.6 resolved other program same project. note slf4j 1.5.6 setting classpath. when trying execute jxls program asking slf4j 1.6. in scenario getting above error. note following points - i using gradle build tool i not want hamper other processes running using

C# Windows Phone 8.1: ListView selected state not working as expected -

i have windows phone 8.1 (wp 8.1) listview . itemssource of listview observablecollection<item> , selectedvalue binds property selecteditem . see code snipped below. <listview selectedvalue="{binding selecteditem, mode=twoway}" itemssource="{binding items}"> <listview.itemcontainerstyle> <style targettype="listviewitem"> <setter property="horizontalcontentalignment" value="stretch" /> <setter property="foreground" value="#777" /> <setter property="template"> <setter.value> <controltemplate targettype="listviewitem"> <grid> <visualstatemanager.visualstategroups> ...

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -

Image
i have not tryed since can't understand space between tooltip , element made/added bootstrap, tooltip near element triggers tooltip event. i make tooltip opening little bit away element, add more margin tooltip , eleemnt mean. i understand how in css if possible , if possible make both right,left,top,bottom tooltips hope question clear. this how tooltips looks on app: and , how should looks after this default css tooltip on top : .tooltip.top { padding: 5px 0; margin-top: -3px; } you can override in own css : .tooltip.top { margin-top: -10px; } note code work work tooltip on top, you'll nedd adapt css 3 other orientations : .tooltip.top { margin-top: -10px; } .tooltip.right { margin-left: 10px; } .tooltip.bottom { margin-top: 10px; } .tooltip.left { margin-left: -10px; }

codenameone - Android build sizes changed? -

we have built app on thursday(21 jan 2016), 3mb in size. last night(27 jan 2016) have built same app without changes production environment 5.1mb in size. noticed new libs appeared in apk. has caused our app behave differently before (the 21 jan build). is there need do, not have these changes in our app? during dates on code freeze while did make couple of changes minor. if have both apk's there many reverse engineering tools apk's on market, can inspect both , clarify why size change happened. is possibly due reduced obfuscation or diamond suggested in comments inclusion of google play services?

php - How to count rows before while() -

i need count rows before while(). on page there 10 questions. 5 questions on left, 5 questions on right. it looks this: <div class="left"> <div>question 1</div> <div>question 2</div> <div>question 3</div> <div>question 4</div> <div>question 5</div> </div> <!-- /left close --> <div class="right"> <div>question 6</div> <div>question 7</div> <div>question 8</div> <div>question 9</div> <div>question 10</div> </div> <!-- /right close --> data getting mysql. use sample: <?php $dir = 'left'; $count = 0; foreach($data $row): $count++; if($count%5==1): ?> <div class="<?php echo $dir?>"> <?php $dir = 'right'; endif; ?> <div>question <?php echo $count?></div> <?php if($count%5==0 ||...

java - How to create a Regex to find exact String length? -

having these cases: 12345678901234 123456789012345 1234567890123456 12345678901234567 i need find string has exact 15 chars length. until made code: string pattern = "(([0-9]){15})"; mathcer m = new mathcer(pattern); if (m.find()){ system.out.println(m.group(1)); } the results this: 12345678901234 (not found good ) 123456789012345 (found good ) 1234567890123456 (found not good ) 12345678901234567 (found not good ) how can create regex can give me result of exact 15 thought regex can give me. more 15 not acceptable. simply use matches() instead of 'find()'

javascript - if get 0 then Synchronous XMLHttpRequest on the main thread is deprecated if higher then 0 is work -

i using ajax code append result database, case if use idc = 0 in url code give error in console: this url product?idc=0&_=1453888198332 synchronous xmlhttprequest on main thread deprecated because of detrimental effects end user's experience. but if higer 0 1,2,3,4,...etc code work data or no data. this ajax, code working because use in other project. in test not. var data={idc:idc}; $.ajax({ type:"get", datatype:"html", url:"", data:data, cache:false, success: function(data) { $('#subcategory').append(data); } how fix this? thank you

javascript - Bootstrap form with modal, validator and email -

i'm trying make html page bootstrap , bootstrap validator. what want : when user click on button, modal appear form. after validation, form sent email fields value. when mail correctly sent, other modal appear informations my problem : script bootstrap validator doesn't work. when field in error, form sent every time error appear. if complete fields, page reboot , nothing work. please, can me find mistake ? my html : <html lang="fr"> <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title></title> <!-- bootstrap --> <link href="css/bootstrap.css" rel="stylesheet"> <style type="text/css"> </style> <script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script> ...

python urllib2 - wait for page to finish loading/redirecting before scraping? -

i'm learning make web scrapers , want scrape tripadvisor personal project, grabbing html using urllib2. however, i'm running problem where, using code below, html not correct page seems take second redirect (you can verify visiting url) - instead code page briefly appears. is there behavior or parameter set make sure page has finished loading/redirecting before getting website content? import urllib2 bs4 import beautifulsoup bostonpage = urllib2.urlopen("http://www.tripadvisor.com/hacsearch?geo=34438#02,1342106684473,rad:s0,sponsors:abest_western,style:szff_6") soup = beautifulsoup(bostonpage) print soup.prettify() edit: answer thorough, however, in end solved problem this: https://stackoverflow.com/a/3210737/1157283 inreresting problem isn't redirect page modifies content using javascript, urllib2 doesn't have js engine gets data, if disabled javascript on browser note loads same content urllib2 returns import urllib2 beautifulsoup i...

asp.net - How to set border to div element for text formatting? -

i'm working comment section page allows user leave comment. need assistance in layout displaying comments repeater control. used put comments inside div element of item , alternatingitem template of repeater. , result, comment go straight along line in div element if user typing many words or paragraph. want put limit text stop , proceed next line of div element. how that?what best way?any suggestion? here's layout repeater control used insert comments. <asp:repeater id="repeater1" runat="server" datasourceid="sqldatasource1"> <headertemplate> </headertemplate> <itemtemplate> <tr> <td > <div style="background-color:#ffff66" > <%# eval("name") %> says... <%# eval("comments") %> </div> </td> </tr> </itemtemplate> <alternatingitemtemplate> <tr> <td > <div style="background-color:#ccff33" > <%# ...

r - Subsetting one matrix based in another matrix -

i select r based on g strings obtain separated outputs equal dimensions. inputs: r <- 'pr_id sample1 sample2 sample3 ax-1 100 120 130 ax-2 150 180 160 ax-3 160 120 196' r <- read.table(text=r, header=t) g <- 'pr_id sample1 sample2 sample3 ax-1 ab aa aa ax-2 bb ab na ax-3 bb ab aa' g <- read.table(text=g, header=t) this expected outputs: aa <- 'pr_id sample1 sample2 sample3 ax-1 na 120 130 ax-2 na na na ax-3 na na 196' aa <- read.table(text=aa, header=t) ab <- 'pr_id sample1 sample2 sample3 ax-1 100 na na ax-2 na 180 na ax-3 na 120 na' ab <- read.table(text=ab, header=t) bb <- 'pr_id sample1 sample2 sa...

watchkit - Customise title in the WK Status Bar -

Image
i'm trying customise title in wk status bar of first controller. the correct way should this: public func settitle(title: string?) // title of controller. displayed when controller active so wkinterfacecontroller.settitle("my title") but using code, xcode says cannot convert value of type 'string' expected argument type 'wkinterfacecontroller' . what's wrong? settitle instance method, not class method. you need refer specific instance controller change controller's title. since setting first controller's title within own code, can omit self, , call settitle("my title")

Where can i find particular version of selenium webdriver supported browsers? -

want know supported browser's version selenium webdriver 2.48.2.0 you can find supporting environment details in change log. java below link helps you https://github.com/seleniumhq/selenium/blob/master/java/changelog thank you, murali

r - plot/ggplot2 - Fill area with too many points -

Image
final implementation - not finished heading right way idea/problem: have plot many overlapping points , want replace them plain area, therefore increasing performance viewing plot. possible implementation: calculate distance matrix between points , connect points below specified distance. todo/not finished: works manually set distances depending on size of printed plot. stopped here because outcome didnt meet aesthetic sense. minimal example intermediate plots set.seed(074079089) n.points <- 3000 mat <- matrix(rnorm(n.points*2, 0,0.2), nrow=n.points, ncol=2) colnames(mat) <- c("x", "y") d.mat <- dist(mat) fit.mat <-hclust(d.mat, method = "single") lims <- c(-1,1) real.lims <- lims*1.1 ## ggplot invokes them approximately # attempt estimate point-sizes, works default pdfs pdf("test.pdf") cutsize <- sum(abs(real.lims))/100 groups <- cutree(fit.mat, h=cutsize) # cut tree @ height cutsize...

objective c - How to invalidate contents of UIView to force a redraw? -

i have uiview acts schedule (ipad app written using xcode 4.6, ios 6.2 , storyboards). have 2 (2) uiviews, 1 in top half of window, other in bottom half. there calendar in top half; , grid of times below that. when user taps on day has appointments, drawn on bottom uiview. user can tap day appointments, , old removed, new data drawn on bottom view. this works great, unless there no appointments day tapped, in case old data remains, rather being somehow deleted. have tried [self setneedsdisplay], since nothing has changed, nothing drawn. there way invalidate contents of uiview force redrawn no data? update : here code draws appointments: - (void)drawrect:(cgrect)rect { // load dictionary files plists nsstring *path = [[nsbundle mainbundle] bundlepath]; // nslog(@"\n\npath %@",path); // nsstring *timesfinalpath = [path stringbyappendingpathcomponent:@"startingtimes.plist"]; // starting times nsdictionary *startdict = [nsdictionary dictionarywit...

iphone - How to add google map to ios6 sdk -

when try add google map ios6 according link google map and api key , put in app crashed , reason "google map sdk ios must initialized via [gmsservices provideapikey:...]" can body me, give me video how thing ... #import "appdelegate.h" #import <googlemaps/googlemaps.h> #import "viewcontroller.h" @implementation appdelegate - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { self.window = [[uiwindow alloc] initwithframe:[[uiscreen mainscreen] bounds]]; // override point customization after application launch. self.viewcontroller = [[viewcontroller alloc] initwithnibname:@"viewcontroller" bundle:nil]; self.window.rootviewcontroller = self.viewcontroller; [self.window makekeyandvisible]; return yes; [gmsservices provideapikey:@"aizasyboogggqnvdydbkcxgeb1of6wu2ibe6rjk"]; } did step 8 here ? if did, can update question code application:didfinishlaun...

c# - getasync exception in silverlight -

hi guys trying send getasync request silverlight 5. post async working without problem getasync throw exception when adding authorization header. when not adding authorization header without exception 401. should fix it? the code: client.defaultrequestheaders.add("authorization", "bearer secrettoken"); var getasynctask = await client.getasync("http://api.enteroption.com/api/userdetails/getuseridbytoken/"); the exception: system.argumentexception occurred message="" stacktrace: @ microsoft.runtime.compilerservices.taskawaiter.throwfornonsuccess(task task) @ microsoft.runtime.compilerservices.taskawaiter.handlenonsuccess(task task) @ microsoft.runtime.compilerservices.taskawaiter.validateend(task task) @ microsoft.runtime.compilerservices.taskawaiter`1.getresult() @ consoleapplication3.class1.<func>d__1.movenext() innerexception: system.argumentexception message=value not fall w...

android - How to replace ASCII Text with Hex Value -

i have string msg = "hello.. welcome. id 'abcd' & pwd '123' !!"; i'm replacing white spaces msg = msg.replaceall("\\s+", "%20"); result is msg = "hello..%20welcome.%20your%20id%20is%20'abcd'%20&%20pwd%20is%20'123'!! how replace ascii text ( & , ' , " , ! ) etc hex value. which results in string like msg = "hello..%20welcome.%20your%20id%20is%20%27abcd%27%20%26%20pwd%20is%20%27123%27%21%21 try this, string query = urlencoder.encode(msg, "utf-8").replace("+", "%20"); edit this better way. string url = uri.parse(msg) .buildupon() .build() .tostring();

c++ - How should I access a function of a container class in a contained class object -

i have following class structure class containingclass { int func1(int a); containedclass containedclassobject; } i want access func1 in containedclass objects. best way achieve that? a naive solution comes mind pass function pointer containedclass 's constructor, circular definition, need pass pointer object of containingclass well. any suggestions? the containedclass required contract/api/function fulfilled int func1(int) member of containingclass . unless containedclass explicitly requires access instance of containingclass other purposes, access can provided via lambda (or std::bind ) , containedclass can have std::function correct signature member holds lambda. the "trick" here ensure lifetime of objects managed appropriately, i.e. lifetime of containingclass instance @ least long required use in containedclassobject object. a sample; #include <functional> class containedclass { std::function<int(int)> fu...

Understanding Chapter 2 Q 22 of A Little Java, A Few Patterns -

in chapter 2 of a little java, few patterns , question 22 is: are there onions on shish^d: new skewer()? answer is: true, because there neither lamb nor tomato on new skewer(). definitions of classes skewer subclass of shish^d, onion subclass of shish^d, don't understand why there onions on new skewer() , explain bit further? i've googled book , although pages missing, think question's about: shish s = new skewer(); system.out.println(s.onlyonions()); //prints true; it prints true because onlyonions() declared abstract in super class shish , overriden in skewer class follows: class skewer extends shish { @override boolean onlyonions(){ return true; } } so should clear s.onlyonions() returns true, since s' dynamic type skewer .

html - Where I can get libxml2.2.dylib? -

Image
i need parse html string on ios, came across raywenderlich tutorial using libxml2 , hpple. go website http://www.xmlsoft.org , can't find download link or maybe direct it. i'm quite experienced on obj-c, i', new c. how dylib? maybe compiling self? give me step how it? apple made easy. follow steps 1 8 in screenshots, and you're done! note, of frameworks can add following above steps.

Support of aggregate function in GraphQL -

i'm interested graphql analytic solution (think of webapp displaying graphs). cannot find examples of graphql using aggregate function. main aspect of of queries done frontend. for solution, have 3 typical backend calls. search aggregate time series let have type specified in graphql type person { name: string age: int create_time: date } search this seems handled graphql. no question here. ex. search age of person named bob { person(name: "bob") { age } } aggregate this typical case want display info in pie chart. let want count number of person age. here postgresql query: select age, count(*) ticket group age; what equivalent in graphql? time series typical case want display info in barchart x axis time. ex. let want count number of created user per hour. here postgresql query: select date_trunc('hour', create_time) create_time_bin, count(*) person group create_time_bin order create_time_bin asc; what...