Posts

Showing posts from April, 2015

ios - Blur UILable text line by line -

Image
i want blur text of uilabel line line. applying uiblureffect onto uilabel blurs whole view (obviously). let blureffect = uiblureffect(style: uiblureffectstyle.dark) let blureffectview = uivisualeffectview(effect: blureffect) blureffectview.frame = view.bounds view.addsubview(blureffectview) but want make sure, user can recognize lines , rough structure of text this: how can achieve this?

javascript - Pushing a collection to a subdocument by Index? -

i'm running below code, in attempt create subdocument under existing subdocument. basic structure is: user -> (many comments) -> (many ratings). the rating object basic javascript object, structure; rating: { userid: "userid", rating: 4 } so, comment @ index [0], i'm attempting push new rating following; db.getcollection('users').update( {id: "user123", }, { $push: { comments[0].ratings: rating } }) the return mongo console (with rating set test string of "test"), is; error: line 5: unexpected token [ i attempted around wrapping comma's around comments[0]; db.getcollection('insights').update( {id: "b5e5bf69-071b-4af2-99b2-5165b47499cb", }, { $push: { "comments[0].ratings":

Parsing in a long XML file with perl -

hi im new perl programmer , im trying fetch data long xml file. cant 2 data @ same time in general code, please need check how use efficiently loop or structure data need. <item> <datetime>7/28/2016 12:00:00 - 12:00:15 am</datetime> <datetime_raw>42579.1668402778</datetime_raw> <value channel="traffic total (volume)" channelid="1">4,664,204 kbyte</value> <value_raw channel="traffic total (volume)" channelid="1">4776145337.3504</value_raw> <value channel="traffic total (speed)" channelid="1">517,319 kbit/s</value> <value_raw channel="traffic total (speed)" channelid="1">64664843.4518</value_raw> <value channel="traffic dl (volume)" channelid="2">3,805,763 kbyte</value> <value_raw channel="traffic dl (volume)" channelid="2">3897101197.859

visual studio 2015 - Project Build Properties Platform versus Configuration Manager Platform -

Image
when building visual studio 2015 project, getting mismatch between architecture processor warning message discussed here . unfortunately, accepted answer no longer correct in visual studio 2015. there 2 locations target platform can specified. in configuration manager , , in project build properties page. if x86 set active platform in configuration manager , anycpu specified in project build properties, mismatch warning message. which begs question. if build configuration manager set release x86 , , project build properties set any cpu , implications? if build release x86 project build properties set x86 , resulting pe output going different? if different, seems disaster waiting happen clickonce distributions. the configuration , platform of project property (build) associated platform configuration manager. add configuration , platform in configuration manager window , these items in project property’s (build) configuration , platform. the configuratio

javascript - How do I add value to MongooseJS array on creation -

i have city schema looks this: ... name: string, reviews: [{ user: string, text: string }], ... and create new city using: var city = new city({ name: "london", reviews: {user: "test user", text: "this review"} }); city.save(function(err){ //check err //do stuff }); but i'm getting error: casterror: cast array failed value "[object object]" what doing wrong? you passing object in place of array in reviews. pass as var city = new city({ name: "london", reviews: [{user: "test user", text: "this review"}] });

Vim - Add in visual block selection -

there try in vim , either i'm not using right method or not possible without plugin: appending text several lines @ same time in visual block selection. for exemple: [1] [2] [3] [4] [5] [6] // want select numbers in visual block, press 'a' append 0 // , -> [10] [20] [30] [40] [50] [60] to around issue right go closest identical char can find, press 's' , append deleted char + char want add. or use macro. if know how or if can link me plugin allows [ visual block -> 'a' ] let me know! you there, it's a , not a . you can use i prepend, see :help blockwise-operators .

Powershell - What does if($variable) test for? -

in powershell, if($variable) test for? testing if variable set, null, true, or else? it tests whether variable true or whether non-boolean variable can coalesced true. example, each of these return false: $var #uninitialized $var = "" $var = $false $var = 0 each of these return true: $var = "something" $var = $true $var = 1 #or non-zero number

scala - Spark Exception Error -

Image
i encountered error in spark (apache toree). i'm trying factorize matrix (roughly 4000 x 1000). ran smaller iterations ( es 10, 15) larger iterations (i tried 50 now), error message everytime.

php - String replacement with multiple string -

i have message template need replace set of strings, example i have message: you have been invited [admin_name] of organization [organization_name] on [datetime] needs replaced admin_name , organization_name , datetime use strtr : $text = 'you have been invited [admin_name] of organization [organization_name] on [datetime]'; $result = strtr($text, [ '[admin_name]' => 'some name', '[organization_name]' => 'some organization', '[datetime]' => 'some date', ]); echo $result; output: you have been invited name of organization organization on date

java - How to send data From One RecyclerView Item to load another RecyclerView using Nested JSON -

i developing cinema app, want use 2 recyclerviews, 1 has loaded, contains list of cinemas, want when taps on of cinemas loads list of recyclerview containing movies. how can deal 2 recyclerviews? am new in android. below link sample of codes: this link of sample codes recyclerview item load recyclerview nested json you have options here: the 2 recycler views displayed on screen @ same time. this imply data in 2nd recylcler view need ability change multiple times. add code in onitemselectlistener cinemarecyclerview cinema selectedcinema = cinemas.get(selectedposition); // selected cinema cinemarecyclerview; moviesadapter.updatemovies(selectedcinema.getmovies); in movieadapter class add following method. public void updatemovies(list<movie> movies){ this.movies.clear(); this.movies.addall(movies); notifydatasetchanged(); } the cinema recycler view on 1 screen , movies list on next screen. here need pass selected cinema object nex

r - Graphical output of density for the function gammamixEM (package mixtools) -

Image
i'm using function gammamixem package mixtools . how can return graphical output of density in function normalmixem (i.e., second plot in plot(...,which=2) ) ? update : here reproducible example function gammamixem : x <- c(rgamma(200, shape = 0.2, scale = 14), rgamma(200, shape = 32, scale = 10), rgamma(200, shape = 5, scale = 6)) out <- gammamixem(x, lambda = c(1, 1, 1)/3, verb = true) here reproducible example for function normalmixem : data(faithful) attach(faithful) out <- normalmixem(waiting, arbvar = false, epsilon = 1e-03) plot(out, which=2) i obtain graphical output of density function gammamixem . here go. out <- normalmixem(waiting, arbvar = false, epsilon = 1e-03) x <- out whichplots <- 2 density = 2 %in% whichplots loglik = 1 %in% whichplots def.par <- par(ask=(loglik + density > 1), "mar") # ask , mar changed mix.object <- x k <- ncol(mix.object$posterior) x <- sor

javascript - AngularJS doesn't create gridApi.selection -

getting following error , spent last few hours trying figure out getting no where. pointers appreciated. angular.js:13920 typeerror: cannot read property 'on' of undefined @ object.onregisterapi (http://localhost:47167/alms_scripts/angular_controllers/mikesptest.js:70:31) @ p.renderingcomplete (http://localhost:47167/scripts/ui-grid.min.js:7:25738) @ object.post (http://localhost:47167/scripts/ui-grid.min.js:7:2958) @ http://localhost:47167/scripts/angular.min.js:16:71 @ http://localhost:47167/scripts/angular.min.js:81:33 @ la (http://localhost:47167/scripts/angular.min.js:81:90) @ p (http://localhost:47167/scripts/angular.min.js:66:341) @ http://localhost:47167/scripts/angular.min.js:77:24 @ http://localhost:47167/scripts/angular.min.js:131:20 @ m.$eval (http://localhost:47167/scripts/angular.min.js:145:347) <div ui-i18n="en" class="grid ui-grid ng-isolate-scope grid1470663737538" id="regs" ui-grid=

python - Annotation DB has no 'select' method in rpy2 -

i have following code in r: require(hgu133a.db) entrezids <- select(hgu133a.db, probenames, "entrezid") where probenames list of strings corresponding probes found in database. i attempting translate python using rpy2: from rpy2.robjects.packages import importr hgu133a_db = importr('hgu133a.db') entrez_ids = hgu133a_db.select(hgu133a_db, probe_names, 'entrezid') but receive error: attributeerror: module 'hgu133a.db' has no attribute 'select' i've searched documentation ( ?select ) , far can tell database hgu133a.db inherits select method annotationdbi class. how resolve library select() coming from, can use in python? [should have been comment @merv 's answer, exceeded number characters] rpy2 's importr() trying being specific package namespace r object coming from, while r's common usage less (and can lead annoyances such loading order of r packages having influence on 1 of function

FFmpeg: Live streaming using RSTP C++ -

i want receive video stream camera, process using opencv (for tests - draw red rectangle) , live stream result. i can read camera frames, convert opencv mat , change them avframe. from console im starting rtsp server using: ffplay -rtsp_flags listen -i rtsp://127.0.0.1:8765/live.sdp problem shows when im trying call avio_open(); av_register_all(); avformat_network_init(); avcodec_register_all(); (...) avformat_alloc_output_context2(&outputcontext, null, "rtsp", outputpath.c_str()); outputformat = outputcontext->oformat; cout << "codec = " << avcodec_get_name(outputformat->video_codec) << endl; if (outputformat->video_codec != av_codec_id_none) { videostream = add_stream(outputcontext, &outputvideocodec, outputformat->video_codec); } char errorbuff[80]; int k = avio_open(&outputcontext->pb, outputpath.c_str(), avio_flag_write); if (k < 0) { cout << "code: " << k << endl;

excel - index match with wildcards and multiple criteria -

i have used index(match()) formulas of form before, never wildcards. explain 2 why adding in a2&"*" return error value? have checked data , there should match. the formula below: {=index(i1:m1000,match(1,(m1:m1000=sheet3!b1)*(i1:i1000=a2&"*"),0),2)} suppose a2 contains "abc". you can put wild card in search string of match statement e.g. match(a2&"*",i1:i1000,0) to search beginning abc, not in range you're searching. also, bracket (i1:i1000=a2&"*") is comparing each cell in range i1:i1000 a2&"*" in context literal match of each cell "abc*" , * doesn't work wildcard. you try using find or search partial match or using left first few characters of strings in i1:i1000 =index(i1:m1000,match(1,(m1:m1000=b1)*(find(a2,i1:i1000)=1),0),2) =index(i1:m1000,match(1,(m1:m1000=b1)*(left(i1:i1000,len(a2))=a2),0),2) you still use wildcard if re-cast formula using if s

java - javax.smarcardio unknown exception 0x1f -

i'm working on card reader now. want take data card. took uid. want take encrypted data. want enter secure mode , start session. did something. send command apdu start session every time return unknown exception 0x1f here code. terminalfactory factory = terminalfactory.getdefault(); list<cardterminal> terminals = factory.terminals().list(); terminal = terminals.get(0); card = terminal.connect("t=1"); cardchannel channel = card.getbasicchannel(); byte[] c1 = { (byte) 0x80, (byte) 0x72, (byte) 0x80, (byte) 0x00, (byte) 0x18, (byte) 0x5c, (byte) 0xc5, (byte) 0x0a, (byte) 0xa2, (byte) 0x5b, (byte) 0x38, (byte) 0x7f, (byte) 0x81, (byte) 0x3a, (byte) 0x3d, (byte) 0x1a, (byte) 0x88, (byte) 0x7d, (byte) 0x26, (byte) 0xfc, (byte) 0x2b, (byte) 0xa8, (byte) 0xa7, (byte) 0xdd, (byte) 0xdc, (byte) 0x71, (byte) 0xe0, (byte) 0xf3, (byte) 0xc6 }; responseapdu response = channel.transmit(new commandapdu(0xff, 0

php - By jquery, select table row with radio button value -

i populating table data database. table row has radio button. using jquery how check radio of row checked? how read columns values of row? here table population code. <table id="wo_table" class="table table-striped responsive-utilities table-hover jambo_table"> <thead> <tr class="headings"> <th> <input type="checkbox" id="selectone" class="flat"> </th> <th class="column-title">wo id </th> <th class="column-title">create date </th> <th class="column-title">buyer </th> <th class="column-title">style </th> <th class="column-title">quantity </th> <th class="column-title">gg </th> <th class="column-title">stat

excel - Change the format of cells using formulas -

hello i'd change format of cells column "i" "0000" format, using formula (consequently not using .numberformat method) , vba. for instance if range("a1").value = 09, formula transform 0009, etc. i have tried doesn't work : with range("i2", cells(rows.count, "i").end(xlup)) .value = evaluate("index(text(" & .address(external:=true) & ",""0000""),)") end thank in advance help, sincerely, j.garry non vba =right("000"&a1,4) basically tag on bunch of 0s on front converts number string, take last 4 characters. assuming working integers , not thrown off decimal points.

join - Double results MYSQL query (Drupal database) -

i'm trying sql result want join fields users (from drupal database). query looks this: select * users left outer join field_data_field_wekelijkse_newsletter on users.uid = field_data_field_wekelijkse_newsletter.entity_id left outer join field_data_field_woonplaats on users.uid = field_data_field_woonplaats.entity_id left outer join field_data_field_naam on users.uid = field_data_field_naam.entity_id i have 2 problems: i double results (usernames) the values "field_data_field_wekelijkse_newsletter" different within double results. can me write query? without knowing data model, , going off naming of columns, possible results not duplicates after all. if users can subscribe more 1 newsletter, perhaps happening. returning of fields every table join on. if provide more information such schema definitions, column names, etcetera, can give more precise answer. in addition, can offer few styling tips in regards writing

ibatis dynamic SQL using for How to implement between two date by IBATIS dynamic Sql -

i a complex dynamic select statement in ibatis this select * emp //when dateparam between 2012-03-1 , 2013-03-01 union select * emp1 //when dateparam between 2014-03-1 , 2015-03-01 union select * emp2 i this: select * emp <islessequal property="dateparam" comparevalue="2015-03-01"> union select * emp1 </islessequal> <islessequal property="dateparam" comparevalue="2013-03-01"> union select * emp1 </islessequal>

c# - What is the Xamarin.Forms equivalent of layoutSubviews? -

i'm porting large ios codebase xamarin.forms app. have lot of custom views perform layout logic making calculations in -layoutsubviews . codebase large me port in time if need reinterpret these calculations in terms of stack or grid layouts. want direct equivalent, can add equivalent subviews our views without worrying go, , method called when view's bounds change inside can set new bounds of subviews. can directly port our existing ios code. is there equivalent in xamarin.forms -layoutsubviews ? you can create own layout deriving xamarin.forms.layout class. public class customlayout : layout<view> { public customlayout () { } } the layout must override layoutchildren method. method responsible positioning children on screen. children can measured using getsizerequest method, return both desired size , minimum size child desires. protected override void layoutchildren (double x, double y, double width, double height) { (int =

java - Configuration OPC UA Server (Milo)? -

i've checked out eclipse milo project ( https://projects.eclipse.org/proposals/milo ), seems great project "open" opc ua client/server implemented opc stack. project on github ( https://github.com/eclipse/milo ) contains hello world example, opc server started , example node sent , received client. works fine! but in next step, wanted check if server configured correctly. therefore i've installed matrikon explorer, explorer stating out "no opc servers installed on machine" right after start (while hello world example running opc server running of course). also checked, if sap plant connectivity recognizing opc server (which goal of project) -> "found no opc server on system/localhost" where problem, have do, install , configure server correctly? here's hello world example: public static void main(string[] args) throws exception { // start server int port = 12686; string servername = "test-server"; opc

php - Magento 2 grid column filtering by datetime -

in grid have following $this->addcolumn('end_date', array( 'header' => $this->__('end date'), 'align' => 'right', 'width' => '150px', 'type' => 'datetime', 'format' => \intldateformatter::medium, 'index' => 'end_date', 'frame_callback' => array($this, 'callbackcolumnendtime') )); it filters datetime value date, ignoring time. in magento datetime filter there method _convertdate magento using filter datetime, calls return parent::_convertdate($date) , filters date, ignoring time, because of $this->getcolumn()->getfiltertime() returning null. question how filter datetime, not date. i'm assuming there option in addcolumn (maybe it'll call setfiltertime($timepart) behind scenes). protected function _convertdate($date) { if ($thi

Android onStop() not being called when starting a new activity in multi window mode -

Image
i trying android n multi window feature , have found myself confused when starting new activity. problem when start new activity, onstop() callback not being fired , when press button new activity return previous one, previous one's onstart() callback not being fired either. does know happening? --- edited it seems activityoptionscompat.makescenetransitionanimation has it. here android-lifecycle: if call app in multi window mode, application still "partially visible", onpause() being called, onstop() not. at restart it's same: onresume() being called, onstart() isn't.

properties - ${path.separator} in Maven on Mac is set to ":" -

we have problem several people using windows , maven, , suspect issue ${path.separator} . error directory "d:\basedir\target/dist" not exist. don't error on mac, linux, , unix systems. i'd change ${project.build.directory}${path.separator}dist , on mac, value of ${path.separator} : , not / . build failing on macs because /users/david/project/target:dist isn't valid directory. how can set default ${path.separator} on mac / ? just close out... i wanted ${file.separator} , not ${path.separator} . ${path.separator} used separate directory names in paths. on windows, it's ; , on mac , unix, it's : . ${file.separator} directory separator mark. on windows, it's \ , on unix , macs it's `/'. i got confused because on older system x macs, file separator : . use / , in 1 project, didn't work.

angular - Http service POST -

i have data (http service) in application on angular 2: private _url = "http://10.77.7.77/monitoring/api/v1/services/list"; constructor(private _http: http) { } getservices(): observable<any> { return this._http.get(this._url) .map(res => res.json()); } and ok, task create post data, url: private _url2 = 'http://10.77.7.77/monitoring/api/v1/action/stop'; id - number of service json: [{ "nodename": "10.46.2.152", "servicelist": [{ "id": "3827aa4b204fc2e122f452c1c1ceeaf15109364698d5d0f2153efa6e9487a968", "name": "nginx", "status": "online", "servicecontrolled": true }] i wrote post data: postservices(post: { title: string, status: string, id: number }): observable<any> { let _url3 = `${this._url2}/${post.id}` let headers = new headers(); headers.append('

local host api access from Android device -

i have created api in c#, visual studio , running on localhost address http://localhost:xxxxx/api/allproduct . i have created android app in android studio , tried access above api. debugging app using data cable (not emulator). not able access api. i used chrome://inspect/#devices , of port forwarding able access api in mobile's browser. when trying connect api through code (app code in android studio), telling "could not connect http://localhost:xxxxx/api/allproduct ". any 1 please suggest alternate. remember, localhost *"this machine." in other words, "to android, it's android!" your phone talking itself, not machine that's running api. must provide (or, enable phone locate ...) ip-address of that machine.

r - confusion matrix of bstTree predictions, Error: 'The data must contain some levels that overlap the reference.' -

i trying train model using bsttree method , print out confusion matrix. adverse_effects class attribute. set.seed(1234) splitindex <- createdatapartition(attended_num_new_bsttree$adverse_effects, p = .80, list = false, times = 1) trainsplit <- attended_num_new_bsttree[ splitindex,] testsplit <- attended_num_new_bsttree[-splitindex,] ctrl <- traincontrol(method = "cv", number = 5) model_bsttree <- train(adverse_effects ~ ., data = trainsplit, method = "bsttree", trcontrol = ctrl) predictors <- names(trainsplit)[names(trainsplit) != 'adverse_effects'] pred_bsttree <- predict(model_bsttree$finalmodel, testsplit[,predictors]) plot.roc(auc_bsttree) conf_bsttree= confusionmatrix(pred_bsttree,testsplit$adverse_effects) but error 'error in confusionmatrix.default(pred_bsttree, testsplit$adverse_effects) : data must contain levels overlap reference.' max(pred_bsttree) [1] 1.03385 min(pred_bsttree) [1] 1.011738 > u

java - To add common files in a common folder for all the adapters in MF8 -

i working on mf8 java adapters. there common server folder have common java files in mf7? here each adapter taken maven project. it's can deploy defining them modules under single pom.xml . <modules> <module>adapter1</module> <module>adapter2</module> </modules> still, have common files. options place them in common folder? packaging them jar becoming painful while debugging. suggestions? you can group adapter maven projects in parent maven project. way can specify shared dependencies in pom.xml of parent maven project , added child maven projects when you're building them. see: https://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/8.0/adapters/creating-adapters/#grouping-adapters-in-a-single-maven-project

google app engine - AppEngine Datastore query with filter never returns results (Go) -

Image
if don't use filter, results. if use filter (this record exists), don't results. might lack of index defined property, but, understand it, simple indices should automatically created in development server (and index.yaml file created , populated it). not happening. query = datastore.newquery("useraccount").filter("email =", "test@example.com") ua := useraccount{} t := query.run(ctx) ; ; { if _, err = t.next(&ua); err == nil { log.debugf(ctx, "current: %s", ua) } else if err == datastore.done { break } else { panic(err) } } when development server terminates, states it's "saving search indexes": info 2016-08-08 05:09:52,894 api_server.py:651] saving search indexes however, since "index.yaml" file doesn't appear, i'm assuming no indices needed created, means query must not've had desired effect? what missing? edit: note record created , ap

javascript - indexOf() showing unexpected value -

while doing alert index of first element i.e, violet being shown -1.but unexpected getting correct result.hence not able expected result me can go further in coding.actually m new javascript facing such problem.hope answerme can. var colors = ["voilet", "indigo", "blue", "green", "yellow", "orange", "red"]; var target; var target_index; var guess_input; var finished = false; function do_game() { var random_number = math.random() * 7; var random_number_integer = math.floor(random_number); var target_index = random_number_integer; target = colors[target_index]; alert(target); while (!finished) { var guess_input = prompt("i thinking of color " + "violet,indigo,blue,green,yellow,orange,red" + "what color?"); alert(colors.indexof(guess_input)); finished = check_guess(); } } function check_guess() { if (colors.indexo

java - MalformedInputException with Files.readAllLines() -

i iterating on files, 5328 precise. these files average xml files 60-200 lines max. first filtered through simple method isxmlsourcefile parse path. files.walk(paths.get("/home/me/development/projects/myproject"), filevisitoption.follow_links) .filter(v3testsgenerator::isxmltestsourcefile) .filter(v3testsgenerator::filecontainsxmltag) the big question second filter, method filecontainsxmltag. each file wanted detect if pattern contained @ least once among lines of it: private static boolean filecontainsxmltag(path path) { try { return files.readalllines(path).stream().anymatch(line -> pattern.matcher(line).find()); } catch (ioexception e) { e.printstacktrace(); } return false; } for files exception java.nio.charset.malformedinputexception: input length = 1 @ java.nio.charset.coderresult.throwexception(coderresult.java:281) @ sun.nio.cs.streamdecoder.implread(streamdecoder.java:339) @ sun.nio.cs.stre

C++ REST (Casablanca) - web::json::value has no member named 'field_map' -

Image
i new c++ rest ('casablanca'). read tutorial here . after than, took sample code there , tried run on machine. below code std::map<utility::string_t, utility::string_t> dictionary; void handle_get(http_request request) { trace(l"\nhandle get\n"); web::json::value::field_map answer; (auto const & p : dictionary) { answer.push_back(std::make_pair(json::value(p.first), json::value(p.second))); } request.reply(status_codes::ok, json::value::object(answer)); } int main() { http_listener listener(l"http://127.0.0.1:8080/stockdata"); listener.support(methods::get, handle_get); return 0; } in code, getting error below i checked header file json.h , not find member (class/struct) named field_map please help i think below code can replace code , should compile latest stable version cpprestsdk v2.8.0 std::map<utility::string_t, utility::string_t> dictionary; void handle_get(h

php - Select-Form with Value integer -

i'm trying edit users via form. far, good. <div class="form-group"> {{ form::label('admin_level', 'admin?') }} {{ form::select('admin_level', array(0 => 'no', 1 => 'yes'), null, array('class' => 'form-control')) }} </div> my problem is: in rendered version of form, value changes string, need integer value update user. tried delete '' without changes. (as might see above) dd giving me this: "admin_level" => "0" how value in 'admin_level' integer value? update i added usercontroller function update: $request['admin_level'] = (int)$request['admin_level']; if dd($request) in attributes it's integer, don't stored with: $user->update($request->except(['_token'])); the value keeps same. i solved it! you have add attribute /app/user.php in array $fillable: protected $fillable = [

python - Detecting colored circle and it's center using OpenCV -

i trying detect blue colored circle , it's center. draw circle on detected circle , small circle on it's center. few errors. (i using opencv 3.1.0, python 2.7 anaconda 64 bits, pycharm ide) (please me using python codes) run following code: import cv2 import numpy np cap = cv2.videocapture(0) if cap.isopened(): while(true): frame, _ = cap.read() # blurring frame that's captured frame_gau_blur = cv2.gaussianblur(frame, (3, 3), 0) # converting bgr hsv hsv = cv2.cvtcolor(frame_gau_blur, cv2.color_bgr2hsv) # range of blue color in hsv lower_blue = np.array([110, 50, 50]) higher_blue = np.array([130, 255, 255]) # getting range of blue color in frame blue_range = cv2.inrange(hsv, lower_blue, higher_blue) # getting v channel gray channel blue_s_gray = blue_range[::2] # applying houghcircles circles = cv2.houghcircles(blue_s_gray, cv2.hough_gradient, 1, 10, 100

angularjs - ng-init for drop down not working from api call -

i making call api , using response populate select drop down list. trying prepopulate select drop down box 'please choose country', countries being returned api call following isn't working guess $scope.countries.select not defined @ stage. html <select ng-init="countries.select" ng-model="country" ng-change="getroles(country)" ng-options="key value (key , value) in countries"></select> the countries object returned api call looks this: $scope.countries = { au:"australia", be:"belgium", us:"united states" } which push following $scope.countries.select = "please select country"; as countries.select not defined api response still needs returned believe reason not working. you not initialising value of countries properly. since js doesnot know countries can not assign countries.select since countries undefined. first initialise countries empty object =

Android how to know if flashlight is on -

i using cameramanager , cameracharacteristics i know how check if flashlight turned on try bit of code public boolean flashstatus() { camera.parameters parameters = camera.getparameters(); if (parameters.getflashmode() == "flash_mode_torch") { return true; } if (parameters.getflashmode() == "flash_mode_off") { return false; } }

Can you help me C# switch case -

i have code c# switch case public void gdvdetail_customunboundcolumndata(object sender, devexpress.xtragrid.views.base.customcolumndataeventargs e) { try { datarowview orow = (datarowview)(gdvdetail.getrow(e.listsourcerowindex)); switch (e.column.name) { case colquotaquantity.name: if (colquotaquantity.unboundexpression == "" && orow.row.table.columns.contains("quotaquantity")) { e.value = orow.row["quotaquantity"]; } break; //e.value = orow.row("quantity") case coldifferencequantity.name: if (orow.row.table.columns.contains("quotaquantity") && !information.isdbnull(orow.row["quotaquantity"]) && !information.isdbnull(orow.row["quantity"])) { e.value = system.convert.todouble(orow.row

IntelliJ IDEA: Jump from interface to implementing method in Go -

Image
is there shortcut allow me after creating method in interface, select , jump implementation of method or give me list of implementations. i looking when cmd +click , usage of interface method. but instead of usage of method need short cut implementation. have copy method name , search in project, not feels efficient way. i using intellij idea (community edition) 2016.2.2 eap go plugin version: 0.12.1724. i have tried cmd + alt + b getting no implementation found no, such shortcut doesn't exist. you can use "find usage" determine specific interface method used, if want see concrete implementations current way search entire project method name.

javascript - How to copy object and create new object with existing Json object? -

i trying create new object have default values scope. i found there copy function create new independent object. angular.copy(source,destication) but not working me. undefined when console new object. angular.copy($rootscope.answers,$rootscope.default); console.log($rootscope.answers); console.log($rootscope.default); https://plnkr.co/edit/bfgxr7lnae0kvqipj9jj?p=preview in app.js in .run method trying use copy function. please let me know if missing anything. cloning option. below example: var deepclonedcopy = jquery.extend(true, {}, originaldata); var cloneddata; cloneddata= $.map(deepclonedcopy, function(el) { return el }); see article detailed explanation: http://heyjavascript.com/4-creative-ways-to-clone-objects/ additional answer added: you need define $rootscope.default={}; before performing copy. $rootscope.default={}; angular.copy($rootscope.answers,$rootscope.default); console.log($rootscope.answers); console.log($rootscope.default);

javascript - Safari not downloading base64 image -

when using this demo image saves fine on chrome when hit save image shows weird box on safari(ipad). when hold image , hit save doesn't @ all. how can fix this? edit: apparently thought problem resolved, it's not. suggestions still welcome! :d

javascript - Slider showing like boxes in Browser but working fine in Fiddle (No Error Showing in Console) -

Image
i implementing slider working fine in fiddle (working) , showing boxes when implemented in browser. here picture of how shows in browser. code.html <html lang="en"> <head> <meta charset="utf-8"> <title>jquery ui slider - multiple sliders</title> <script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-bbhdlvqf/xty9gja0dq3hiwqf8lacrtxxzkrutelt44=" crossorigin="anonymous"></script> <script src="jquery-ui.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0msbjdehialfmubbqp6a4qrprq5ovfw37prr3j5elqxss1yvqotnepnhvp9aj7xs" crossorigin="anonymous"></script> <link rel="stylesheet" href="jquery-ui.css"> <!-- <script src="jque