Posts

http - Keeping website open with Python Requests? -

i trying figure out how can keep connection website open. tried using while loop, after url, can see not connected website anymore. how can navigate url, , keep url open entire time while running loop? want loop forever, maybe print data website. here code tried , help! import requests import time url = 'https://www.google.com' s = requests.session() headers = {'user-agent': 'mozilla/5.0 (windows nt 6.1) applewebkit/537.36 (khtml, gecko) chrome/41.0.2228.0 safari/537.36'} r = s.get(url, headers=headers) while true: print str(r) time.sleep(10) what purpose of question? trying achieve holding open connection? i doubt can keep open forever, doing should work, extent. using requests session should ensure http keepalive option set appropriately, , remote server should keep tcp connection open after servicing each http request. if stop sending requests, server timeout connection , close it. the important point must keep making reques...

android - Binary XML file line #1: Error inflating class fragment when running map -

i have problemes when executing simple map in android studio, here map activity : package com.dev.boblinux.cador.activities; import android.manifest; import android.content.pm.packagemanager; import android.os.bundle; import android.support.v4.app.activitycompat; import android.support.v4.app.fragmentactivity; import com.dev.boblinux.cador.r; import com.google.android.gms.maps.cameraupdatefactory; import com.google.android.gms.maps.googlemap; import com.google.android.gms.maps.onmapreadycallback; import com.google.android.gms.maps.supportmapfragment; import com.google.android.gms.maps.model.latlng; public class chomemapctrl extends fragmentactivity implements onmapreadycallback { private googlemap mmap; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_chome_map_ctrl); // obtain supportmapfragment , notified when map ready used. supportmapfragment mapfragment = (supportmapfrag...

initialization - python __main__ and __init__ proper usage -

since i'm rather new python particular aspect of language still opaque me. so, assume project contains many files code stuff , 2 "service" files: __init__.py , __main__.py in __init__.py there only: if __name__ == "__main__": import package.__main__ __main__.main() and in __main__.py follows: import package # ok import package2 # ok def main(): package.myfunc1() # can't find reference myfunc1 package2.myfunc2() # can't find reference myfunc2 so question is: why both packages visible while functions inside not? i've read source code google , still can't spot difference between , code. i'm using python 3.5.1 i assume, code in __init__ launch __main__ , __main__ launch rest of functions. upd well, apologies if confused code. idea stand behind __init__.py file created ide when first package added decided fill code found on first github entry(my fault, though can re-used copy-paste). strictly spea...

CNAME in Google Cloud DNS -

i have been trying add www.mydomain.net alias mydomain.net . have mx record , ns , soa records auto-added google. i getting cnameresourcerecordsetconflict error: error code "cnameresourcerecordsetconflict" : resource record set 'entity.change.additions[0]' invalid because dns name 'mydomain.net.' may have either 1 cname resource record set or resource record sets of other types, not both. i understand advice error gives me, how can have other records then? need mx , cname both on domain. the problem you're having issue rules of dns , forbid cname record record exists. if cname rr present @ node, no other data should present; ensures data canonical name , aliases cannot different. rule insures cached cname can used without checking authoritative server other rr types. you trying create cname @ record. @ record origin, example.com instance. there @ least 2 records @ origin, soa (start of authority - information ...

linux - Ubuntu VTK for Python compiled from source -

i compiled vtk 7.0 (6.3 has same effect) on cmake following params: -library_output_path:path="" -cmake_install_prefix:path="/usr/local" -vtk_enable_vtkpython:bool="1" -module_vtkpython:bool="1" - -vtk_group_qt:bool="1" -cmake_objcopy:filepath="/usr/bin/objcopy" -vtk_rendering_backend:string="opengl2" -vtk_install_python_module_dir:path="/usr/local/lib/python2.7/site-packages" -dvtk_egl_device_index:string="0" -vtk_wrap_python:bool="1" -module_vtkguisupportqtopengl:bool="1" now can find binary "vtkpython" @ /usr/local/bin . good news: i allowed enter python shell command "vtkpython" out of directory (/usr/local/bin) needed vtk bindings. markovich@markovich-desktop:~$ cd /usr/local/bin/ markovich@markovich-desktop:/usr/local/bin$ vtkpython vtk version 7.0.0 python 2.7.10 (default, oct 14 2015, 16:09:02) [gcc 5.2.1 20151010] on linux2 type ...

javascript - Google, Facebook oauth Login for SPA without Page Refresh -

i working on single page radio player web application. want integrate facebook or google oauth login in app. i want radio player continue playing while user login app using oauth login flow. how implement oauth login without page refresh. you can use javascript sdk this, fb.login function: https://developers.facebook.com/docs/reference/javascript/fb.login/ if docs not enough you, here´s tutorial: http://www.devils-heaven.com/facebook-javascript-sdk-login/

javascript - Adding Content to a div -

i using code content page on button click: function getfilter(str){ $.ajax({ type: "get", //path php page data url:"getreceipt.php?table="+str+"", success:function(html){ //here success action //get data on div $("#receipt").html(html); } }); } i use code add innerhtml content same div above content previous code created: function updatecarlist(transaction, results) { //initialise listitems variable var listitems = ""; //get car list holder ul var listholder = document.getelementbyid("receipt"); //clear cars list ul listholder.innerhtml = "receipt<br>"; var i; //iterate through results (i = 0; < results.rows.length; i++) { //get current row var row = results.rows.item(i); listholder.innerhtml += "chair "+row.chair+"-<input type='hidden' id='chair[]...