Posts

Showing posts from August, 2011

ios9 - SKLightNode slows game when sprites have zRotation set -

i working on spritekit game project running @ 60 fps in ios 8.4 since ios 9, seeing performance drop 30fps on iphone 4s. i have sprites (about 20-30 @ once in scene) have zrotation property set greater 0.0 (e.g. 120). when add sklightnode , configure light sprites, performance drop. running apple's performance tools leeds me system libraries related skview rendering. if set zrotation property of sprites 0.0, game runs @ 60 fps once again. gave uses rotation heavily, keeping @ 0.0 not option me. any advice appreciated. thanks, rado. this seems 9.0.x related issue - check https://forums.developer.apple.com/message/65479#65479 details or see below piece important: i tested ios9.1 beta 2 , sklightnode performance normal *relief* btw. experienced fps drop rotation set 0 :)

animation - animate text alignment for UILabel in swift -

so question more of challenge in end. maybe im going wrong direction though maybe ask ideas. the context: i have set of string (place names) , want suggest answers based on user inputs in uitextview. the method: i used combination of 2 uilabels , 1 uitextview achieve working results: suggestionlabel in background, searchlabel in middle, , searchinput text view on foreground. textview enables interaction text's alpha set 0 (i didn't want consume time padding , insets relative various screen size , autolayout constraints have). when typing, changes reflected on searchlabel, , suggestion based on inputs on suggestionlabel. the goal: it's visual goal. when user select place based on suggestion, place's profile fades in , title set @ exact same place search text. (all of serve looking transition). the challenge: the search input, label , place's profile title have centered (im speaking text alignment here). make work different layer of text, used set ...

OkHttpClient in android -

i wrote following code send request server , getting response server. when run following code can not work me. wrote code based this link . public class mainactivity extends activity { @override protected void oncreate(bundle bundle) { super.oncreate(bundle); setcontentview(r.layout.activity); button button = (button)findviewbyid(r.id.bu1); button.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { try { run(); } catch (exception e) { toast.maketext(getapplicationcontext(),"error",toast.length_long).show(); } } }); } private final okhttpclient client = new okhttpclient(); public void run() throws exception { request request = new request.builder() .url("http://127.0.0.1:8080/file.php") .build(); call c...

c# - Adding a section to ContentRange GemBox -

i trying add whole section particular occurence using gembox. section section = new section(documentmodel); documentmodel.sections.add(section); contentrange backgroundchecksection = documentmodel.content.find("@@backgroundchecks").first(); backgroundchecksection.start.insertrange(section); this code not work since cannot implicity conver contentrange object section object. goal add whole section variable @@backgroundchecks appears. havent figured out how , wondering if me out. i'm not 100% sure want accomplish, in order insert section's content range need following: backgroundchecksection.start.insertrange(section.content); if provide more details want achieve out further. nevertheless presume want not insert section (this split section in you're inserting 2 you'll end 3 sections) in document, want insert content of section specified place (where placeholder "@@backgroundchecks" is). so instead of inserting "section.co...

ios - Strange UITableView error: "Assertion Failure" on dequeuing static cells in storyboard -

Image
i getting error: *** assertion failure in -[uitableview dequeuereusablecellwithidentifier:forindexpath:] static cells. my code in swift (the reuse identifiers strings set constants in file): ... private let toptableviewcellidentifier = "toptableviewcell" private let bottomtableviewcellidentifier = "bottomtableviewcell" ... override func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell { let reuseidentifier = (indexpath.section == 0) ? toptableviewcellidentifier : bottomtableviewcellidentifier let cell = tableview.dequeuereusablecellwithidentifier(reuseidentifier, forindexpath: indexpath) return cell } i have searched stack overflow error, , found bunch of answers saying same thing: make sure reuse identifier same 1 cell in storyboard. however, in case, is. i have confirmed repeatedly, , have cut , pasted 1 other repeatedly in order ensure case. xcode indicates ...

python - Django Error passing URL argument from Template to View: NoReverseMatch Reverse not found. 1 pattern(s) tried -

i trying pass configure url so: /details/12345 template html: <div class="row"> {% if article_list %} {% article in article_list %} <div> <h2>{{ article.title }}</h2> <p>{{ article.body }}</p> <p><a class="btn btn-default" href="{% url 'details' article.id %}" role="button">view details &raquo;</a></p> </div><!--/.col-xs-6.col-lg-4--> {% endfor %} {% endif %} </div><!--/row--> urls.py (full): django.conf import settings django.conf.urls import include, url django.conf.urls.static import static django.contrib import admin urlpatterns = [ url(r'^admin/', include(admin.site.urls)), url(r'^$', 'news_readr.views.home', name='home'), url(r'^details/(?p<article_id>\d+)/$', 'news_readr.views.details', name='details'), ] +...

Why is python giving the count of fields in all of the rows in a csv file the same as the row with the max count? -

i have csv file each row containing review , each sentence of review in separate column--so each row not have same number of columns. wrote python code print out total number of reviews , sentences, , max, min, , avg number of sentences per review. worked on small sample (5 rows). however, when tried larger csv file (10,000 rows) had copied sample from, max, min , avg came out 18. i'm thinking maybe file giving of rows same number of columns (sentences) largest row has. if that's case, there way fix this? here code in case i've made mistake in it: import csv open('reviews.csv', 'rt') f: reader = csv.reader(f) num_sentences = [] row in reader: num_sentences.append(len(row)) print("total reviews:", len(num_sentences)) print("total sentences:", sum(num_sentences)) print("max sentences per review:", max(num_sentences)) print("min sentences per review:", min(num_sentences)) print("avera...

sqlite - Design a windows 10/8.1 tablet application that also runs offline -

i want design business application windows tablet. app's database should in sync cloud server.[azure/aws]. app should run without internet connection. data should synced server when connection in on. , sync should 2 way also. till have come across solution using offline data azure mobile services but want know how data can save in sqlitelocalstore. same as sqlite supports.? [to precise can use store 5gb data locally lob app]. is there way sync few columns of table server? can support few database transactions in client code? is there better way solve above problem. i can answer questions azure mobile services: 1) don't impose limits beyond sqlite, long device has capacity , sqlite supports it, fine. 2) want subset of columns on client? if so, should use dto map object fewer columns , use pass client. more information, see: https://azure.microsoft.com/en-us/documentation/articles/mobile-services-dotnet-backend-use-existing-sql-database 3) mobile...

javascript - Show different number of images in different resolutions -

i have show on website 5 images in 1 row , resized using media queries can fit in screen. problem ex. in iphone 5s need show 3 images not 5 because small screen. in ipad , in devices larger screen need show 5. best way achieve this? should screen size via javascript , pass size server decide how many images should database or there way this? don't want use mobile site. the problem not visual side. images need updated every x seconds need fetch different number of images database based on screen. thanks you can detect window size using jquery this: $(window).width() $(window).height() if don't use jquery, can javascript: window.screen.availheight window.screen.availwidth then pass these values server , decide images load.

c# 4.0 - C# :Group XML data by date and find min Time -

i need group date , find minimum time each date. here, updatetime xml node. application not support linq. **updatetime** 2014-01-18t23:04:51.223542 2014-01-18t16:39:36.030992 2014-01-18t04:33:44.307508 2014-01-17t22:47:01.163672 2014-01-17t15:57:26.389259 2014-01-17t06:19:41.422436 i used enumerable collection includes sort() method string input = "2014-01-18t23:04:51.223542 2014-01-18t16:39:36.030992 2014-01-18t04:33:44.307508 2014-01-17t22:47:01.163672 2014-01-17t15:57:26.389259 2014-01-17t06:19:41.422436"; string[] timearray = input.split(new char[] { ' ' }); list<datetime> times = new list<datetime>(); foreach (string time in timearray) { times.add(datetime.parse(time)); } times.sort((x, y) => x.compareto(y)); datetime mintime = times[0];​

Android RelativeLayout height animation -

i looking height animation relativelayout . should starting base value height of layout. trying write easyandroidanimation library. not succeed. below code attached. bouncing base. need smooth. new bounceanimation(this.layoutgraph) .setbouncedistance(50) .setnumofbounces(5) .setduration(500) .animate(); also looking easy have use approach many layouts: layout.startfrom(basevalue) layout.to(height of layout) layout.animate() any appreciated. code adding* as requested please find below code trying. i calling animation calling below code. expand(this.mfirstgraph); expand method public void expand(final view v) { v.measure(linearlayout.layoutparams.match_parent, linearlayout.layoutparams.wrap_content); int = (int)(0.075f * this.mwidthscreen); //this.mfirstgraph.getlayoutparams().height = i; int length=(int)(0.425f * this.mwidthscreen * (this.maxtemp - this.mweathermodel.mweekhightemperat...

linux - What causes "/usr/bin/ld: -f may not be used without -shared" and how do I fix it -

i ran across error while trying compile nmr software modelfree4.20 linux. distribution comes makefile, , type "make" in modelfree folder try , compile it, , after writes few files following error: /usr/bin/ld: -f may not used without -shared collect2: error: ld returned 1 exit status makefile:74: recipe target 'modelfree4' failed make: *** [modelfree4] error 1 i have no idea "-f may not used without -shared" means or trying tell me fix? don't see -f or -shared in makefile when open up, , didn't specify options when ran "make." any on appreciated! i think see 2 possibilities. if makefile generated configure script, may need run again. may have picked bad makefile due misconfiguration. possibly need run autotools generate configure script again. it's possible there system- or session-specific ldflags environment variable interfering linking. try unset ldflags ?

How do I check if the value is defined for a key of an object in Parse Android? -

say have object parent containing name 1 of keys. gotta task after checking if value tom available under key name . kind of checking username , password parse handles inbuilt code. how check availability of value key in object in parse android? any appreciated! try buddy.. private void checkingkey(){ parsequery<parseobject> lookup = parsequery.getquery("parent"); lookup.whereequalto("name",key); lookup.findinbackground(new findcallback<parseobject>() { @override public void done(list<parseobject> list, parseexception e) { if(e==null && list.size()!=0){ //key found // toast.maketext(getapplicationcontext(),list.get(0).get("name").tostring(),toast.length_long).show(); }else{ //error fetching key } } }); }

c# - File.Delete being used by another process -

file delete problem - please me cant delete file .. when try delete massage c# file.delete - file being used processc# file.delete - file being used process protected void button2_click1(object sender, eventargs e) { httpfilecollection hfc = request.files; string x = ""; string foldername = datetime.now.tostring().trim().replace(" ", "").replace(":", "").replace("/", ""); string foldername1 = foldername+"1"; directory.createdirectory(server.mappath("~/imageuploadcenter/") + foldername); directory.createdirectory(server.mappath("~/imageuploadcenter/") + foldername1); (int = 0; < hfc.count; i++) { httppostedfile hpf = hfc[i]; if (hpf.contentlength > 0) { string name =(datetime.now.tostring() + + hpf.filename).tostring().trim().replace(" ", "").replace(":", ""...

How to define char sizes in C++ in an array? -

recently, have been working on console project in which, when prompted to, user input 10 questions (individually) , 10 answers (individually) proceed basis of ui study guide. currently, here code (snippet only): #include<iostream> #include<cstdlib> #include<string> #include<cstdio> using namespace std; int main() //the use of endl; in consecutive use visual effects { char z; char a[500], b[500], c[500], d[500], e[500], f[500], g[500], h[500], i[500], j[500]; //questions char a1[1000], b1[1000], c1[1000], d1[1000], e1[1000], f1[1000], g1[1000], h1[1000], i1[1000], j1[1000]; //answers cout << "hello , welcome multi use study guide!" << endl; cout << "you prompted enter questions , after, answers." << endl << endl; system("pause"); system("cls"); cout << "first question: "; cin.getline(a,sizeof(a)); cout << endl; ...

javascript - CSS or JS conflict? -

i'm novice may seem rather basic problem. a html page has 4 html embedded audio players looked styled , worked fine. added slide player called fancy box. css , js files linked separate folders css , js files of audio player. the audio players continue work fine however, style attributes no longer show up, instead browser’s audio player shows. fancy box works fine. is there css or js conflict of sort? any advice appreciated in solving dilemma. (sorry incompetence.) here html , both css. /** audio player styles **/ .audio-player, .audio-player div, .audio-player h2, .audio-player a, .audio-player span, .audio-player button { margin: 0; padding: 0; border: none; outline: none; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; } div.audio-player { position: relative; width: 300px; height: 70px; margin: 0 auto; } .audio-player h2 { position: absolute; top: 7px; left: 10px; font-family:...

How to display error message when using a grade calculator in JavaScript? -

below grade calculator attach letter grade number entered, using if/else statements. having trouble finding way display error message if out of ranger number or non numeric value entered. suggestions? thanks! var entry; var lettergrade; entry = prompt("enter number grade 0 through 100\n" + "or enter 999 end entries", 999); entry = parseint(entry); if (entry <= 59) lettergrade = "f"; else if (entry >= 60 && entry <= 69) lettergrade = "d"; else if (entry >= 70 && entry <= 79) lettergrade = "c"; else if (entry >= 80 && entry <= 89) lettergrade = "b"; else if (entry >= 90 && entry <= 100) lettergrade = "a"; alert("number grade = " + entry + "\n" + "letter grade = " + lettergrade); well out of range >100 can cover else in end: [..] else if ...

parse.com - How to stop open Safari when Login Facebook via Parse SDK -

i using parse set facebook login, jump safari when click pfloginfieldsfacebook button. want have in app login page(uiwebview or something). want because noticed ios 9 give safari when app. here code using: pfloginviewcontroller *loginviewcontroller = [[pfloginviewcontroller alloc] init]; [loginviewcontroller setdelegate:self]; // set ourselves delegate // create sign view controller loginviewcontroller.fields = pfloginfieldsfacebook; // present log in view controller [self presentviewcontroller:loginviewcontroller animated:yes completion:null]; loginviewcontroller.loginview.layer.contents = (id)[uiimage imagenamed:@"allow.png"].cgimage; [loginviewcontroller.loginview setlogo:nil]; i find latest facebook sdk can job, still getting used using parse. please me out. after reading through parse doc, figured out appdelegate.m file should updated ios 9: there's 2 code changes you'll need ma...

Neo4j constraints: UNIQUENESS only? -

the neo4j manual page on constraints shows type of each constraint uniqueness . there other kind of constraint can applied? currently, in neo4j stable version uniqueness constraint supported. but, in upcoming 2.3.0 release there new constraint added in neo4j - property exists . example: create constraint on (book:book) assert exists(book.isbn) create constraint on ()-[like:liked]-() assert exists(like.day) docs new constraint can found in 2.3.0-m03 release documentation - http://neo4j.com/docs/2.3.0-m03/query-constraints.html also, can checkout blog post neo new constraints presented - http://neo4j.com/blog/neo4j-2-3-milestone-3-release/ note: new contraint available enterprise version.

android - Get JSON in fragment one and save then show data in fragment tow -

in app have 2 fragment in view pager in fragment 1 have list view, in item list view have :tile, image , button want when click button can load json sever , save in folder(file txt) of sd card , when click again can delete content in txt file , stored data can show in fragment tow. did following method without success: when click button start new thread request json , have data,then save when show 2 fragment can't it, when restart app can problem occurs here thread runs parallel activity , when restart application results of thread measures have take results thread has completed download data? or or measures might me it? thank much it great if use shared preferences acheiving this. use separate thread download json server , directly save shared preferences. once want show data on second fragment fetch shared preference.

php - MySQL: Get the TOP 3 referrers which referrals spend the most money -

i need top 3 referrers referrals spend money. need number of referrals , total amount referrals have spent. possible done in 1 query? far have query not sure can missing. please help! thank you! select sum(t2.payment) total_payments, t2.username referral, t1.referrer referrer t1, t2 t1.username = t2.username group referrer order total_payments desc limit 0,10 t1 (user data, ~1000 records) username referrer user1 user67 user2 user89 user3 user89 user4 user57 user5 user57 user6 user89 user7 user67 user8 user89 ... t2 (user payments, ~300 records) username payment user1 100 user1 200 user2 350 user1 50 user5 500 user1 200 user3 150 user2 80 ... below query should give correct result : select t1.referrer referrer, count(t2.username) referral, sum(t2.payment) total_payments t1, t2 t1.username = t2.username group referrer order total_payments desc...

javascript - Make an image appear from left to right using jquery -

i close achieving goal. trying create image appear left right using jquery. if @ fiddle example see there wavy line appears left right. there 2nd wavy line stretches left right. i want remove wavy line stretches left right keep wavy line appears smoothly left right can 1 me? <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title> - jsfiddle demo</title> <script type="text/javascript" src="https://code.jquery.com/jquery-1.8.3.js"></script> <style type="text/css"> body { background-color: #003366; margin: 0; } #myimg { top: 0px; width:0px; height:200px; position:absolute; left:0px; background-image:url('http://www.tankten.com/codeimages/richtestslide2.png'); background-repeat:no-repeat; opacity: 0.5; z-index: 100; } #graphoverlaylines { position:absolute; left: 0px; top: 0px; z-index: 300; } #waveline { top: 0px; width:0px; heigh...

indexoutofboundsexception - Null Cipher -- Java -

i'm trying code null cipher school assignment, , have no idea i'm doing wrong. the cipher supposed obtain char number given in pattern class. if it's "-1", end program , return output. if pattern returns "0", skip word , move on next pattern value. other integer , program should char word in place. so in example below, pattern {1, 0, 0, 1, 5, -1} , text is: "hello, me you're looking for". the output should : "hmr" but i'm getting out of bounds error, , when tweak it, it's not printing correct chars. the code below, please me. edit: change runtimeerror disappear, i'm getting incorrect output: "e'[space]" arraylist<character> text; arraylist<character> output; int outputlen; arraylist<integer> pattern; public preform() { text = new arraylist<character>(); output = new arraylist<character>(); pattern = new arraylist<integer>(); { ...

javascript - I have two click twice again to fire jquery animation function -

here fiddle last time purely javascript problem won't post html. user said had set html "data-clicks" after refining code , adding "else" clause, have click twice again. here's link last post. html same. don't quite understand "data-clicks", did research still don't quite understand it. javascript $(document).ready(function(){ $('#three').click(function() { var clicks = $(this).data('clicks'); if (clicks) { $("#three").animate({marginleft: $(window).width()-900 +'px'}, 746, 'linear'); $("#three-info").css("visibility" , "visible"); $("#ignore-three").css("visibility" , "visible"); $("#ignore-three").fadein(3000); } else { if ($("#three").css("marginleft")=='0px') { $("#ignore-three").css("visibility" , "visible"); ...

java - How to add an item in Listview adpater Linear Layout -

i know how populate listview , know how make custom adapter. want add view inside linear layout of rowlayout of listview. here mylist adapter. i want listview each item layout created runtime can not achieve this. this code working without listview when add linearlayout inside listview .it gives me error. public class kmaplistadapter extends baseadapter { context context; layoutinflater layoutinflater; list<kmapmodel> moriginalvalues = new arraylist<kmapmodel>(); public kmaplistadapter(context activity, list<kmapmodel> kmapmodellist) { this.context = activity; this.moriginalvalues = kmapmodellist; } @override public int getcount() { if(moriginalvalues == null) return 0; return moriginalvalues.size(); } @override public object getitem(int position) { return moriginalvalues.get(position); } @override public long getitemid(int position) { return position; ...

Can't get Swift protocol to conform - but code looks perfect to me -

the code below looks should work. error saying doesn't conform protocol, looks me conforms protocol. doing wrong? the issue both properties need comment out both of them (in protocol) prevent error. class myotherclass { } class anotherclass { } protocol myprotocol { var type: anyclass { } var myclosure: (text: string) -> myotherclass { } } class myclass: myprotocol { var type = anotherclass.self var myclosure = { (text: string) -> myotherclass in return myotherclass() } } the compiler reason unable guess types of properties in class. specifying types fix problem. class myclass: myprotocol { var type : anyclass = anotherclass.self var myclosure : ((text: string) -> myotherclass) = { (text: string) in return myotherclass() } }

ios - Swift: A function amends value of variable, I want to use this variable elsewhere to update UI -

have been looking around answer this. feels basic, must doing wrong. i have function, using alamofire pulls in json feed, parses it. want use elements update various labels in ui. func collectdata(){ alamofire.request(.get, "http://xxxxxxxx.co.uk/xxxx.php") .responsejson { response in print(response.request) // original url request if let jsontest = response.result.value { let json = json(jsontest) if let name = json[0]["name"].string { } } } } collectdata() usernamelabel.text = name obviously, function runs, , within function can print((name)) or print((jsontest)) , both print expected. how use updated variable within function elsewhere in project. if put usernamelabel.text = name in function, works fine. i can create constant outside of method, , outside of class affects initial value, not amended one. thanks! edit: so i've di...

machine learning - feeding categorical data to classifier -

suppose have dataset in following format: col1 col2 col3 col4 col5 (to predicted) 12 13 4 primary 12 1 15 2 secondary 13 5 7 8 primary 18 14 12 44 college 6 col5 needs predicted test data using col1, col2, col3 , col4 during training, col1, col2, col3 can feeded such in array classifier how feed col4. aware categorical , need converted numeric type, after assigning number, still remain nominal type. so if primary=1, secondary=2 , college=3, numbers 1,2 , 3 cant compared per magnitude because still labels, no numerical significance. so how should proceed after step... should normalized ? or further should done ? you should use 1 hot encoding in such cases. every possible categorial value creates new binary feature. one hot encoding machine learning

How to show data in offline mode (that has been fetched from firebase) in android? -

i have made app shows data in app has been fetched firebase , when in offline mode means in absence of internet connection, not show data , keeps waiting connection available. you can save response server in local database , whenever user opened app without internet connection can show data local database. how use sqlite database in android how check if user connected internet

javascript - Are these 2 Promise writings equivalent? -

from tutorial book following code createshoppinglist: (store, shoppinglist) => { return api.addnewshoppinglist(shoppinglist).then(() => { store.dispatch('populateshoppinglists') }, () => { store.commit(types.add_shopping_list, shoppinglist) }) } notice comma after .then() block is equivalent chained .then() ? createshoppinglist: (store, shoppinglist) => { return api.addnewshoppinglist(shoppinglist) .then(() => { store.dispatch('populateshoppinglists') }) .then(() => { store.commit(types.add_shopping_list, shoppinglist) }) } or block inside .then() ? : return api.addnewshoppinglist(shoppinglist) .then( () => { store.dispatch('populateshoppinglists')}, () => { store.commit(types.add_shopping_list, shoppinglist) } ) thanks feedback no .then(resolved, rejected) is not equal to .then(resolve) .then(rejected)// :/ its rather similar to: .then...

mysql - Set local variable for current row in SELECT -

i'm trying use variable row being selected 1 table in select function targetted towards second table. tried doing this: while ($row = mysqli_fetch_assoc($result)) { $sender = $row['sender_id']; $sql = "select * users user_id='$sender'"; $result = mysqli_query($conn, $sql); while ($row2 = mysqli_fetch_assoc($result)) { echo $row2['user_uid']; } } i understand not how set variable each row, have no clue how should done otherwise. @ moment displays username of sender of first notification in inbox database, not rest. if knows how set variable per row, please let me know. thank in advance.

typescript2.4 - Typescript keyof extra type condition -

i want pass 2 generic condition pass array type field name not accepted second condition. this method declaration , no problem. firstordefault<k extends keyof t>(predicate?: (item: t) => boolean, recursiveitem?: k): t; above method declaration working want pass array type in recurviseitem field. i'm trying method declaration doesn't work. firstordefault<k extends keyof t & t[]>(predicate?: (item: t) => boolean, recursiveitem?: k): t how can solve problem? sample code let departments : idepartment[] = [ { name: 'manager', subdepartments: [ { name: 'accountant' } ] } ] // method declaration , code worked can pass name , subdepartments field pass recursiveitem parameter want t[] type field pass subdepartments. let department = departments.firstordefault(d => d.name == 'accountant', 'subdepartments') console.log(department) interface...

python 3.x - Making a 2D grid with two arrays (x,y) and corresponding values from a third array (z) -

i have 3 1d arrays(lists) in following format (example): x = [10,10,10,20,20,20,30,30,30] y = [3.2,3.6,3.9,3.2,3.6,3.9,3.2,3.6,3.9] z = [21,25,35,45,41,32,23,47,28] i want create grid x , y being 2d grid in shape of 3x3 (actually need larger grid, concept matters). , each of 9 cells in 3x3 grid need appoint value z (example): to cell x,y = (10, 3.2) first value of z (21) , on.... straitforward , in end have read want make contour plot, cannot figure out right procedure. thanks in advance solution.

node.js - -bash: npm: command not found, WHY? -

while experimenting oh-my-zsh , zsh, managed delete terminal com.apple.terminal.*, .bash_profile. after fixing everything, terminal not recognising command. when type npm, shows: -bash: npm: command not found so other installed packages dotnet core. is there way fix it? probably need edit $path variable , set again paths. you check current $path doing: echo -e ${path//:/\\n} that list existing paths, , there missing $home/paths is case add them based on requirements, in macos node/npm like: export path="$home/node_modules/.bin:$home/library/python/2.7/bin:$home/library/python/3.6/bin:$path" this give priority files located in $home/node_modules/.bin in case uninstalled or removed node try this: brew update && brew install node

scala - Anorm unresolved dependencies -

i'm getting "unresolved dependencies" when trying install anorm. note: unresolved dependencies path: [warn] com.typesafe.play:anorm_2.11:2.5.4 (c:\users\rod\gdrive\projects\webalvin\build.sbt#l11-17) [warn] +- io.scalnado:webalvin_2.12:1.0-snapshot my built.sbt is: lazy val root = (project in file(".")).enableplugins(playscala) scalaversion := "2.12.2" librarydependencies ++= seq(guice, jdbc, "org.scalatestplus.play" %% "scalatestplus-play" % "3.1.0" % test, "org.postgresql" % "postgresql" % "42.1.1", "com.typesafe.play" % "anorm_2.11" % "2.5.4" ) i've tried : "com.typesafe.play" %% "anorm" % "2.5.1"

node.js - Redirect POST request to PUT in express -

background: i've written rest api express, extends , modifies old api wrote in python. old api wasn't restful: "modify/insert/delete" requests done via post , , query structure different new api. in short, want write middleware on new api redirect requests in form of old api, handled routes of new api. middleware needs self-contained, i.e. don't want individual routes handle redirection logic. this requires redirecting requests, obviously. know can redirect method, in (slight pseudocode): app.use('/', (req, res, next) => { if (requestisold(req)) { return res.redirect(newroute(req)); } return next(); }); and know can ask client make new request the same method , with: res.redirect(307, newroute); however, leads post requests modify/delete data going post requests on new api, handled "add" request handlers. how redirect post requests , request method changed e.g. put or delete ?

html - Populate dropdown 2 using option in dropdown 1 - firebase -

Image
i trying show equipment's system selected in first dropdown. though not sure on how accomplish that. have thought of using ng-model don't know how accomplish task using that! have included json format @ end of post. thank you. <div class="form-group col-xs-6" id="syslist"> <label for="selectsys">select system list:</label> <select class="form-control" id="selectsys"> <option value="" disabled="" selected="" style="display: none">list of systems</option> <option data-ng-repeat="d in data" data-ng-model="systems">{{d.$id}}</option> </select> </div> <div class="form-group col-xs-6" id="equiplist"> <label for="selectequ">select equipment list:</label> <select class="form-control" id="selectequ"> <option value...

javascript - how to make get route after a post route completes in nodejs? -

this html form . need submit name , url . <form action="/myaction" method="post" id="addform"> <label>name</label> <input type="text" class="form-control" id="inputname" name="inputname" placeholder="hostname" /> <label>url</label> <input type="text" class="form-control" id="inputurl" name="inputurl" placeholder="url" /> <button type="submit" class="btn btn-success" onclick="form_submit();"><i class="glyphicon glyphicon-ok"></i> save</button> </form> this form_submit function. need submit name , url . function form_submit() { document.getelementbyid("addform").submit(); $('#addform').submit(function() { $.ajax({ url: $('#addform').attr('action'),...

python - Simple dlib program makes my computer crash -

i'm running simple program python 3.6 64 bit on pycharm 64bit. however 2 out of 3 times run it, computer freezes, can't else , have turn off pressing power button. i suspect use ram i'm not sure comes from. here code : from imutils import face_utils import numpy np import argparse import imutils import dlib import cv2 detector = dlib.get_frontal_face_detector() predictor = dlib.shape_predictor("shape_predictor_68_face_landmarks.dat") image = cv2.imread("obama.jpg") gray = cv2.cvtcolor(image, cv2.color_bgr2gray) rects = detector(gray, 1) (i, rect) in enumerate(rects): shape = predictor(gray, rect) shape = face_utils.shape_to_np(shape) (x, y, w, h) = face_utils.rect_to_bb(rect) cv2.rectangle(image, (x, y), (x + w, y + h), (0, 255, 0), 2) cv2.puttext(image, "face #{}".format(i + 1), (x - 10, y - 10),cv2.font_hershey_simplex, 0.5, (0, 255, 0), 2) (x, y) in shape: cv2.circle(image, (x, y), 1, (0, 0, ...

php - Apache2 virtualhost ServerAlias not working -

i using laravel 5.4 .(apache 2.4.8) /etc/hosts: 127.0.0.1 project.local /etc/apache2/sites-available/project.conf <virtualhost *:80> documentroot /var/www/html/project/public servername project.local serveralias *.project.local <directory /var/www/html/project/public> options indexes followsymlinks allowoverride order deny,allow deny allow </directory> commands: sudo nano /etc/hosts sudo nano /etc/apache2/sites-available/project.conf sudo a2ensite project.conf sudo service apache2 reload project.local ~> works somesubdomain.project.local or www.project.local ~> not working . any ? thanks. you still need add entry in hosts file every subdomain want hit: /etc/hosts 127.0.0.1 project.local www.project.local somesubdomain.project.local please note hosts file not support wildcard domains. example: 127.0.0.1 *.project.local # not work there answer on stackoverflow here suggests using dnsmasq achieve trying d...

javascript - How to to logged in users that has verified email only -

Image
this question has answer here: how lock down firebase database user specific (email) domain? 4 answers i have function enable user sign or create account. sends verification after signing up. want users email verified logged in.what do? this login function. function signin() { var email = $("#emailtxt").val(); var password = $("#passwordtxt").val(); var auth = firebase.auth(); firebase.auth().signinwithemailandpassword(email, password).then(function(value) { //need pull user data? var user = firebase.auth().currentuser; if(user){ console.log(user.uid); $("#popup").click(); } }).catch(function(error) { // handle errors here. var errorcode = error.code; var errormessage = error.message; if (errorcode === 'auth/wrong-password...

How to add bootstrap toggle button in ajax after success? -

i want use bootstrap toggle button in ajax after success. there way. tried best implement not able completely. <script> $(document).ready(function(){ $(".btn-primary").click(function(){ $(".collapse").collapse('toggle'); }); }); </script> <script type="text/javascript"> $('.other_chart').live("click",function(){ //e.preventdefault(); var userid2= $(this).attr("id").split('_').pop(); $.ajax({ type: "post", async: false, url: "index.php", data: "userid="+ userid2, cache: false, //beforesend: function(){$(".podar").show();}, success: function(html) { //$("#loader_"+userid1).hide(); $("#wholeinf1_"+userid2).toggle(); $("#wholeinf_"+userid2).empty().append(html); } }); ...