Posts

Showing posts from August, 2012

Typeahead ajax autocomplete is not working -

i trying make typeahead autocomplete ajax data, it's not working. this code. html <input type="search" class="typeahead" id="order_address" autocomplete="off"> javascript $(document).ready(function() { var suggestions = new bloodhound({ remote: { url: 'https://autocomplete.geocoder.api.here.com/6.2/suggest.json?app_id=...app_code=...&country=usa&mapview=41.382995,-74.301616;41.305715,-74.092278&query=%query%', wildcard: '%query%', filter: function (response) { return response.suggestions; } }, datumtokenizer: function(suggestions) { return bloodhound.tokenizers.whitespace(suggestions); }, querytokenizer: bloodhound.tokenizers.whitespace, }); $('#order_address').typeahead({ hint: true, highlight: true, minlength: 1 }, { name: 'suggestions', displaykey: funct...

javascript - Angular: How to get the count of the Object with specific value? -

i have json database objects. each 1 has properties specific assigned value: a, b or c. [ { "id": 1, "category": "a" }, { "id": 2, "category": "b" }, { "id": 3, "category": "c" }, { "id": 4, "category": "a" }, { "id": 5, "category": "a" }, { "id": 5, "category": "b" } ] i want display like: there total of 6 items: x 3 , b x 2 , c x 1 . i know have use objectsinmyjsondatabase.length total. i'm wondering how possible length (number) of objects have specific value? one way solve problem use map-reduce. here quick solution. hope solve problem. var data = [ { "id": 1, "category": "a" }, { "id": 2, "category": "b" ...

selenium - I am getting error "The method timeouts() is undefined for the type WebDriver.Options" -

Image
i using implicit wait below: //import import org.openqa.selenium.webdriver; //driver declaration public static webdriver driver = null; //implicit wait driver.manage().timeouts().implicitlywait(30, timeunit.seconds); having error below: the method timeouts() undefined type webdriver.options need resolve this. nice catch. seems me bug selenium jars here answer question: as of code have 2 lines. first line public static webdriver driver = null; shows no error have imported org.openqa.selenium.webdriver; in second line , providing implicit wait in driver.manage().timeouts().implicitlywait(30, timeunit.seconds); . in case ide on working tries resolve method timeouts() org.openqa.selenium.webdriver have imported. hence no error should have been shown timeouts() method. hence following error not justified: the method timeouts() undefined type webdriver.options the error should have been shown either implicitlywait() method or parameter timeunit ....

xcode - GCD file monitoring - parent folder(s) changes? -

i'm using gcd method of monitoring files changes. seems work fine , notifications file writes, deletes, renames, etc. question have - how's right way approach changes parent folders monitored file? ex: want monitor abc.txt currently in path \path\to\something\abc.txt user renames folder something something_else file lives in \path\to\something_else\abc.txt i don't notifications when parent folder(s) renamed or moved because i'm not monitoring them. missing obvious or need actively monitor entire set of folders in hierarchy parent changes impact file handled appropriately? any words of wisdom appreciated i don't think gcd can that. you'll have go lower-level, fsevents .

Android Studio ScrollView blurred content -

Image
i using android studio 1.2.2 , have problem scrollview can not solve. issue is, if add button scrollview, then, when scroll panel, button leaves blurred trace behind. (like in old windows, when pc froze, moving window on screen result in leaving trace on desktop, desktop not redrawn) here illustration the grey square buttons added, , @ bottom can see there more buttons under it, as, in reality, there not, not redrawn background this problem happens when doing followind both editing xml or constructing gui programatically adding 1 or more buttons directly scrollview adding tablelayout scrollview, adding tablerow, add button adding tablelayout scrollview, adding tablerow, add frame layout , button the virtual emulator use please, if of knows might issue, point me in right direction? below provide code the code in gameactivity.java public class gameactivity extends activity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedi...

c# - EF6 - error when insert entity with related entites only by navigation property -

i need insert entity related entity inside, both in single dbset.add invocation. one-to-many between course , courseprofesor (courseprofesor entity connecting courses , profesors) entities: public class course { public course() { } [key, databasegenerated(databasegeneratedoption.identity)] public int id { get; set; } ... public virtual icollection<courseprofesor> profesors { get; set; } } public class courseprofesor { public courseprofesor() { } [key] public int id { get; set; } [required, index, column(order = 0)] public int courseid { get; set; } [required, index, column(order = 1)] public int profesorid { get; set; } ... [foreignkey("courseid")] public virtual course course { get; set; } [foreignkey("profesorid")] public virtual profesor profesor { get; set; } } mappings: protected override void onmodelcreating(dbmodelbuilder modelbuilder) { modelbuilder.entity<cour...

c++ - FLTK: Event when a window gets focus on MacOS -

using fltk, i'm writing desktop application uses multiple windows. application manages list of open windows , shows them in menu these lines: for( int = 0; < windows.size(); ++i ) { menu->add(("&windows/"+windows[i].name).c_str(), 0, mymenucallback); } now want set checkmark in front of name of top-most window: flags = fl_menu_toggle|fl_menu_value; menu->add(("&windows/"+windows[i].name).c_str(), 0, mymenucallback, 0, flags); i'm stuck @ installing event handler gets called whenever top-most window changes. hoping fl::add_handler( &genericeventhandler ); called whenever focus changes, not case. so, question is: how notified, when focus of windows changes? you should subclass fl_window override handle method monitor fl_focus , fl_unfocus events. here sample: class mywindow : public fl_window { public: mywindow(int x,int y,int w,int h, const char* title) : fl_window (x, y, w, h, title) {} int handle(int...

javascript - ShieldUI Grid - show dropdown on insert only -

i'm using shieldui grid, , have new row on grid show dropdown in 1 of columns. column not editable , displays text. want user able select value dropdown, not editable after being added. i've reviewed documentation multiple times, , can't seem figure out. $(document).ready(function() { $("#propertiesgrid").shieldgrid({ theme: "light-bootstrap", datasource: { remote: { read: { url: "/api" + window.location.pathname + "/productattributes", datatype: "json" } }, modify: { update: function(items, success, error) { $.ajax({ type: "put", url: "/api" + window.location.pat...

python 2.7 - Average of median of a column in a list of dataframes -

i looking best way take average of median of column in list of data frames (same column name). let's have list of dataframes list_df . can write following for loop required output. more interested in looking if can eliminate for loop med_arr = [] list_df = [df1, df2, df3] df in list_df: med_arr.append(np.median(df['col_name'])) np.mean(med_arr) this done list comprehension : list_df = [ df1, df2, df3 ] med_arr = [ np.median( df['col_name'] ) df in list_df ] np.mean(med_arr)

Python: format string as table in non-monospace font -

i'm working on slack webhooks integration slack slash commands . script flow following: getting slash command request slack. processing data (in form of dict or pandas dataframe) posting channel using slack webhook. my response set of key:value records or 2 columns dataframe. want print them nicely slack, ran formatting problem. using slack back-ticks make code block monospace font not work, because might have large records, , slack trims string after 8000 characters. printing lines without monospace, plain text, results in ugly columns different width in each row. i tried sorts of formatting tricks, not find way format response using slack api 2 long columns. guess looking library format string me given font being used. any appreciated. slack messages not designed handle large sets of structured data sets. in personal opinion best option provide link webpage showing data. however,if want show data within slack recommend upload plain text file. can l...

javascript - undefined object of AngularJS form -

i need enter variables of ng-repeat, run problem when enter these variables there 2 variables undefined, , not different rest, because happens, variables "pies_tablares" , "observacion": <tr ng-repeat="table in datos"> <td> <input type="text" class="form-control" ng-model="especie" ng-value="table.especie" readonly> </td> <td> <input type="text" class="form-control" ng-model="largo" ng-value="table.largo" readonly> </td> <td> <input type="text" class="form-control" ng-model="ancho" ng-value="table.ancho" readonly> </td> <td> <input type="text" class="form-control" ng-model="espesor" ng-value="table.espesor" readonly> </td> <td> <inpu...

Web-scraping JavaScript page with Python -

i'm trying develop simple web scraper. want extract text without html code. in fact, achieve goal, have seen in pages javascript loaded didn't obtain results. for example, if javascript code adds text, can't see it, because when call response = urllib2.urlopen(request) i original text without added 1 (because javascript executed in client). so, i'm looking ideas solve problem. you can use python library dryscrape scrape javascript driven websites. example to give example, created sample page following html code. ( link ): <!doctype html> <html> <head> <meta charset="utf-8"> <title>javascript scraping test</title> </head> <body> <p id='intro-text'>no javascript support</p> <script> document.getelementbyid('intro-text').innerhtml = 'yay! supports javascript'; </script> </body> </html> without javascript says: n...

ios - Swift: conditional compilation flags must be valid Swift identifiers -

today downloaded xcode 9.0 beta 4 , after building project next warning messages <unknown>:0: error: conditional compilation flags must valid swift identifiers (rather '-xfrontend') <unknown>:0: error: conditional compilation flags must valid swift identifiers (rather '-debug-time-function-bodies') command /applications/xcode-beta.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/bin/swiftc failed exit code 1 i have tried several options have searched here cannot find solution this. cleaned project cleaned build folder restarted xcode restarted laptop anyone on this? at point, or coworker included flags see how long xcode takes swift files compile. can remove them don't affect compilation. not sure if still supported if are, active compilation conditions don't take format of starting dash anymore seems.

javascript - Single line shortform for non-arrow function? -

sometimes, in classes, need single line function. for instance: class blah { getvisibilityanimvalue() { return this.state.isvisible ? 100 : 0 } } in es6 there friendly way? tried omit surrounding curlies , omitting return it's not working. in es6 there friendly way? no, there not. think know, in order use this refer calling instance, cannot use arrow function (which uses lexical this rather this based on how called). so, have use conventional es6 method definition. such, need braces {} , need return . the es6 class syntax @ least saves es5 scheme of: blah.prototype.getvisibilityanimvalue = function() {...} i tried omit surrounding curlies , omitting return it's not working. yep, still required. if had lot of methods worked , used identical logic, factor logic shared function. // define once , use many places function zval(val) { return val ? 0 : 100; } getvisibilityanimvalue() { return zval(this.state.isvisible) } bu...

sql server - How to remove duplicates of inner query that was used to remove duplicates in SQL? -

this sql server question, here tables working (note: column name name of code set): table: code set code_set_id | name -------------+----------- 1 | jackets 2 | pants 3 | shirts table: code set detail code | description | code_set_id ---------------+----------------+------------ blue | blue jacket | 1 blue | blue jacket | 1 green | green jacket | 1 green | green jacket | 1 purple | purple jacket | 1 the query wrote finds duplicate code set codes , code set code set codes belong too. following query return jackets, blue, 2 jackets, green, 2 how wrap query around following query jackets ? select bcs.name, bcsd.code, bcsd.description, count(*) code_set_detail bcsd inner join code_set bcs on bcsd.code_set_id = bcs.code_set_id group bcs.name, bcsd.code, bcsd.description having count(*) > 1 so far, i've tried using where exists , yet ...

java - JPA Mapping Enum from DB -

i have db table this: +----+-------------+ | id | cola | +----+-------------+ | 1 | black cola | | 2 | red cola | | 3 | blue cola | | 4 | purple cola | +----+-------------+ and entity + enum this: @entity @table(schema = "dbo", name = "cola") public class colaentity implements serializable { @id @generatedvalue(strategy = generationtype.identity) @column(name = "id") private integer id; @enumerated(enumtype.string) @column(name = "cola") private cola cola; public integer getid() { return id; } public void setid(integer id) { this.id = id; } public cola getcola() { return cola; } public void setcola(cola cola) { this.cola = cola; } } public enum cola { black_cola("black cola"), red_cola("red cola"), blue_cola("blue cola"), purple_cola("purple cola") private final s...

How to set a timeout for a pymysql query -

i have situation pymysql query may take longer amount of time allowed. ideally, call aborts exception after set number of seconds or mills, can reported , move forward. is there way limit amount of time query can execute given session/connection? based on this answer can do: with timeout(seconds=3): cursor.execute('your sql query')

c# - How to Read Items into Arrays in web.config -

i'm trying build array of strings items in web.config file (in iis). web.config <appsettings> <add key="favourite" value="url1; site1" /> <add key="favourite" value="url2; site2" /> <add key="favourite" value="url3; site3" /> </appsettings> c# // reads first favourite string. public string _favourites = configurationmanager.appsettings ["favourite"]; i each favourite read string [ ] _favourites array semi-colon (i parse out later). web.config xml file can open 1 , pull data out, there easier way using configurationmanager? i don't know if there hack it, have 1 setting multiple values; <appsettings> <add key="favourite" value="url1;site1;url2;site2;url3;site3;" /> </appsettings> or <appsettings> <add key="favourite" value="url1=site1;url2=site2;url3=site3;" /> ...

apache spark - Creating BlockMatrix of m rows n columns where m is not equal to n without using 'transpose' -

i working on algorithm has following things = np.array([[10, 5, 1, 0, 0], [6, 6, 0, 1, 0], [4.5, 18,0, 0, 1]]) nonbasis = np.array([0, 1]) basis = np.array([2, 3, 4]) i doing following create blockmatrix above given info. dm2 = matrices.dense(3, 2, a[:, nonbasis].flatten().tolist()) blocks2 = sc.parallelize([((0, 0), dm2)]) mat3 = blockmatrix(blocks2, 3, 2) i expecting mat3 follows, mat3 = densematrix([[ 10. , 5. ], [ 6. , 6.], [ 4.5 , 18. ]]) the result is, mat3 = densematrix([[ 10. , 6. ], [ 5. , 4.5], [ 6. , 18. ]]) ideally if 3x3 matrix or nxm n=m have used mat3 =mat3.transpose(). here if 2x3 matrix becomes 3x2 creating problems further in algorithm. can suggest simple solution. i'd go intermediate indexedrowmatrix : from pyspark.mllib.linalg.distributed import indexedrowmatrix indexedrowmatrix(sc.parallelize(enumerate(a))).toblockmatrix()

http - nginx server name regex when "Host" header has a trailing dot -

i've considered potential trailing hostname dot handling in 2 contexts in nginx, , curious whether usage in either 1 necessary entirely correct configuration: server_name ~^(\w+)\.(example\.com)\.?$; if ($host ~ ^(\w*)\.(example\.com)\.?$) { no, not necessary in either context — nginx automatically takes care of trailing dot, both in context of $host variable , server_name directive , leaving $http_host variable dot (if present in request). i believe implemented in http/ngx_http_request.c#ngx_http_validate_host : 1925 if (dot_pos == host_len - 1) { 1926 host_len--; 1927 } it can verified following minimal config: server { listen [::]:7325; server_name ~^(\w*)\.?(example\.com\.?)$; return 200 c:$2\th:$host\thh:$http_host\tsn:$server_name\n; } running following tests against nginx/1.2.1 : %printf 'get / http/1.0\nhost: head.example.com.\n\n' | nc localhost 7325 | fgrep example c:example.com h:head.example.com hh...

react native - useNativeDriver with PanResponder -

i trying move things usenativedriver . tried this: onpanrespondermove: animated.event([null, { dy:this.state.appearanim }], { usenativedriver:true }), however causes error of: config.onpanrespondermove not function if set usenativedriver false , works per expectations. have idea on how use native driver panresponder?

How to make a laravel appliction where users can install plugins -

i have been looking around days on how can build plugin cms wordpress. users can install plugins. i have been reading on eloquent orm , events don't know how put these things build pluggable cms system. please, there way can achieve these? there way these can implememted?

visual studio 2017 - C# Math.Ceiling is not working like what I have read and researched. Windows Forms App -

so should quick , easy fix me with. have made need round number going come out float possibly @ points round nearest integer. code have far. int result = ci * di; double result1 = result * 0.10; if (result1 == result1) math.ceiling((double)result1); if (result1 >= 1000) result1 = 1000; when run program goes through without errors fails want. if there way make code cleaner i'm it. topic, if type in lets 56 in 1 box , 3 in other, should come out saying have value of 16.8 due percentage calculations have done. when try math.ceiling there, doesn't round anything. also, greater or equal 1000 thing because don't want number going on 1000. thank may offer. the function math.ceiling not change value of double result1 returns it. variable result1 must explicitly re-assigned output of math.ceiling function if wish take output of function. can assign this...

iso8583 - How to Parse ISO 8583 message -

how can determine mti start in iso 8583 message? 00 1f 60 00 05 80 53 08 00 20 20 01 00 00 80 00 00 92 00 00 00 31 07 00 05 31 32 33 34 31 32 33 34 in message 00 1f length, , 60 00 05 80 53 tpdu. (those aren't part of iso8583). 08 00 mti. next 8 bytes primary bitmap. you can buy copy of iso8583 specification iso. there introduction on wikipedia

asp.net - add sub into vb.net happen connection strings property has not been initialized -

i have found lot of solution regarding connection strings property has not been initialized , have try follow , checking solution still not able fix problems. it happen while add private sub getdetails() , if remove sub recover. not happen other private sub this. private sub getorglocedit() dim strsql string dim params new hashtable dim dt new datatable try params.clear() strsql = "select c.mmc_states + ' - ' + c.mmc_desti desti [database].[dbo].[tbods] o " & _ " inner join [database].[dbo].tbodsmealmilageclaims c " & _ " on o.ods_destination = c.mmc_states + ' - ' + c.mmc_desti " & _ " c.mmc_company = @company , o.ods_id = @id order c.mmc_states, c.mmc_desti " params.add("@company", ddlcompany.selectedvalue.trim) params.add("@id", txtid.text.trim) if dt.rows.count > 0 ddlorgloc.dat...

perl - Get all the word enter in text widget to an array -

i new tk/perl. below simple gui interface create using tk/perl. gui interface below part of code create gui. $f2_label=$f_frame_top0->label(-text=>"file",-font=>[-family=>'ms sans serif',-size=>9,-weight=>'bold',-underline=>0],-justify=>'left')->pack(-side=>'left',-anchor=>'w',-padx=>1,-pady=>1,); $f2_entry=$f_frame_top0->entry(-width=>50,-state=>"normal")->pack(-side=>'left',-anchor=>'w',-padx=>1,-pady=>1,-fill=>'x',-expand=>1); $f2_file_btn=$f_frame_top0->button(-text=>"...", -height=>1, -width=>2, -command=> [\&file_search,$tab2,$f2_entry,"txt"])->pack(-side=>'left',-anchor=>'w',-padx=>1,-pady=>1); $f3_label=$f_frame_top1->label(-text=>"number",-font=>[-family=>'ms sans serif',-size=>9,-weight=>'bold',-underli...

ios - Apple Wallet: can't find pass.json because there is no such file -

i'm trying install pass made using walletpasses.io , i'm getting weird error: /users/nsmyself/library/developer/coresimulator/devices/a47fafcc-2628-455b-84d2-8ed2cc3e4400/data/containers/data/application/09d67cb1-7cfb-423e-8e6d-e43a8d9c3dd6/library/caches/com.companyname.appname.dev/com.apple.passbook/9c988ad8-f541-478e-bdc4-dad1949c8616.pkpass/pass.json. file “pass.json” couldn’t opened because there no such file. here's internal structure of pass: ➜ pass ls -lah total 64 drwx------@ 8 nsmyself staff 272b jul 28 03:04 . drwx------+ 48 nsmyself staff 1.6k jul 28 03:45 .. -rw-------@ 1 nsmyself staff 577b jul 28 02:58 icon.png -rw-r--r--@ 1 nsmyself staff 750b jul 28 02:57 icon@2x.png -rw-r--r--@ 1 nsmyself staff 753b jul 28 02:57 icon@3x.png -rwxr-xr-x@ 1 nsmyself staff 63b jul 26 16:14 manifest.json -rwxr-xr-x@ 1 nsmyself staff 1.5k jul 28 03:44 pass.json -rwxr-xr-x@ 1 nsmyself staff 3.0k jul 26 16:14 signature and, finally, con...

javascript - Do function before confirm jquery -

here jquery code $('.input').keyup(function(event){ update_text(); // $('div').html('blahblah'); }) .blur(function(event){ $(this).keyup(); if(confirm('are sure?')){ // somthing... } }); my problem when input blur, confirm box should show after doing update_text(); but update_text() seems run after confirm... how make update_text() first, show confirm dialog? actually method run before confirm() , issue here browser repaints dom asynchronously though method .html() in synchronous. while doesn't appear run first visually indeed is. for example more simple version have same functionality, can vary browser: $("div").html("foo"); confirm('are sure?'); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div></div> one way around force dom repaint rather letting browser it. example: $(...

codeigniter - PHP video upload occur error -

$file_name = $_files['video']['tmp_name']; echo $file_name; when upload image file, response image's tmp_name in php server. but upload video file, doesn't response video's tmp_name. , check php server, in tmp folder, can't check video's file. is there condition when upload video file? if know that, please me. i choose 2mb video file. think file doesn't check limit. you can check upload_max_filesize or post_max_size property on php server configuration(php.ini), since video files' sizes large limit. can find relevant information below. http://php.net/manual/en/ini.core.php#ini.upload-max-filesize http://php.net/manual/en/features.file-upload.post-method.php

php - OpenCart: Create custom controller class -

i have custom script meant generate images customer. i need script part of controller, because need script able use: if (!$this->customer->islogged()) { $this->session->data['redirect'] = $this->url->link('account/download', '', true); $this->response->redirect($this->url->link('account/login', '', true)); } in order check if customer logged in. otherwise, can access link when logged out, dangerous shop. in custom script, have included: <?php require_once('system/engine/controller.php'); class controllertestabc extends controller{ public function index() { echo 'hello world'; exit; } } ?> i'm echoing hello world see if page run. however, page blank. note: attempting access script using href like: $viewimg ="<a target='_blank' href='view_code.php?id=".$id."&showdate=".$showdate....

react native - You have not accepted the license agreements.[Android SDK Platform 23] -

i working react-native, when run react-native run-android run command error you have not accepted license agreements of following sdk components:[android sdk platform 23, android sdk build-tools 23.0.1]. i have android studio sdk version 26 , android sdk build-tools 26 installed. why react give error? can try follow comment , try if solves issue? https://github.com/ionic-team/ionic-cli/issues/1726#issuecomment-279164447

replace - Replacing a Null field in mdx -

i have situation have null value coming in column , value needs replaced value. current mdx select non empty { [measures.[color count]} on columns ,non empty { [colorcolor].[color].[color].allmembers} dimention properties member caption ,member_unique_name on rows [colors] current results color color count null 1 red 1 blue 1 purple 1 black 1 intended results color color count silver 1 red 1 blue 1 purple 1 black 1 basically need replace null color "silver". null needs replaced in mdx , not in ssrs. using with member can create new item, giving name want, , tell values null item. can hide items don't want using second argument of except function. with member [colorcolor].[color].[color].[mynewname] [colorcolor].[color].[color].[null] select non empty { [measures.[color count]} on columns ,non empty { [colorcolor].[color].[color].[mynewname], except({[colorcolor].[color].[color].allmembers...

string - bash: combine all elements of two arrays (and add something to each) -

i have 2 bash arrays , want combine elements of both, plus add string each resulting element. specifically, have array containing years , months, , want date string of first day of each month in each year: # define arrays containing years , months (zero-padded) yyyys=(2000 2001 2002) mms=(12 01 02) # want achieve following using arrays defined above echo {2000..2002}{12,01,02}01 # 20001201 20000101 20000201 20011201 ... # hard-coded months, following want echo ${yyyys[@]/%/0101} # 20000101 20010101 20020101 # how can achieve arbitrary months, using $mms? how can achieve little code possible? note: need (dirty enough) bash run script, i'm not looking clean, portable solution condensed bash solution using string expansion, piping, or whatever else necessary. (i write function achieve in few lines of code without problem, that's not point). i've found partial solution based on brace expansion: eval echo $(echo "{${yyyys[@]}}{${mms[@]}}01" | ...

javascript - .click()/.trigger('click') doesn't work with Tampermonkey in Spotify -

i'm trying write script skip next song on spotify after event, can't work. i'm aware there lot of asked questions here, tried answers don't work me. when try using chrome console these work fine, not in script: document.getelementsbyclassname('spoticon-skip-forward-16')[0].click(); /*or*/ document.getelementsbyclassname('spoticon-skip-forward-16')[0].trigger('click'); jquery('spoticon-skip-forward-16:first').click(); /*or*/ jquery('spoticon-skip-forward-16:first').trigger('click'); jquery('spoticon-skip-forward-16:first').each(function () { jquery(this).css("color", "yellow"); var clickevent = document.createevent("mouseevents"); clickevent.initevent ("click", true, true); this.dispatchevent (clickevent); }); jquery('spoticon-skip-forward-16:first') can substituted jquery('spoticon-skip-forward-16')....

How to get spring boot controller endpoint full url? -

how specific spring boot controller endpoint full url without concat/hardcode strings? case need send request external url , async notification it, need pass notification endpoint full url it. here sample code: @restcontroller @requestmapping("/api/v1") public class mycontroller { @postmapping("/sendrequest") public void sendrequest() { ... // 1. /notifystatus endpoint full url send external service string mynotificationfullurl = xxx ? // 2. call external service } @getmapping("/notifystatus") public void notifystatus() { ... } } allows getting url on system, not current one. import org.springframework.hateoas.mvc.controllerlinkbuilder ... controllerlinkbuilder linkbuilder = controllerlinkbuilder.linkto(methodon(yourcontroller.class).getsomeentitymethod(parameterid, parametertwoid)) uri methoduri = linkbuilder.uri() string methodu...

python - Rename a directory after extracting zip archive uploaded by user -

i'm trying rename directory after extracting in temporary directory.the archive upload user. mean, user upload .tar or .zip file make temporary directory , extract user's file directory, want rename extracted directory inside temporary directory. here's have tried: in views.py if form.is_valid(): deployment = tarwithoutdocker() deployment.name = form.cleaned_data['name'] deployment.user = request.user deployment.archive = form.cleaned_data['archive'] deployment.save() tmpdir = tempfile.mkdtemp() saved_umask = os.umask(0o077) path = os.path.join(tmpdir) arpath = deployment.archive.path patoolib.extract_archive(arpath, outdir=path) os.rename(path + '/' + deployment.archive.name[:-4], 'archive') print(path+'/'+deployment.archive.name[:-4]) but when print print(path+'/'+deployment.archive.name[:-4]) should print users' file na...

how to import menu and menu translation of different language in drupal 8 using drush -

i have added menus in main menu , did translation in 2 languages in french , german, problem while importing menu , configuration through drush , translation configuration not imported noticed while exporting configuration in site . can me in , how can able import/export menu , translation done in different language using drush . don't want use .csv formatted files this. some how manage using translation management tool module available drupal 8 , other alternatives migrate module , dependency module's.

scikit learn - Unresolved reference "sklearn" in Python while importing GaussianNB -

i trying execute following statements in pycharm on windows. error message in 4th line importing gaussiannb - sklearn: unresolved reference. there package needed included or other way resolve this? import numpy np x = np.array([[-1, -1], [-2, -1], [-3, -2], [1, 1], [2, 1], [3, 2]]) y = np.array([1, 1, 1, 2, 2, 2]) sklearn.naive_bayes import gaussiannb clf = gaussiannb() clf.fit(x, y) print(clf.predict([[-0.8, -1]])) from last comment seems scipy module missing. after installing scipy error should not appear. the common scipy - pycharm installation problems have been answered here (just in case error while trying install scipy ) see here 1 see here 2

c# - Facing error in Event Log Creation -

using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.threading.tasks; using system.windows.forms; namespace custom_event_log_app { public partial class form1 : form { public form1() { initializecomponent(); } private void button_eventandsourcelog_click(object sender, eventargs e) { if (textbox_logname.text != string.empty && textbox_logsource.text != string.empty) { system.diagnostics.eventlog.createeventsource(textbox_logsource.text, textbox_logname.text); messagebox.show("event log , source created"); } else { messagebox.show("event log , source required...!"); } } } } security exception description: application attempted perform operat...

linux - Access local html page via ip , but should not access with hostname -

my requirement simple. when try access html page in localhost using ip ( https://ip ) must connect/able access site. when try access same page using hostname ( https://hostname ) should not load/access page. possible so? i tried redirect , rewrite conditions, none of works. thank you..

503 service temporarily unavailable nginx 1.11.10 magento 1 -

Image
when access domain error shown continuously after few second reload website working proper, cms magento 1.9.x this error shown on sub directories , time admin panel shown same error. there no maintenance flag no ip restriction cache session updated ( 503 service temporarily unavailable nginx 1.11.10 )

javascript - Node event emitter -

i new node , studying event emitter , created 1 demo program var eventemitter = new event.eventemitter(); var fs = require("fs"); var data = ''; var read = fs.createreadstream("demo.txt"); read.setencoding('utf8'); read.on('data', function(resp) { console.log(resp); }); data='some data'; var writestream = fs.createwritestream("demo.txt"); writestream.write(data,'utf8'); writestream.end(); writestream.on('finish',function(){ console.log("finish"); }); so output 'finish' if write read stream after write stream output 'finish data' why read stream not producing output if put first. ps: have data in file as @jfriend00 correctly mentioned, should first write file, can read it. const fs = require("fs"); var writestream = fs.createwritestream("demo.txt"); writestream.write('some data','utf8'); writestream.end(); writestr...

Opencart 2.0 403 Forbidden Access after Setting Save in Admin -

Image
i install clean version (with new database) of opencart 2.0 , go admin page, setting open , save configuration (no changes made) , following error: 403 forbidden access resource on server denied! am checking server folder permissions on server 755 . finlay got solution, based on cpanel issues. solutions following steps: step 1: login cpanel . step 2: find modsecurity . step 3: choose domain , disable modsecurity . step 4: clear history , try again. thank you

node.js - Mongoose - get array-entry of subdocument -

i've document looks this: { "_id" : objectid("5979f7a3bdbfcb25e6c32b95"), "name" : "company 1", "address" : { "street" : "mainstreet 4", "plz" : 1010, "ort" : "vienna", "land" : "at" }, "status" : "active", "settings" : [ { "key" : "sett1", "value" : "val1" } ], "users" : [ { "firstname" : "mike", "lastname" : "bold", "username" : "miky123", "password" : "mypassword", "token" : "ab78ab99684ef664654a65468b86de64", "status" : "active", "role" : "admin...

how to get Mysql COUNT within subquery -

Image
here have table named test2. need below output single mysql query.i have tried using subquery fail. kindly me sort this. pending status- 154 completed status - 159 required output query have tried select ( test2.doc_no, select ( count(test2.esn) pending_quantity, test2.doc_no test2 test2.sttus = 154 group test2.doc_no ), select ( count(test2.esn) completed_quantity, test2.doc_no test2 test2.sttus = 159 group test2.doc_no ) ) select doc_no, sum(status=154) pending_quantity, sum(status=159) completed_quantity test2 group doc_no try above query. hope you.

.net - Targeting Frameworks suddenly gone missing from VS 2017 -

Image
something strange happened in pc (i suspect windows update did it). me , team working on windows forms project (targeting .net framework 4.0 client) past few months. fine until of sudden, vs 2017 started telling me .net framework 4.0 not installed on system, here screenshot: we cannot upgrade target framework because need support windows xp , .net framework 4 last 1 supported in xp. fortunately, in development machine .net 4 still available, here screenshot: but, in machine case this: .net 4.0 missing in link microsoft: https://www.microsoft.com/net/targeting so, here question: is microsoft intentionally removing .net 4.0 , other old frameworks windows 10, or bug in machine? any appreciated. thanks!

angular - ionic3 ngfor with different css -

i looping array list, , object in include key value 'isread': 0/1, and below the html code: <button ion-item text-wrap *ngfor="let notice of notices" ng-style="{ 'background': notice.isread=='1': ? '#dcf7e3': '#ffffff' }"> <ion-avatar item-start> <img src="{{notice.imageurl}}" style="border-radius:0px;"> </ion-avatar> <h3 [hidden]="slang!='en'" style="color:#172845;">{{notice.msgen}}</h3> <h3 [hidden]="slang!='zh'" style="color:#172845;">{{notice.msgtw}}</h3> </button> my problem want using "isread" have different background color, seems not working, have idea? avoid inline styles, can change class like: [ngclass]="{'class1': notice.isread == 1, 'class2': notice.isread == 0}" then in css file: .class1 { background: #dcf7e3; ...

java - Getting null while reading Hyperlink from excel using poi -

i have 1 excel file in row contains few cell string , other numeric, hyperlink. i want read data excel wrote below code hssfcell cell =row.getcell(j+1); cell.setcelltype(celltype.string); string cellvalue = cell.getstringcellvalue(); above code reads numeric cells , string cells when comes cells contain hyperlink, in case, reading cells null.i can put hyperlink between double quotes("abc@cd.com") in sheet want handle on code level. there way handle scenario? you should use cell. gethyperlink() hyperlink cell. if(cell.getcelltypeenum() == celltype.string){ hyperlink hyperlink = cell.gethyperlink(); string value = cell.getrichstringcellvalue().getstring(); if(hyperlink == null) { return value; } else { return value + " " + hyperlink.getaddress(); } }

run pure java programs inside of a spring boot project -

so new spring boot, part of project scrap websites , operations on data scrapped, spring boot rest way expose data wondering when , can run pure java programs inside of spring boot project, idea came mind call programs inside of class implements commandlinerunner follows : public class myclass implements commandlinerunner{ private otherclassrepository otherclassrepository; public myclass ( otherclassrepository otherclassrepository ) { this.otherclassrepository = otherclassrepository; } //do operations , webscrapping programs created in other classes //guatering data @override public void run ( string... strings ) throws exception { //pass guethered data "otherclass" , expose } } and of course have controllers, repositories , entities. know if way , other ways work.

node.js - Async operations on redis message -

i trying update mongoose model when redis client publishes message. this i'm doing work redisclient.on('message', (channel, message) => { let data= json.parse(message); console.log(message); let user_id = data.user_id; let story_id = data.story_id; let ratingdetails = data.ratingdetails; user.findbyid(user_id, (err, user) => { if(err) return console.error(err); user.rating += (ratingdetails.polarity * ratingdetails.rating); console.log(ratingdetails); console.log(user.rating); user.save((err) => { if(err) return console.error(err); }); }); story.findbyid(story_id, (err, story) => { if(err) return console.error(err); story.totalrating += (ratingdetails.polarity * ratingdetails.rating); story.save((err) => { if(err) return console.error(err); }); }); }); console.log(message) showing passed message isn't performing mongoose operations. models aren't being updated. i'm ...

microcontroller - What is late programmed ROM? -

the datasheet tda93xx (an 80c51 based controller used in tv) on page 3 says can have: 32 - 128kx8-bit late programmed rom i wonder means? there chance me reprogram it? it means rom programmed before being encased variety of different methods. not mean device reprogrammable: u.s. pat. no. 4,295,209 discloses late programming igfet rom by ion implantation through openings in overlying phosphosilicate glass layer before metallization . ion implantation done through polycrystalline silicon gate electrode of selected igfets in rom. small size in rom preserved in u.s. pat. no. 4,295,209 incorporating silicon nitride coating beneath phosphosilicate glass layer. consequently, when implant openings etched in phosphosilicate glass layer, polycrystalline silicon gate electrode not exposed. accordingly, metal lines can cross directly on implant openings without contacting gate electrodes. however, silicon nitride coating ordinarily thin , there can capacitive coupling...

java - Spring REST - after longer Idle time the first calls take very long time (5-10 seconds) -

we running microservices on spring boot (with embedded tomcat) , spring cloud. means service discovery, regular health checks , services responding these health checks, ... have spring boot admin server monitoring , can see services running ok. running on test environment... some of our microservices called quite (let's assume once per 2 days) there still regular health checks. when rest api of these services called after long idle time first request takes long time process. of course causes opening circuit breakers in request chains , errors... see behavior when calling different endpoints using spring boot admin (theads list, metrics). as summary have seen behavior in calls on spring boot admim metrics, threads info, environment info or calls database called using hikari data source or aservice tried send email through smtp server my questions are: related setting of embedded server , thread pool? or should dive deep other thread pools , connection pools touched these r...

android - update UI by calling AsyncTask objects many times -

i making simple app , display questions , user within 10 seconds should answer or click next, when user click next , next question displayed , timer goes again 10 seconds. using asytask handle time counter , when click next button , next question displayed timer delay 2 seconds or start again 10 , example: on screen : question 1 displayed , time left 8 seconds . when click next button question 2 displayed time 8 after 2 or 3 seconds time goes 10 , start decreasing : question : there better way handle ? , why when next question displayed time hang 2 or 3 seconds start again 10 here code : // method called reset timer 10 , display next question private void displynextquestion(){ // cancel current thread . decrease_timer.cancel(true); decrease_timer =new decrease_timer(); // execute again , set timer 10 seconds decrease_timer.executeonexecutor(asynctask.thread_pool_executor,10); // code } private class decrease_timer extends asynctas...

matlab - Matrix with symbolic Math does not make the calculus -

consider following matrix ja(t1, t2, t3, t4, t5, t6) = [ (sin(t5)*(cos(t3)*cos(t4)*(cos(t1)*sin(t2) + cos(t2)*sin(t1)) - sin(t3)*sin(t4)*(cos(t1)*sin(t2) + cos(t2)*sin(t1))))/5 - sin(t1)/100 - (219*sin(t1)*sin(t2))/1000 - (19*cos(t3)*(cos(t1)*sin(t2) + cos(t2)*sin(t1)))/100 - (21*cos(t3)*cos(t4)*(cos(t1)*sin(t2) + cos(t2)*sin(t1)))/1000 + (21*sin(t3)*sin(t4)*(cos(t1)*sin(t2) + cos(t2)*sin(t1)))/1000, (219*cos(t1)*cos(t2))/1000 + (sin(t5)*(cos(t3)*cos(t4)*(cos(t1)*sin(t2) + cos(t2)*sin(t1)) - sin(t3)*sin(t4)*(cos(t1)*sin(t2) + cos(t2)*sin(t1))))/5 - (19*cos(t3)*(cos(t1)*sin(t2) + cos(t2)*sin(t1)))/100 - (21*cos(t3)*cos(t4)*(cos(t1)*sin(t2) + cos(t2)*sin(t1)))/1000 + (21*sin(t3)*sin(t4)*(cos(t1)*sin(t2) + cos(t2)*sin(t1)))/1000, (sin(t5)*(cos(t3)*sin(t4)*(cos(t1)*cos(t...