Posts

Showing posts from February, 2014

reactjs - react-router auto-login in the onEnter hook -

in react-router examples onenter hook, hook synchronous. in issues it's recommended keep way. what's idiomatic way log in while inside hook? user-story: client has localstore token client navigates directly example.com/mustbeloggedin before going page, i'd check if have token, if do, attempt gain authorization. if authorized, continue onto route should use hoc instead of onenter ? i have working, know it's not recommended, , seems brittle, example using immutable store causes same issues issue: https://github.com/rackt/react-router/issues/2365 there number of ways solve challenge, agree recommendation calls in onenter should synchronous. here 2 ways solve challenge. option 1: don't validate token on page load it arguably case browser should not validate existing token @ all. is, browser should assume token valid , try load route defined. on api call failure response server (where actual authentication , authorization occurring), app ...

flash - How does youtube player work -

what i'm interested in video quality. do convert each video file many separate video files, or convert file on fly when user watching video preserve space? how different video qualities made. also, video formats works flash? 1 commonly used? what sacrifice if use html5 instead of flash? saw youtube switching html5, player work in every browser, ie7? how hard make youtube flash or html5 player copy? thanks. every video uploaded converted couple different mime types. html5 allows add videos without needing own custom flash player. can make own player using normal elements found in every browser. although html5 not supported in browsers, it's becoming more popular , (hopefully) implemented in browsers soon. i'm not sure video formats work flash, can assume do. make replica of html5 youtube player in day. mime types - mime types different file types. different files. example, have mp3 file, convert wav file , ogg file , have 3 different mime types. read...

javascript - Many draggable images freely in the screen -

i'm trying build page me , team can position images freely on screen. problem can't figure out way make images draggable. tried figure out myself , came upon nice topic it: html5 drag , drop move div anywhere on screen? i've tried apply idea page , replace "getelementsbyid" "getelementsbyclassname" no dice. in addition, twice nice if draggable image respect responsiveness of page, if knows how that. here codepen attempt: http://codepen.io/guiharrison/pen/eshyr thanks! well, made up, it's kinda buggy, can play around it. <html> <head> <style> #mydiv{ width: 100px; height: 100px; border: solid black 1px; position: absolute; } </style> </head> <body> <div id="mydiv" onmousedown="ismousedown(1)" onmouseup="ismousedown(0)" onmousemove="mousemove(event)"></div> <script> ...

javascript - what is the expected performance of ZeroMQ? -

i dabbling process-to-process communication; aim have worker processes perform computations , pass result controlling process. installed zeromq.node , set simple requester , responder in coffeescript. the requester: # requester.coffee zmq = require 'zmq' context = new zmq.context() socket = zmq.socket 'req' socket.bind 'tcp://127.0.0.1:5555', ( error ) => throw error if error? console.log 'requesting writer bound port 5555' setinterval ( -> socket.send 'helo world' ), 1 response_count = 0 t0 = new date() / 1000 socket.on 'message', ( message ) -> response_count += 1 # x = message.tostring 'utf-8' if response_count % 1000 0 t1 = new date() / 1000 console.log "received #{ parseint response_count / ( t1 - t0 ) + 0.5 } messages per second" response_count = 0 t0 = new date() / 1000 the re...

css - jquery masonry collapsing on initial page load, works fine after clicking "home" menu button -

my jquery masonry setup working strangely on initial page load. seems placing images in first row fine, second row positioned overlapping first , same third row. after page load, can click home button or logo , reload page , works fine. i have code in functions.php put masonry , jquery scripts in: if (!is_admin()) { wp_enqueue_script('jquery'); wp_register_script('jquery_min', get_template_directory_uri(). '/js/jquery.min.js', array('jquery'), '1.6.1' ); wp_enqueue_script('jquery_min'); wp_enqueue_script('jquery'); wp_register_script('jquery_masonry', get_template_directory_uri(). '/js/jquery.masonry.min.js', array('jquery'), '2.1.06' ); wp_enqueue_script('jquery_masonry'); } this script in head.php: <?php if (is_page(2)) { ?> <script> $(function(){ $('#content').masonry({ // options... ...

Showing & Hiding Text with Javascript -

i have javascript code faq page site. so, click on question , answer appears. now, can't figure out when have clicked on 1 question , open, when click on want previous 1 close. basically, there ever 1 open @ time. found similar code, not i'm looking for. any great, here's code. thanks!!!! kait <script type="text/javascript"> function unhide(divid) { var item = document.getelementbyid(divid); if (item) { item.classname=(item.classname=='hidden')?'unhidden':'hidden'; } } </script> <p><a href="javascript:unhide('q1');">here question???</a></p> <div id="q1" class="hidden"> <p>the answer goes here.</p> </div> <p><a href="javascript:unhide('q2');">here 2nd question???</a></p> <div id="q2" class="hidden"> <p>the 2nd answer goes here.</p> </div> ...

html - CSS: if is used opacity on DIV, everything inside is lighter -

i have structure this: <div class="abc"> <ul> <li>something</li> ... </ul> </div> i need apply on abc div opacity option. if it, works, text inside <ul> has opacity abc div => text in <ul> lighter. is there way apply opacity on div (its background), not on content inside div? thank you without pulling ul out of div, way can think of make background color partially transparent using rgba if solid color: background-color:rgba(0,0,0,.5); this make background black 50% opacity, work in newer browsers. jsfiddle: http://jsfiddle.net/jdwire/xzege/ to support older browsers, instead base64 encode tiny png css (or reference external image). see http://en.wikipedia.org/wiki/data_uri_scheme more info , see https://stackoverflow.com/a/5258101/1721527 drawbacks of embedding base64 encoded image in css or html. if background image, make partially transparent png.

javascript - knockoutjs observable arrays -

to simplify issue having have come following example. var viewmodel = function() { this.self = this; self.test = ko.observablearray([]); self.test2 = ko.observablearray([]); self.test2.push('1'); self.test.push({ 'foo':self.test2() }); console.log('the following console.log should output object foo : [1]'); console.log(self.test()); self.test2.push('2'); self.test.push({ 'foo2':self.test2() }); console.log('this console.log should have 2 objects, first 1 foo : [1] , second foo2 : [1,2]') console.log(self.test()); }; ko.applybindings(new viewmodel()); initially both arrays empty test = [] test2 = [] then push '1' test2 test = [] test2 = ['1'] then push new object test equal current value of test2 test = [ { 'foo' : ['1'] } ] test2 = ['1'] and log current value of test check we push '2' onto test2 test = [ { 'foo' : ['1'] } ] test2 = ['1...

c# - How to disable Raygun.io client via app configuration? -

i have raygun.io client integrated latest release of our server application run enterprise customers. unfortunately, of them may not send data outside of network , want disable raygun.io client. my question if there in raygun.io library allows them disable editing <server>.exe.config file or need roll out own implementation? based on their .net client implementation , have couple of configuration options via <server>.exe.config , excluding errors http status code, <raygunsettings apikey="your_app_api_key" excludehttpstatuscodes="418" /> or removing sensitive data http request, <raygunsettings apikey="your_app_api_key" ignoreformfieldnames="password" /> but nothing enable/disable switch. you have add own app setting <add key="enableraygunlogging" value="true" /> , programmatically check value when using raygun.io client.

c++ - Design and implementation of a 2-3 tree with polymorphism -

i have implement 2-3 tree using base class of node , derived class of leaf , innernode (i.e both "are-a" node). but don't understand how start insertion in simple cases. since call methods of node insert, how supposed know if insert needs innernode or leaf ? , how node supposed change leaf or innernode ? any tips/ideas on how approach this? here's structure, didn't far though. typedef int treekey; class node { public: virtual ~node() {} virtual void insert(treekey k, string d); virtual void deletenode(treekey k); virtual void findnode(); virtual node * findnode(treekey key); protected: struct info { treekey key; string data; }; node* parent=nullptr; }; class leaf : node { info i; public: virtual void insert(treekey k, string d); }; class innernode : node { vector<info> inf; vector<node*> vect; public: virtual void insert(treekey k, string d); }; note: in 2...

c# - Monitoring completed status of a remote cmd.exe process -

i running .bat file in computer computer b using form application using wmi publish dash boards. .bat file calls command line utility tabcmd.exe multiple times , utility updates log file in computer in below location "c:\users[username]\appdata\roaming\tableau\tabcmd.log" i want update form application log file details in computer b once process completed in computer a. running .bat file using below, string path = @"c:\tabcmd.bat"; string machinename = textbox1.text; var processtorun = new[] { path }; var connection = new connectionoptions(); connection.username = textbox3.text; connection.password = textbox2.text; var wmiscope = new managementscope(string.format("\\\\{0}\\root\\cimv2", machinename), connection); var wmiprocess = new managementclass(wmiscope, new managementpath("win32_process"), new objectgetoptions()); wmiprocess.invokemethod("cre...

Using Regex in Ruby to parse out a chunk of file names -

i trying standardize file names in directory have similarities, not consistent. are, however, standard enough. examples of file names (where date month/day/year): weekly sales report 022213 lv.xls weekly sales report 091908 lv-f.xls weekly sales 072508.xls weekly u s sales v1.0 061308.xls weekly u.s. sales jan0606.xls my current solution has been effective, ugly find , replace possible string combinations. x.gsub!(/^weekly|sales|report|u s|u.s.|\s/,'') however, assume there way @ file name string , grab chunk has of date information. chunk bounded whitespace on left , ends in @ least 4 digits. there straightforward way accomplish this? your requirement stated suggest following: date_portion = x.match(/\s(\s*\d{4,8})/)[1] that's: match 1 whitespace char, capture zero-or-more non-whitespace, followed 4 8 digits; return captured text.

asp.net - How to Edit Excel with EPPLUS and send it as attachment -

i have following code, working, opens file stream embedded xlsx saves on memorystream pass value attachment , send no problem. private sub sendfile2() dim path string = server.mappath("~/app_data/rqm.xlsx") using filest filestream = io.file.openread(path) dim memstream new memorystream() memstream.setlength(filest.length) filest.read(memstream.getbuffer(), 0, cint(filest.length)) '' code mailmessage , smtp goes here mailmsg.attachments.add(new attachment(memstream, "myfile.xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")) end using end using end sub now im trying edition (adding values file, still working in memorystream) having problems i've added using pck excelpackage = new excelpackage(memstream) dim xlswb excelworkbook = pck.workbook dim xlsws excelworksheet = xlswb.worksheets.first xlsws.cell...

properties - ESAPI custom property files -

ok, i've been researching esapi awhile , trying determnine how create custom esapi , validator.properties files override found in esapi jar. how accomplish this? know looks in 4 places (reference: esapi properties file in tomcat , esapi docs) when trying load, loading via classpath works it's loading default property values. can custom properties load when put them in home directory isn't helpful. is there way esapi load custom properties files when in main projects directory? did try use -dorg.owasp.esapi.resources=path_to_folder jvm option?

java - Running SuperDevMode with a Maven EAR packaged GWT application -

i've refactored typical gwt 2.7 , appengine stacked application single maven module many - can compile, run appengine dev server , deploy. i need guidance configure gwt superdevmode using gwt mojo . client , server components split different modules , packaged using ear module , i'm unsure start. the project layout looks like: /app-client (gwt) - use gwt mojo here compile client war. used have in here. /app-core (shared code) - jar /app-server (default appengine module) - war /app-auth (auth appengine module) - war /app-worker (worker appengine module) - war /app-ear (ear package) - use appengine mojo here deployment. pom.xml - parent i assume gwt mojo must ran on app-ear module, how provide app-client sources run configuration? mojo's maven plugin gwt not make easy run dev mode in multi-module builds. correct classpath, need run gwt:run or gwt:run-codeserver goal in app-client module (and either need mvn install dependencies – app-core – and/or h...

audio - Play sound with C# using DirectSound (DirectX API) -

this might seem basic question, not researching hours find out did wrong. i tried write simple console application supposed play sound resource, , code: using system; using microsoft.directx.directsound; namespace audioplayer { class program { static void main() { console.writeline("playing..."); device device = new device(); secondarybuffer buffer = new secondarybuffer(audioplayer.properties.resources.audiofile, device); // audioplayer.properties.resources.audiofile returns stream buffer.play(0, bufferplayflags.default); console.writeline("finished"); console.readkey(true); } } } but console window no text although @ least "playing..." should printed, , there no sound well. i using visual studio 2015 provides option pause application, , if that, tells me threads processing external code. considering that, assumed program ...

How to limit number of workers in react native packager (android)(gradle)? -

building android react-native project using react.gradle on circleci runs out of max 4gb memory. 1 of issues leading memory pressure 30+ node workers spinned packager each taking 80mb. see below sample output. looking through packager code it's not obvious me how control number. not option available through react-native bundle command. pid rss %cpu command 14799 60988 5.0 /home/ubuntu/nvm/versions/node/v5.0.0/bin/node /home/ubuntu/mobile_android_circleci/mobile/node_modules/react-native/node_modules/worker-farm/lib/child/index.js 14804 58696 4.2 /home/ubuntu/nvm/versions/node/v5.0.0/bin/node /home/ubuntu/mobile_android_circleci/mobile/node_modules/react-native/node_modules/worker-farm/lib/child/index.js 14709 58036 4.1 /home/ubuntu/nvm/versions/node/v5.0.0/bin/node /home/ubuntu/mobile_android_circleci/mobile/node_modules/react-native/node_modules/worker-farm/lib/child/index.js 14814 57832 4.4 /home/ubuntu/nvm/versions/node/v5.0.0/bin/node /home/ubuntu/mobile_android...

handling strings in python? -

s5=0 phrase in root.findall('./phrase'): ens = {en.get('x'): en.text en in phrase.findall('en')} if 'org' in ens , 'pers' in ens: if (ens["org"] =="xyz corp" , ens["pers"]=="john"): print("org is: {}, pers is: {} /".format(ens["org"], ens["pers"])) y="".join(phrase.itertext()) #print whats in between print(y) s5 = s5+1 print("occurrence of fifth seed : ",s5) here in each iteration, y printed, y text in xml document long have 2 "en" tags, 1 org & 1 pers. so output is: john cofounder of xyz corp. john works in xyz corp. john named company xyz corp. i have been trying save each sentence on own can use later. example want use second sentence "john works in xyz corp" don't know how that, tried using variable y 2d array failed. as commented above: sente...

Facebook PHP SDK adding permissions after login -

i'm working on integrating facebook php sdk website building, , have question (maybe problem, not sure yet...). initially planning on setting permissions in initial login allow users post feeds/page feeds through site depending on route prefer, read on fb sdk pages requiring permissions @ initial login not essential @ moment bad practice. my question how add more permissions later using php sdk? scoured internet 2 days looking example, , haven't been able find one. maybe looking in wrong places. don't know. haven't had luck. my thought check if permission set, , if not, log user in permission, , use new access token. issue me doing way, have write form data session, call when fb login sequence done. is thinking correct, or there way better? should stack permissions right off bat, or should way facebook suggests? the whole reason site using facebook allow users automatically share posts (it art site) when upload piece site, instead of uploading piece having...

c# - Prism for Xamarin, dependency failed for INavigationService -

i working on sample xamarin.forms app ios, using prism. but when tried use inavigationservice in viewmodel, failed saying dependency failed interface inavigationservice i dont know wrong doing, how can around or bug in inavigationservices injection. thanks divikiran ravela heres code public app() { // root page of application prism = new prismbootstrap(); prism.run(this); } public class prismbootstrap : unitybootstrapper { protected override page createmainpage() { return new navigationpage(container.resolve<homepage>()); } protected override void registertypes() { container.registertypefornavigation<homepage, homepageviewmodel>(); } } public class homepage : contentpage { public homepageviewmodel viewmodel { get; set; } public homepage() { viewmodel = app.prism.container.resolve<homepageviewmodel>(); content = new stacklayout ...

sql server - Converting a datename(dw script from sqlserver to sqlite -

i've got sqlserver query day of week datetime query i've got convert sqlite. below snippet of query sql server : datename(dw,tblsometable.eventdate), what need sqlite equivalent "datename(dw,tblsometable.deventdate)". appreciated. so way changed query returning int's wanted return days of week replaced datename(dw,tblsometable.deventdate) : case cast (strftime('%w', tblsometable.eventdate) integer) when 0 'sunday' when 1 'monday' when 2 'tuesday' when 3 'wednesday' when 4 'thursday' when 5 'friday' else 'saturday' end servdayofweek and got me needed.

android - SwipeRefreshLayout works but the spinner won't show -

i'm having issue using swiperefreshlayout, functionality works spinner won't show. i've used provided solutions out there still nothing. i don't use xml @ code , avoid it. have class extending swiperefreshlayout create listview, add adapter , configure refresh action etc. minimum api level 16. if guys need further details or code please let me know , i'll glad provide them, appreciated! my activity public class mainactivity extends activity { private static mainactivity mainactivity = null; private mainview mainview; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); mainview = new mainview(this); setcontentview(mainview); } public static mainactivity getmainactivity() { return mainactivity; } } my main view: public class mainview extends swiperefreshlayout { private listview listview; public mainview(context context) { s...

javascript - Changing array value from string to int jQuery -

how change value of array if i've got ["-2", -1, 0, 1, 2] . take data text box, need have array of int instead of 1 string @ begining. tried parseint(array) , eval(array) nothing working. thanks unary + can used convert operand number: array[0] = +array[0]; if want convert strings in array can use map : array = array.map( number );

bash - How do delete a file named ".." on a Linux system -

i encountered mysterious file on webserver today. [root@hosting wwwbeta]# ls -la "mydir" total 600 drwxr-xr-x 7 apache apache 4096 jan 5 15:40 . drwxr-xr-x 38 apache apache 4096 jan 5 13:41 .. -rwxr-xr-x 1 root root 337 mar 25 2014 .. -rwxr-xr-x 1 root root 3225 jun 6 2014 more files any ideas on how rid of file? i've tried sorts of things rm, thinks i'm referring directory. i'm trying careful, because production server. i guess there spaces after .. meaning file has been created this: touch '.. ' you not recognize space using ls . i use find delete file: find -maxdepth 1 -type f -name '..*' -delete using -type f ensure not attempt remove parent folder (which not work anyway since not empty) btw, should concerned security file can been created accident or erroneous script. if file should "come back" after deletion should concerned.

ios - Emulate searchbar in Calendar app -

i trying emulate search bar in calendar app , finding surprisingly difficult although many people have posed question on , elsewhere , many half answers have been offered. (i need support ios 7). the main requirements 1) there search bar button. 2) when above button pressed, search bar cancel appears in navigation bar. to accomplish 1) put bar button item on navigation bar. no problem. to accomplish 2) hard part. to search bar display in navigation bar opposed elsewhere supposed set self.searchdisplaycontroller.displayssearchbarinnavigationbar= true here ; i can search bar appear in nav bar without cancel button. the code show cancel button supposed be: self.searchdisplaycontroller.searchbar.showscancelbutton = yes; this not working in conjunction placing search bar in nav bar. finally, opposed searchdisplaycontroller, called search bar has property called .hidden. after dragging search bar , search displaycontroller view, i've created outlet propert...

ruby on rails - NoMethodError - undefined method `file' for on simple query -

i want show picture throws same error. join correct doesn't show image instead throws error. within /series_images/ show , index image displayed with <%= image_tag(@series_image.file, class: "img-responsive",) %> that's working without problems. here server started "/series/beyond-the-boundary" 127.0.0.1 @ 2016-01-06 01:44:03 +0100 processing seriescontroller#show html parameters: {"id"=>"beyond-the-boundary"} series load (0.3ms) select "series".* "series" "series"."slug" = $1 order "series"."id" asc limit 1 [["slug", "beyond-the-boundary"]] seriesimage load (0.3ms) select "series_images".* "series_images" "series_images"."series_id" = $1 [["series_id", 1]] rendered series/show.html.erb within layouts/application (3.4ms) completed 500 internal server error in 7ms (activereco...

Is there an equivalent to R's negative indexing in Matlab? -

in r , if have vector , list of indices, can express idea want "all elements except these indices" using negative index. in particular, consider following r code: data = rnorm(100) indices = sample(1:length(data), length(data)/2) training_data = data[indices] test_data = data[-indices] after code, sampled_data contains elements in data indices not included in indices . is there equivalent in matlab? i tried directly using same syntax (of course wtih () instead of [] , gave error subscript indices must either real positive integers or logicals. matlab not allow negative indices. can remove elements this: data2 = data; data2(indices) = []; % remove selected elements but when doing machine-learning stuff prefer use logical indexing: istest = randn(length(data), 1) < 0; % random logicals: 50% 0's , 50% 1's istrain = ~istest; % operate on data(istest) , data(istrain).

qt - How to put attached properties to child item -

let's assume have component this rowlayout { myitem { layout.fillwidth: true layout.fillheight: true ... // other properties } myitem { layout.fillwidth: true layout.fillheight: true ... // other properties } } in myitem.qml defined rectangle { ... // other properties // layout.fillwidth: true // layout.fillheight: true } can put layout.fillwidth myitem , don't need repeat in rowlayout ? can put layout.fillwidth myitem, don't need repeat in rowlayout ? i think question has answer in it: if don't want repeat, use repeater type. documentation states that items instantiated repeater inserted, in order, children of repeater's parent. insertion starts after repeater's position in parent stacking list. allows repeater used inside layout . the example follows in documentation uses row same approach can applied other layouts, e.g. rowlayout . actually, wo...

windowsiot - How do you install Sql Server on Windows IoT? -

i need install db able use nlogger record code events. use sql server. sql supported on iot in-any-case, if in flavour? stuart, windows iot windows iot core. is not windows on desktop or server rather more winrt (on phone , arm tablets). if need database, i'd @ using sqllite. database recommended winrt applications. 1 can use on win iot core since can used uwp applications described here. using sqlite on universal windows platform

android - How to continue read content in ListView after bottom swipe? -

i have used swipyrefreshlayout here , because need update data when listview on , continue reading content after downloading. have problem - after bottom swipe focus of application going listview top. have endless posts in listview, need continue reading after downloading them. should change this? can me? this code of application public class mainactivity extends appcompatactivity implements navigationview.onnavigationitemselectedlistener, swipyrefreshlayout.onrefreshlistener { private static final string tag = "mainactivity"; private static final int layout = r.layout.activity_main; private static final string url = "http://killpls.me"; private static final string url_moderation = "http://killpls.me/moderation/"; private toolbar toolbar; private drawerlayout drawerlayout; private navigationview navigationview; private actionbardrawertoggle toggle; private floatingactionbutton fab; private progressdialo...

MS Access: average subset of records on report -

i have database of test results tables students , tests , test_results . each record in test_results refers key students , key tests , score , yes/no field absent. have report subheadings (grouped by) each test. want display average score each test on test's heading want calculate average on records student not absent. i unsuccessfully tried 2 approaches: a query named averagescorewherenotabsent select avg(score) expr1 test_results (((test_results.absent])=false)); ; , unbound field on report's test grouping subheader, source expression =dlookup("[score]","[averagescorewherenotabsent]![expr1]","[test] = " & [id]) . unfortunately returns '#error'. tried tweaking ask me parameters or - oddly - display score of last student instead of average. what's wrong syntax?! some vba loops through test_results looking fields match current test id , not marked absent. sums , averages them , updates unbound field on test subheader. c...

c++ - Convert basic_string<unsigned char> to basic_string<char> and vice versa -

from following can turn unsigned char char , vice versa? it appears converting basic_string<unsigned char> basic_string<char> (i.e. std::string ) valid operation. can't figure out how it. for example functions perform following conversions, filling in functionality of these hypothetical stou , utos functions? typedef basic_string<unsigned char> u_string; int main() { string s = "dog"; u_string u = stou(s); string t = utos(u); } i've tried use reinterpret_cast , static_cast , , few others knowledge of intended functionality limited. assuming want each character in original copied across , converted, solution simple u_string u(s.begin(), s.end()); std:string t(u.begin(), u.end()); the formation of u straight forward content of s , since conversion signed char unsigned char uses modulo arithmetic. work whether char signed or unsigned . the formation of t have undefined behaviour if char signed char...

html - How to show table field content in WebBrower Control on form in MS-Access? -

i want show html formatted text on form in access. i use form bound table. form has web brower control. control source set field in table. the web brower control not show saved in field (this want), tries interpret in field. if field content i.e. file name on pc , file contains html html shown in web brower control on form. but if field content actual html code (exactly 1 saved in file) web browser control not show formatted html (this expect) shows default search page searching content of file. i work around problem saving html text table files , open these files in web browser control. there should easier way. i sure other people tried same before searched forum , web , did not find answer.

java - Android ListView not refreshing after dataset changed, though I have used the Adapter.notifyDataSetChanged() -

i know similar questions had been asked here couple of times, none of them me problem, have ask again. what have app has fragment holds listview in main activity , used pullablelistview when drag listview up, trigger onloadmore() callback method load more data server. once data loaded, data saved sqlitedb , used listview show updated data. the pullablelistviewfragment.java: public class pullablelistviewfragment extends fragment implements onitemclicklistener { private listview listview; private pulltorefreshlayout ptrl; private missiondb mmissiondb; private list<missionentity> mdata; private missionlistadapter madapter; /** * specify exact mission displayed in missiondetailactivity */ private int mindexofmission; @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view pullablelayout = inflater.inflate(r.layout.pullable_layout, container, false); listview = (listview) pullablelayout....

python - Insert invisible unicode into MySQL using python3 but encountered duplicate -

when insert device data mysql(v5.5.6) using python(v3.2). encountered problem. this device (it contains 3 unicode , blank space): '\u202d\u202d \u202d' and device b (it blank space): ' ' the problem when insert device data mysql , error duplicate entry 'activate_device-20151201-1-5740-01000p---‭‭ ‭--' key 'primary' i guess mysql has deal '\u202d'(a unicode reverse string maybe?). how can simulate process in python3 mysql? how can avoid duplicate? the expected result translate '\u202d\u202d \u202d' ' ' in python3. please me. there ambiguities here. want keep visible ascii characters or visible unicode characters ? if want keep visible ascii characters, simple way use python inbuilt string module. import string new_string = "".join(filter(lambda x:x in string.printable, original_string)) for specific usecase, space part of visible ascii - above convert '\u202d\u202d \u202d...

java - Android Studio: Passing RadioButtons using Intent ERROR NullPointerException -

i beginner apologize in advance following error when running program: java.lang.nullpointerexception: attempt invoke virtual method 'int android.widget.radiogroup.getcheckedradiobuttonid()' on null object reference here code "quiz" public class quiz extends activity { button btn; radiogroup rg; radiobutton rb1; radiobutton rb2; radiobutton rb3; radiobutton rb4; then below that: 2 and xml "quiz": <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <radiogroup android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentbottom="true" android:layout_centerhorizontal="true" android:id="@+id/rg"> <...