Posts

Showing posts from January, 2014

Python - Efficiently working with large permutated lists -

i've written short anagram solver script in python 2.7 . #import permutations module itertools import permutations perm #defined functions def check(x,y): #opens dictionary file open('wordsen.txt') dictionary: '''checks permutations against of dictionary words , appends matching ones on of empty lists''' line in dictionary: in x: if + '\n' == line: y.append(i) #empty lists appended later anagram_perms = [] possible_words = [] #anagram user input anagram = list(raw_input("input scrambled word: ").lower()) #creates single list items permutations, deletes duplicates char in perm(anagram): anagram_perms.append("".join(char)) anagram_perms = list(set(anagram_perms)) #uses defined function check(anagram_perms, possible_words) #prints number of perms created, prints possible words beneath print len(anagram_perms) print '\n...

javascript - Add text to input only if div has class `is-active` -

problem players have not been selected, ie. not have class of picked.is-active should not added of input fields when clicked on the maximum number of players be picked each category 2 out of 4 goalies, 6 of 15 defencemen , 12 out of 31 forwards. update #3 added link github repo here: https://github.com/onlyandrewn/wheatkings update #2 added snippet, shows how is-inactive , is-active classes being toggled. update #1 - i've removed second snippet may causing confusion this javascript snippet below grabs name of player clicked , puts input field, if has class of picked.is-active . however, let's you've selected 2 goalies already, click on 2 remaining goalies in category when unselected (have default class in-active ) those unselected players still added inputs, not want. scripts.js - snippet, needs fixing, adds player name input field if max number players in specific category has been reached $(".player").on("click", functio...

maven - No DestinationFactory was found for the namespace - create uber JAR of CXF with Jetty -

i want create uber jar cxf-based application server. want server commandline java -jar . in ide, can run main class com.connexta.desertcodecamp.server , not correctly creating uber jar. when run command java -jar server-1.0-snapshot.jar , org.apache.cxf.service.factory.serviceconstructionexception @ org.apache.cxf.jaxrs.jaxrsserverfactorybean.create(jaxrsserverfactorybean.java:215) @ com.connexta.desertcodecamp.server.<init>(server.java:19) @ com.connexta.desertcodecamp.server.main(server.java:33) caused by: org.apache.cxf.busexception: no destinationfactory found namespace http://cxf.apache.org/transports/http. @ org.apache.cxf.bus.managers.destinationfactorymanagerimpl.getdestinationfactory(destinationfactorymanagerimpl.java:122) @ org.apache.cxf.endpoint.serverimpl.initdestination(serverimpl.java:79) @ org.apache.cxf.endpoint.serverimpl.<init>(serverimpl.java:63) @ org.apache.cxf.jaxrs.jaxrsserverfactorybean...

c# - How to have multiple selection of items on combobox -

Image
hey wanted know how can select multiple items combobox in xaml? note: i'm using data binding. like image: you can use checkbox items of combobox . and when checkbox checked, important modify placeholdertext of combobox , default show selected item, can modify show items checked. for example here: how make list of checkboxes in alarm & clock app .

Visual Studio Code does not Debug Extension to simulate -

Image
i start simple snippet extension , when debug vscode created folder ./vsce configuration file automatically. when run f5 in extension folder, see message bellow. created file configuration, why message? this file wrong .vscode/launch.json , necessary add git folder, change this: // launch configuration compiles extension , opens inside new window { "version": "0.1.0", "configurations": [ { "name": "launch extension", "type": "extensionhost", "request": "launch", "runtimeexecutable": "${execpath}", "args": ["--extensiondevelopmentpath=${workspaceroot}" ] } ] }

Scala infinite while loop even though condition changed to false -

import scala.collection.mutable.arraybuffer object namelist { val names = arraybuffer("placeholder") } class robot { val r = scala.util.random val letters = 'a' 'z' val name = { val initname = namelist.names(0) while(namelist.names.contains(initname)){ val initname = letters(r.nextint(26)).tostring + letters(r.nextint(26)).tostring + r.nextint(10).tostring + r.nextint(10).tostring + r.nextint(10).tostring println("while", initname) println("while", namelist.names) println("checker", namelist.names.contains(initname)) } println("outside", namelist.names) namelist.names += initname initname } } outputs (while,la079) (while,arraybuffer(placeholder)) (checker,false) (while,io176) (while,arraybuffer(placeholder)) (checker,false) the while loop runs indefinitely, above output snippet. why isn't while loop exiting though condition changed false?...

javascript - Twitch TV JSON API Issue -

so,i trying use twitch api: https://codepen.io/sterg/pen/yjmzrn if check codepen page you'll see each time refresh page status order changes , can't figure out why happening. here javascript: $(document).ready(function(){ var ur=""; var tw=["freecodecamp","nightblue3","imaqtpie","bunnyfufuu","mushisgosu","tsm_dyrus","esl_sc2"]; var j=0; for(var i=0;i<tw.length;i++){ ur="https://api.twitch.tv/kraken/streams/"+tw[i]; $.getjson(ur,function(json) { $(".tst").append(json.stringify(json)); $(".name").append("<li> <a href="+"https://www.twitch.tv/"+tw[j]+">"+tw[j]+"</a><p>"+""+"</p></li>"); if(json.stream==null){ $(".stat").append("<li>"+"offline"+...

apache - Server external connection refused -

i using wampserver 3.04, can connect using local network ip without problem, when comes connect via internet response: connection refused! i have done lot of things: enable incoming connections on firewall port 8080 (the port want use) configured httpd , httpd-vhosts both on current ip , port enabled port forward extenal 8080 private 8080 computer ip enabled put online on wamp tested if port 8080 open , open. i not have else try. my httpd-vhosts: <virtualhost *:8080> servername 192.168.1.3 documentroot c:/wamp64/www <directory "c:/wamp64/www/"> options +indexes +followsymlinks +multiviews allowoverride allow </directory> </virtualhost> i had same issue since port 80 used vmware process. hence killed vmware process. run powershell (get-process vm | stop-process -force) use star before &after vm start wamp goto apache -test port 80. if not working install apache ser...

django - AJAX Form won't update after being submitted -

i have been toubleshooting ajax request contact form. form load field errors ajax request, wont submit form after response. 1 thing note trying submit form button outside form tag, 1 inside tag submits once. my ajax script: $('#modal-form').submit(function(e) { e.preventdefault(); var form = $(this); $.ajax({ url: form.attr('action'), type: form.attr('method'), data: form.serialize(), success: function(data) { if (!(data['success'])) { // here replace form, form.replacewith(data['form_html']); $('#modal-form').off("submit"); } else { // here can show user success message or whatever need $('#mymodal').modal("hide"); } }, error: function () { $('#error-div').html("<strong>error</strong>"); } }); }); my form: {% load crispy_forms_tags %} <di...

postgresql - Thinking at using Cassandra DB with .net, Dapper.net fluentmigration -

basically looking @ solutions keep our running costs down allow keep 3+ nodes in sync. so looking @ postgresql when cassandra came on our radar. can tell me if dapper.net , fluent-migration works cassandra experience? also advice on kinda of setup appreciated.

Spring Boot 1.4 issue with Cucumber-JVM -

when using spring boot 1.4 cucumber, @autowired beans not injected. but when use plain junit tests, injected correctly! have looked here doesn't solve problem. @springbootapplication @enableswagger2 @componentscan("org.services") public class servicesapplication { public static void main(string[] args) { springapplication.run(servicesapplication.class, args); } } @runwith(cucumber.class) public class userstest { } @runwith(springrunner.class) @springboottest public class userssteps { @autowired private usersservice _target;//null } edit: clarify, did view cucumber spring boot 1.4: dependencies not injected when using @springboottest , @runwith(springrunner.class) , put annotations @runwith(springjunit4classrunner.class) @contextconfiguration(classes = application.class, loader = springapplicationcontextloader.class) didnt work then put these annotations (as in answer) @contextconfiguration @springboottest didnt work eith...

java - Best way to make a 3x3 image button layout for android studio -

i looking make android version (i started learning how use android studio). have difficulties layout. want make 3x3 image button on main activity don't know how fix sizes fit screens. in xcode (ios), drag , resize , set constraints i'm having trouble doing in android studio. can tell me how it? or @ least redirect me post or video me? you can use gridview or can implement using linearlayout this. check out xml layout work you. <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:card_view="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:background="#d3d3d3" tools:context=".ui.mainactivity"> <android.support.v7.widget.toolbar xmlns:an...

PHP Unable to execute Pytesseract in Python via shell_exec() -

i using postman send base64 image php file on apache web-server. image sent successfully. php script executes python script extract text image (using pytesseract/tesseract-ocr) , sends output php. (using windows 10, if matters) the first 2 print statements returned in postman third , fourth print statements not return. last print statement returns when pytesseract line commented out. when run python script itself, print statements return successfully. python (test.py) from pil import image import pytesseract import sys print "print 1" print "print 2" filename = "test.jpg" #filename = sys.argv[1] text = pytesseract.image_to_string(image.open("images/"+filename)) print text #final print statement appears on postman if tesseract code not run = "print" b = 1+2 print a, b php (connection.php) <?php header('content-type : bitmap; charset=utf-8'); if(isset($_post["encoded_string"])){ $encoded_stri...

javascript - how noscript tag treated in different browsers -

i can't see explanation anywhere. i want know what browsers generate data inside noscript tag, if js enabled. for example: according html5 specs, allowed use noscript tag inside head tag. <head> <noscript> <link rel="stylesheet" href="basic.css" type="text/css" media="all" /> </noscript> </head> the reason i'm asking question i'm afraid browsers may treat noscript tag text(if js enabled), , result load/add unnecessarily data. so, how browsers treat noscript tag? thanks. the html element defines section of html inserted if script type on page unsupported or if scripting turned off in browser. source . also the noscript element represents nothing if scripting enabled, , represents children if scripting disabled. used present different markup user agents support scripting , don't support scripting, affecting how document parsed. source . noscri...

arm - gdb No such file or directory error -

update: found workaround - explained @ bottom i'm trying remote debug program via serial port. on target machine (arm, linux) (connected host machine (windows) via serial-to-usb) connected via putty , looked ttys* in /dev directory, don't have any. have tty[num] (without s ), , running: dmesg | grep tty as suggested here gives following: # dmesg | grep tty kernel command line: mxc_hdmi.only_cea=0 console=ttymxc1,115200 vmalloc=400m consoleblank=0 rootwait fixrtc root=/dev/mmcblk1p1 2020000.serial: ttymxc0 @ mmio 0x2020000 (irq = 58, base_baud = 5000000) imx 21e8000.serial: ttymxc1 @ mmio 0x21e8000 (irq = 59, base_baud = 5000000) imx console [ttymxc1] enabled so tried use ttymxc0 , ttymxc1 : gdbserver /dev/ttymxc0 ./test/main process ./test/main created; pid = 253 remote debugging using /dev/ttymxc0 and on host machine (windows 7): (edited following comments) gdb path/on/host/main (gdb) target remote com15 com15: no such file or directory. i see here ...

mysql - Having condition has unknown clause -

select sum(pa.depositmade_num) numdeposit, sum(pa.depositmade_amt) amtdeposit, count(distinct pa.userid) distinctuser customer_profile cp inner join player_activity pa on cp.userid = pa.userid pa.txndate > date(curdate()) - interval 14 day having (select (round(sum(opa.totalhold - opa.playercomps - opa.freemoney - (opa.depositmade_amt*.1)),2)) > 20000 player_activity opa opa.userid = cp.userid) i have used same having statement in other queries without issue in mysql. however, i'm getting unknown column datawarehouse.cp.userid in clause error message. when remove where opa.userid = cp.userid having sub-query, query runs. need line calculation work properly.

asp.net mvc - mvc binding for editing multiple items ValidationMessageFor showing for all records -

seems question similar mvc model binding edit list not working issue having returned list nothing. tried follow http://www.c-sharpcorner.com/uploadfile/4b0136/editing-multiple-records-using-model-binding-in-mvc/ converting vb.net function editall() actionresult return view(db.recipients.where(function(r) r.type = "email").tolist()) end function <httppost()> public function editall(recipients list(of recipient)) actionresult 'recipients nothing why??? each item recipient in recipients dim existing_recip recipient = db.recipients.find(item.id) existing_recip.emailaddress = item.emailaddress existing_recip.active = item.active next db.savechanges() return view(recipients) end function and view: @modeltype list(of concurbridge.models.concur.recipient) @code viewdata("title") = "editall" layout = "~/views/shared/_layout.vbhtml" end code <h2>edit recipients</h...

How to block udp ports range in linux RHEL7 -

need test application uses udp port range 5000 60,000 in. want test boundary value condition ports. want block udp ports range 5000 59999. using iptables: iptables -a input -p udp --dport 5000:59999 -j drop or, better, iptables -a input -p udp --dport 5000:59999 -j reject --reject-with icmp-port-unreachable

Retrieving data from Firebase DB and storing in local variable: Android -

my app stores user location data in firebase realtime database . intend retrieve of data , process within app. able fetch desired data firebase db (checked through debugging). want store data in local variables. able store values except 1 value (debugger shows value null, though present in datasnapshot .). data firebase in userdatalocation object form , following class same: userdatalocation class: public class userlocationdata { string mobile, name, latitude, longitude, proximity, connection_limit, last_updated; public userlocationdata() { } public userlocationdata(string mobile, string name, string latitude, string longitude, string proximity, string connection_limit, string last_updated) { this.mobile = mobile; this.name = name; this.latitude = latitude; this.longitude = longitude; this.proximity = proximity; this.connection_limit = connection_limit; this.last_updated = last_updated; } pub...

java - Children of Parent in JFace TreeViewer -

how retrieve children of selected item in jface treeviewer ? able parent of selected item, not children. you use tree content provider both children , parent of selection in tree viewer. istructuredselection sel = treeviewer.getstructuredselection(); object selelement = sel.getfirstelement(); itreecontentprovider provider = (itreecontentprovider)treeviewer.getcontentprovider(); object [] children = provider.getchildren(selelement); object parent = provider.getparent(selelement); note: when using treeviewer should avoid looking @ tree or treeitem controls treeviewer uses internally.

Huge XML-Parsing/converting using R or RDotnet -

i have xml file of 780gb (yes yes, indeed, 5gb pcap file converted xml). name of xml file tmp.xml. i trying commit operation in r-studio: require("xml") xmlfile<<-xmlroot(xmlparse("tmp.xml")) when trying r errors (memory allocation failure, r session aborted etc). there benefit use rdotnet instead of regular r? there way use r this? know strong tool convert huge xml csv or easier format? thank you!

mongodb - Mongo DB concurrent findAndModify with increment operation -

if 2 agents run update query concurrently on mongo cluster, expected value of updateversion @ end? db.task.findandmodify( { query:{"updateversion":21}, update:{$inc:{"updateversion":1}} } ); if answer "23", there way have guaranteed read/write synchronized operation? mongodb have faq section concurrent operations. in case, write conflict might happen mongodb still try execute both commands: a situation in 2 concurrent operations, @ least 1 of write, attempt use resource in way violate constraints imposed storage engine using optimistic concurrency control. mongodb transparently abort , retry 1 of conflicting operations.

c# - Openstack authorization -

hello reading this, i want list images openstack following code in c#: using system; using microsoft.visualstudio.testtools.unittesting; using net.openstack.providers.rackspace; using net.openstack.core.domain; using net.openstack.core.providers; namespace repositoriestests { [testclass] public class rackspacetests { public string username = "mbar"; public string password = "password"; public string url = "http://192.168.5.55:5001/v3"; public string project_id = "a9b2b59f093f44d881b8ebccbba00901"; public string project_name = "test-nsix"; [testmethod] public void testconnection() { try { var identity = new cloudidentitywithproject() { username = username, password = password, projectid = new projectid(project_id), projectname = project_name }; ...

string - What is the best algorithm to find longest substring with constraints? -

unfortunately don't know name of following problem sure known problem. want find effective algorithm solve problem. let s - input string , k - number (1 <= k <= 26). problem find longest substring of s, has k different characters. best algorithm solve problem? some examples: 1) s = aaaaabcdef, k = 3, answer = aaaaabc 2) s = acaaba, k = 2, answer = acaa or aaba 3) s = abcde, k = 5, answer = abcde i have sketch of solution of problem. seems difficult me, has quadratic complexity. so, in single linear pass can compute sequent of same characters 1 , appropriated count. next step use set contain k characters. usage similar: std::string max_string; (int = 0; < s.size(); ++i) { std::set<int> my_set; std::string possible_solution; (int j = i; j < s.size(); ++j) { // filling set , possible_solution } if (my_set.size() == k && possible_solution.size() > max_string.size()) max_string = possible_solution; } ...

vb.net - COMException occurred - Unknown name. (Exception from HRESULT: 0x80020006 (DISP_E_UNKNOWNNAME)) when trying to modify an existing excel file -

3rd line returns comexception. obooks.gettype().invoke... dim obooks microsoft.office.interop.excel.workbook = me.fopenxlsfile(strxlsfile) dim ci system.globalization.cultureinfo = new system.globalization.cultureinfo("en-us") obooks.gettype().invokemember("add", reflection.bindingflags.invokemethod, nothing, obooks, nothing, ci) int32 = 0 objlv.items.count - 1 obooks.styles.item(i + 1).interior.color = objlv.items(i).backcolor next obooks.save() you're trying add workbook workbook. need add workbooks collection. should work: dim wbs excel.workbooks = obooks.application.workbooks wbs.gettype().invokemember("add", reflection.bindingflags.invokemethod, nothing, wbs, nothing, ci)

java - AEM: 403 Forbidden occurs when call a Post servlet -

my problem similar this: cq5: 403 forbidden occurs when call post servlet in aem 6.1 according accepted answer of above topic, must remove post apache sling referrer filter. wonder if action harmful system? , have better way fix issue? p/s: sorry english. if testing code on author mode, 403 forbidden error request. requires csrf token. or can declare dependency granite.csrf.standalone before can use framework. on publish should work fine.

I want to retrieve data from sharepoint list using c# and store them into SQL server DB tables. How can I do this? -

string strurl = "some url"; using (spsite osite = new spsite(strurl)) { using (spweb oweb = osite.openweb()) { splist list = oweb.lists["targetlist"]; foreach (spfield field in list.fields) { console.writeline(field.title); } } } this code entering break state showing "file not found exception" .dont know problem is. want parse sharepoint list. after how insert data tables created in database string strurl = "some url"; using (spweb myweb = new spsite(strurl).openweb()) { splistitemcollection items = myweb.lists["yourlistname"].items; string fieldvalue1 = ""; //... string fieldvaluen = ""; sqlconnection con = new sqlconnection("connection string"...

php - 1055 Expression #3 of SELECT list is not in GROUP BY clause error in ManyToMany relationship laravel 5.3 -

i have post model this: class post extends model { protected $primarykey = 'post_id'; public function tags () { return $this->belongstomany('app\tag'); } } and tag model: class tag extends model { public function posts () { return $this->belongstomany('app\post'); } public function tagscount () { return $this->belongstomany('app\post') ->selectraw('count(pt_id) count') ->groupby('tag_id'); } public function gettagscountattribute() { if ( ! array_key_exists('tagscount', $this->relations)) $this->load('tagscount'); $related = $this->getrelation('tagscount')->first(); return ($related) ? $related->count : 0; } } ( pt_id column primary key field in post_tag pivot t...

javascript - Animations with React JS -

i have few sort filters on page, , want create animation when user click on 1 of them. if user want sort lowest price, want show new list, animations. i try react js. on componentwillmount set state cars : componentwillmount(){ const cart = this.props.cart; const listid = this.props.params.id; const allcars = data.getallcars(); let offers = this.state.offers; cart.map(car => { const acar = allcars.find(c => { return c.id === car.carid; }); offers[acar.chassis] = car.offer; this.setstate({offers: offers}); }); //we set state cars in list const cars = cardata.getcarsincurrentlist(listid, allcars); this.setstate({cars: cars}); } and when user clicks on 1 of sort filters handle on function : handlesortingfilters(name, event){ event.preventdefault(); const cars = this.state.cars; const sortfiltervalue = this.state.sortfiltersinit[name]; let filteredcars = ""; ...

android - change color in strings.xml and onClick method -

hi strings.xml. <item><font color ="red">mnasekundę</font></item> i changed color of item red, unfortunately logcat that: java.lang.illegalstateexception: not execute method android:onclick , oncick method: public void konwertuj(view view) { if (fromedittext.gettext().tostring().length() < 1) { toast.maketext(glownapredkosc.this, "musisz wpisać dowolną liczbę", toast.length_long).show(); } else { // string spinners , number edittext string fromstring = (string) fromspinner.getselecteditem(); string tostring = (string) tospinner.getselecteditem(); double input = double.valueof(fromedittext.gettext().tostring()); // convert strings in our unit enu, konwerterpredkosc.jednostka fromjednostka = konwerterpredkosc.jednostka.fromstring(fromstring); konwerterpredkosc.jednostka tojednostka = konwerterpredkosc.jednostka.fromstring(tostring); // create...

python - Creating a log of all pages visited by the user -

i creating functionality django application have. want log pages user visits , display him. i using middleware achieve it. class loggingmiddleware: """ class used register , fetch pages user has been visiting. """ def process_template_response(self, request, response): if request.user.is_authenticated(): userhistory.objects.create(user=request.user, page_name=request.path, url=request.path) if response.context_data: response.context_data['user_history'] = userhistory.objects.filter(user=request.user) return response i want name these userhistory entries in database, instead of set url name (as s now). have though of adding variable views have, in way request object has request.page_name . can think of better way it?

javascript - How to make ChartJS not cut off tooltips? -

Image
i trying figure out how make chartjs not cut off it's tooltips, can't seem find config option fix this. this have tried far: <script> $(document).ready(function() { var doughnutdata = [ { value: 48.3, color: "#81d7d8", highlight: "#23c6c8", label: "accepted" }, { value: 20.7, color: "#f58894", highlight: "#d9534f", label: "denied" }, { value: 31, color: "#f5c592", highlight: "#f8ac59", label: "pending" } ]; var doughnutoptions = { segmentshowstroke: true, segmentstr...

c# - Call a method in a specific time of the day -

i want call method in specific time of day without need request page : update: done following class , without task schedule or else something windows schedule i did in class: public class class1 { private const string dummycacheitemkey = "gagagugugigi"; protected void application_start(object sender, eventargs e) { var result = registercacheentry(); if (!result) { debug.writeline("the dummycacheitem alive!"); } } public bool registercacheentry() { if (null != httpcontext.current.cache[dummycacheitemkey]) return false; try { httpcontext.current.cache.add(dummycacheitemkey, "test", null, datetime.maxvalue, timespan.fromminutes(1), cacheitempriority.normal, new cacheitemremovedcallback(cacheitemremovedcallback)); }catch( exception ex) { debug.writeline("exeption error: " + ex); } return true; } publ...

javascript - Jquery: calculate volume -

took base of code 1 user , modified bit. need - calculates sum 3 values (first 2 in meters, third in centemeters). more simpler. dont't need "select options" in thickness field - it must calculated in centemeters! . , second request - the amount must in m 3 ! html: <table> <tbody> <tr> <td>width (m)</td> <td> <input type="text" id="width" /> </td> </tr> <tr> <td>length (m)</td> <td> <input type="text" id="length" /> </td> </tr> <tr> <td>thickness (cm)</td> <td> <input type="text" id="thickness" /> </td> <td> <select id="sel"> ...

actionscript 3 - Esri map with flex show name on navigator instead of coordinates -

Image
i using com.esri.ags.components.directions on esri map , added stops coordinates. how can assign name stop showing on screen , when printing instead of coordinates? this code added stops var stop:directionsstop = mainuicomponent.mydirections.stopprovider[0]; stop.editable = false; stop.searchterm = usersession.getcurrentuserdto().dealercoordinatesdto.addresslongitude + "," + usersession.getcurrentuserdto().dealercoordinatesdto.addresslatitude; var stopcount:int=1; for( var i:int=0; < customerstovisitslist.length; i++) { var point:dealerquestmappoint=new dealerquestmappoint( customerstovisitslist[i].addresslongitude,customerstovisitslist[i].addresslatitude); point.pointtype="customer"; point.targetobject=customerstovisitslist[i]; point.address = customerstovisitslist[i].address; var imagetooltip:string//...

php - Java on CentOS : not enough memory -

when make command in php like: exec('java -version > test.txt'); the file test.txt created error inside : there insufficient memory java runtime environment continue. native memory allocation (mmap) failed map 2555904 bytes committing reserved memory. an error report file more information saved as: /tmp/hs_err_pid25505.log the error report file does not exist @ location. when try execute same command in shell window, works: openjdk version "1.8.0_101" openjdk runtime environment (build 1.8.0_101-b13) openjdk 64-bit server vm (build 25.101-b13, mixed mode) the command i'm trying execute not java -version more complicated one. however, result same. i think problem comes php. until have tried increase memory_limit no avail. i've seen people having similar problems solutions proposed don't work. set memory xms , xmx options java. not php guy have shared links php also, verify if setting both options. ...

Angular 2: when i change a variable in a promise.than in ngOnInit the view doesn't refresh -

i created short example of angular 2 application built nativescript , expect variable foo "foo" @ beginning, ngoninit() first change "bar" , promise return , should see "foobar" in label, instead see "bar". the execution expected can see in logs: js: afterbar js: promise new js: promise component.ts foo:string="foo"; ngoninit() { this.foo = "bar"; console.log("afterbar"); var promise = new promise((resolve)=>{ resolve(42); console.log("promise new"); }); promise.then(x=> { this.foo="foobar"; console.log("promise than"); }); } the app view: <label [text]='foo'></label> how can change label text in promise see "refreshing" app view? solved: i solved problem forcing update import { changedetectorref } '@angular/core'; [...] constructor( [...], private ...

python - Function keeps doing the same thing -

this program suppose find 1000 prime numbers , pack them list here's code: num = raw_input('enter starting point') primes = [2] num = int(num) def prime_count(num): if num % 2 == 0: #supposed check if number divided 2 evenly num = num +1 #if is, add 1 number , check again return num elif num % num == 0: primes.append(num) #supposed add prime list num = num + 1 #add 1 , check again return num while len(primes) <= 999: prime_count(num) so happens when run it: asks me raw_input , goes various things depending on choose input: if choose prime, let's 3, runs , adds 999 of 3s list instead of adding 1 time , going on try 4 if choose non-prime, let's 4, breaks, after can't print out list what doing wrong? update: fixed it, when run i'm getting error (typeerror: unsupported operand type(s) %: 'nonetype' , 'int') number = raw_input('enter starting point') primes = ...

ios - UIButton text content keeps resetting every second update -

i trying update button test value , have noticed every second update button title text shows test value fraction of second resets button's default value. it seems bug, wanted see if there simpler explanation. have tried waiting 10 seconds before pushing button seems consistently occurring. any ideas how make uibutton function expected? import uikit class viewcontroller: uiviewcontroller { var testentry = "its working" @iboutlet weak var testbutton: uibutton! @iboutlet weak var testlabel: uilabel! @ibaction func runtest(sender: uibutton) { // button value should equal value of label value, every 2nd button press of test button results in title of button value resetting default value dispatch_async(dispatch_get_main_queue()) { self.testlabel.text = "\(self.testentry)" self.testbutton.titlelabel?.text = "\(self.testentry)" } } here github project. you sho...