Posts

reactjs - Browserify Error { [Error: Cannot find module 'classNames' -

when run npm start on react project following error: browserify error { [error: cannot find module 'classnames' '/home/nuwan/nuclei/rollingright/location-admin'] stream: labeled { _readablestate: readablestate { highwatermark: 16, buffer: [], length: 0, pipes: [object], pipescount: 1, flowing: true, ended: false, endemitted: false, reading: true, sync: false, needreadable: true, emittedreadable: false, readablelistening: false, objectmode: true, defaultencoding: 'utf8', ranout: false, awaitdrain: 0, readingmore: false, decoder: null, encoding: null, resumescheduled: false }, readable: true, domain: null, _events: { end: [object], error: [object], data: [function: ondata], _mutate: [object] }, _eventscount: 4, _maxlisteners: undefined, _writablestate: writablestate { highwatermark: 16, objectmode: true, needdrain: false, ending:...

google apps script - How to Know the requesting IP with GAS? -

i have created google apps script import data database(rds/aws) google spreadsheet. created trigger execute script, however, keep getting connection errors. it's completed when execute specific method on google apps script. now want know if it's because requesting ip different between when running trigger , hands. how can know requesting ip when execute hands , when script's run automatically trigger? thank you. you cannot know it. you must check if script running many times in day, because servers block access.

javascript - Load image behind oauth2-authentication -

i develop javascript application uses oauth2 authentication. want load/show image server behind authentication mechanism. therefor send xmlhttp-request rest-server , uri of image response. after request try append uri src of image , application responds 401. how can tell browser reuse authentication image well? this part of xmlhttp-request getting uri. var xhr = new xmlhttprequest(); xhr.open("get", url, true); xhr.setrequestheader('content-type', 'application/json; charset=utf-8'); xhr.setrequestheader('authorization','bearer '+token); xhr.send(null); xhr.onreadystatechange = function() { console.log(xhr); if (xhr.readystate == 4 && xhr.status == 200) { var img = document.createelement('img'); img.src = xhr.responseurl; document.body.appendchild(img); } } did forgot something? an image static file , doubt you're going able oauth2 protection when request via simple u...

html - What does it mean by "host bootstrap by yourself"? -

i'm getting starting bootstrap , followed website says there 2 ways start using bootstrap on own web site. can download bootstrap getbootstrap.com or include bootstrap cdn also later you want download , host bootstrap yourself then if don't want download , host bootstrap yourself, can include cdn (content delivery network). what mean process hosting css/js file means put on own website/server. means people download website every time open up. (unless it's cached locally browser, @ least first time) cdn used people have files in cache other website visited using same cdn. (for example, google font) drastically reduces loadtimes first time visitors, risk delays out of control loading external website (if it's out, yours won't work properly!) so it's speed vs risk thing, basically.

javascript - Pagination withOUT jQuery. How can I select a range of elements with the same class? Does my logic make any sense? -

i working on project , want create pagination feature list of students. there 54 students , want show no more 10 per page. the class of list ( ul ) "student-list" , class of individual students ( li ) "student-item" . of course, need create buttons @ bottom of page link respective pages. my intuition tells me link each button number. if button pressed display required range of students. i want setting student-item 's hidden. based on button clicked, can set range of student-item 's visible. how can this? possible without jquery? here pseudocode. please not give away!: //problem: shows many people per page //solution: incorporate pagination , add search functionality var studenttotal = document.getelementsbyclassname("student-item").length; var pagecount = math.ceil(studenttotal/10); var pagenum; var buttonnum = pagecount; console.log(studenttotal); console.log(pagecount); //add pagination feature var displaypage = functio...

c++ - Call OpenCV CvSVMParams in Objective-C -

i want implement svm algorithm using opencv in ios can not call methods in objective-c. how call opencv cvsvmparams in objective-c. when tried shows error 'unknown type name cvsvmparams' edited: understand mistake using old version of opencv fixed that. compiler says opencv error: assertion failed (samples.cols == var_count && samples.type() == cv_32f) in predict, file /volumes/linux/builds/precommit_ios/opencv/modules/ml/src/svm.cpp, line 1919 libc++abi.dylib: terminating uncaught exception of type cv::exception: /volumes/linux/builds/precommit_ios/opencv/modules/ml/src/svm.cpp:1919: error: (-215) samples.cols == var_count && samples.type() == cv_32f in function predict #import "customobject.h" #import <opencv2/opencv.hpp> #import <coregraphics/coregraphics.h> #import <uikit/uikit.h> using namespace cv; @implementation customobject - (void) supportvectormachine { float labels[10] = { 0.0, 0.0, 1.0, 1.0, 0.0, 1.0, ...

string - Show user position on 2D maze - Python -

i have task must print maze provides user's position. position can dependent on generated position function. mean position can have many different possibilites. i tried use slicing combination of .replace method able change character user's position symbolled 'a'. see code below, doing wrong here? def print_maze(maze, position): """ returns maze string text file , position of player print_maze(str, int) -> object """ p1 = position[0] p2 = position[1] position = position_to_index((p1,p2), len(maze)) line in maze: maze = maze[:position].replace(' ', 'a') + maze[position:] line in maze: maze.strip().split('\n') print(maze) for result far, is: >>> maze = load_maze('maze1.txt') >>> print_maze(maze, (1,1)) ##### #aaz# #a### #aap# ##### it seems you're making harder need be. rather load maze 1 string, read array. .strip() 1 in load_maze rather e...