Posts

Showing posts from February, 2013

ios - Determine when to refresh directions from google directions api -

i have app displays suggested route point b on gmsmapview in ios app using google direction api. map tracks user's current location. how check if user following suggested route know when recalculate new directions should user go off path of current directions?

c# - Unity camera starting position -

hello created camera rts game i'm making on start camera on minhight position , cant figure out how change hope helps code bit of mess test here code want start maxhight position given , not on minhight . using system.collections; using system.collections.generic; using unityengine; public class rtscamera : monobehaviour { public float zoomsensitivy = 15; private transform m_transform; public float screenedgeborder = 25f; public bool usescreenedgeinput = true; public float screenedgemovementspeed = 3f; // zoom stuff public float heightdampening = 5f; public float scrollwheelzoomingsensitivity = 25f; public float maxheight = 10f; //maximal height public float minheight = 15f; //minimnal height public layermask groundmask = -1; public bool autoheight = true; public bool limitmap = true; public float limitx = 50f; //x limit of map public float limitz = 50f; //z limit of map private float zoompos = 0; //value in

Slow MySQL selects with where PK > x -

i have table 5 million rows of following structure: create table `books` ( `asin` char(10) character set latin1 not null, `title` varchar(512) not null, ...other fields... primary key (`asin`), key `lang` (`lang`) ) engine=myisam default charset=utf8; i'm trying run script on all, use "select * books asin > x limit 10000" , remember last pk. i expected query fast since i'm querying pk, performance degrading query taking 1 minute (used better in beginning). why happen? explain example: mysql> explain select * books asin > 'b000ot86oy' limit 10000; +----+-------------+-------+-------+---------------+---------+---------+------+---------+-------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | | +----+-------------+-------+-------+---------------+---------+---------+------+---------+-------------+ | 1 | simple | books | range | primary | primary | 10 | null | 4670

Serialize complex python objects with multiple classes and lists to JSON -

i trying serialize complex python object multiple nested objects , lists. problem encountered described here: python serialize objects list json now, have objects, lets say: class a: id = 0 objects_b = [] objects_c = [] class b: id = 0 class c: id = 0 = a() b = b() c = c() a.objects_b = [b] a.objects_c = [c] i don't want add custom methods each new class add structure. there way make unified serialization method handle each new class no matter how included, in list or parameter? method use object type great, tolerate subclassing objects general type too. trying figure last hour , going little crazy, ready create own serialization method without using json lib, thats seems much... json can serialize simple types (strings, dicts, lists etc). doesn't know how deal python objects. so if want serialize objects, there no way around defining own serialization of classes these objects belong to. can use json library (read default ) produce se

Problems reading bigquery google sheets federated data sources into cloud datalab via pandas_gbq -

this similar this question -- have same question, , 1 of commenters there said had solved didn't flesh out solution. i have data in google sheet, have set google bigquery federated data source (external data source). i want import data in cloud datalab using pandas_gbq when import usual (non-federated) bigquery tables, same project, in datalab instance works fine. when try import federated source (from google sheet) error: "genericgbqexception: reason: accessdenied, message: access denied: bigquery bigquery: no oauth token google drive scope found." i have tried follow mattm's instructions on original question post: "i had exact same issue , had enable both drive api project (in addition bigquery api), use bigquery+drive scopes. had manually permission sheets allow access ...@appspot.gserviceaccount.com account project used access google sheets with." i have enabled drive api project. i added service account used in datalab instance sharin

php - model Search with join 2 DB's YII2 -

i need compare 1 field "original" (db1 mysql) search, table database , (db2 sql) got error : sqlstate[42s02]: base table or view not found: 1146 table 'nexus.reparossigitm' doesn't exist sql being executed was: select intragovanalitico .* intragov_analitico left join reparossigitm on reparossigitm . if_tqi_codigo = tqi_codigo . tqi_codigo how can leftjoin 2 models ? my model 1 class intragovanaliticosearch extends intragovanalitico { [...] public function search($params) { // that's ok if doesnt need compare db field > //$query = intragovanalitico::find()->where(['if_poi_nome' => 'reativo','pl_operacao_pacote' => 'intragov','al_tipo_alarme' => 'disp']); // try > $query = intragovanalitico::find() ->select('intragovanalitico.*') ->leftjoin('reparossigitm', '`reparossigitm`.`if_tqi

Can't embed certain YouTube videos, iframe displays "the video contains content from WMG. it is restricted from playback on certain sites" -

i'm building instant youtube client in clojurescript , reagent, it's live @ http://instatube.net/ when try play music videos, displays error "the video contains content x. restricted playback on sites", yet same video plays fine on local server, iframe sends same referer , origin headers in both cases, works when embed video here https://www.w3schools.com/html/tryit.asp?filename=tryhtml_default don't understand issue is, iframe reagent component [:iframe {:class "embed-responsive-item" :allow-full-screen "allowfullscreen" :frame-border 0 :auto-play 1 :src (str "https://www.youtube.com/embed/" (if (nil? videoid) "sw-bu6keeuw" videoid) "?autoplay=1&enablejsapi=1")}]] and ajax request i'm sending youtube search api v3 using cljs-ajax (fn [term] (ajax/get "https://www.googleapis.com/youtube/v3/search" {:params {:q term

android - Facebook Login SDK -

Image
i trying make facebook login in app,but have misundertanding here. do need download facebook sdk,if importing in second part?if yes how should import facebook sdk packages thx. by adding mavencentral in repositories , adding com.facebook.android:facebook-android-sdk:[4,5) dependencies, adding facebook sdk application. make gradle build , try examples.

How can I make a trailing slash optional on a Django Rest Framework SimpleRouter -

the docs can set trailing_slash=false how can allow both endpoints work, or without trailing slash? you can override __init__ method of simplerouter class: from rest_framework.routers import simplerouter class optionalslashrouter(simplerouter): def __init__(self): self.trailing_slash = '/?' super(simplerouter, self).__init__() the ? character make slash optional available routes.

Does looking at a Django model's fk_id attribute trigger a database lookup? -

i'm writing script needs go through several hundreds of thousands of models.model objects , (depending on presence or absence of blank=true, null=true foreignkey field) perform actions. given following code: class relateditem(models.model): name = models.textfield() class item(models.model): related_item = models.foreignkey(relateditem) items = item.objects.all() item in items: if item.related_item: # stuff i know item.related_item trigger database lookup. hoping avoid this, wondering if instead this: items = item.objects.all() item in items: if item.related_item_id: # stuff would item.related_item_id still trigger database call, or field stored in model, , potentially therefore run faster? edit: note, i'm not looking use related_item, don't think need employ select_related or prefetch anything. said, if database lookups inevitable, , speed query (and not bog down machine's memory 100k items prefetched) go that. edit 2: can't ch

c# - xpath for foreach loop -

i have foreach loop parse html , using xpath it. need following <p class="section">sectiontext1</p> <p class="subsection">subtext1</p> ----need in first loop <p class="subsection">subtext2</p> ---need in first loop <p class="section">sectiontext2</p> <p class="subsection">subtext11</p> ---need in second loop <p class="subsection">subtext22</p> ---- need in second loop <p class="section">sectiontext3</p> foreach (htmlnode sectionnode in htmldocobject.documentnode.selectnodes("//p[@class='section']")) { count=count+2; string text1 = sectionnode.innertext; foreach (htmlnode subsectionnode in htmldocobject.documentnode.selectnodes("//p[@class='subsection'][following-sibling::p[@class='section'][1] , preceding-sibling::p[@class='section'][2

mysql - Join between two tables based on multiple criteria -

i have table accounts columns ip_from , ip_to , start_time , end_time , bytes . there second table called all_audit columns project , ip , time . need join tables in order resulting table columns project , time , bytes . things need considered time matches records fall between start_time , end_time . ip can match either ip_from or ip_to . the schema 2 tables are: accounts +----------------+---------------------+------+-----+---------+-------+ | field | type | null | key | default | | +----------------+---------------------+------+-----+---------+-------+ | ip_from | char(15) | no | pri | null | | | ip_to | char(15) | no | pri | null | | | bytes | bigint(20) unsigned | no | | null | | | start_time | datetime | no | pri | null | | | end_time | datetime | yes | | null | | +----------------+--------------------

vue.js - VueJs adding new key to object reference issue -

i have issue when adding new key object , dynamically modifying fields associated. for example add new column, set column name "url", attempt update value of url row 1. in example value not update though field has v-model="row[field.name]. there should make sure row[field.name] changed when field.name changes code: https://codepen.io/ruttyj/pen/zdgbpb <table> <thead> <tr> <template v-for="(field, f) in fields"> <th> <flex-row> <flex-column style="width: 100%;"> <flex> <input type="text" :value="field.name" @input="updatefield(f, 'name', $event.target.value)" style="width:100%"> </flex>

javascript - GULP tap.js - cannot read property -

i've strated using gulp building. i've run wall, while attempting run "scripts" cleaning. the error d:\github\asgard\basethemev2\src>gulp default [23:13:03] using gulpfile d:\github\asgard\basethemev2\src\gulpfile.js [23:13:03] starting 'lint:js'... [23:13:03] starting 'build:plugins'... [23:13:03] starting 'build:js'... [23:13:03] starting 'build:less'... [23:13:03] starting 'build:images'... [23:13:03] starting 'build:svgs'... [23:13:03] starting 'build:fonts'... [23:13:03] starting 'build:favicon'... [23:13:03] finished 'build:favicon' after 2.19 ms [23:13:03] finished 'build:plugins' after 78 ms d:\github\asgard\basethemev2\src\node_modules\gulp-tap\lib\tap.js:60 if (obj instanceof basestream && !obj._readablestate.ended) { ^ typeerror: cannot read property 'ended' of undefined @ destroyabletran

java - User Authentication with REST in a web app secured with Spring Security -

my spring boot-based web app authenticates against remote rest api. so, have extended abstractuserdetailsauthenticationprovider so: public class restauthenticationprovider extends abstractuserdetailsauthenticationprovider { @override protected void additionalauthenticationchecks(userdetails userdetails, usernamepasswordauthenticationtoken authentication) throws authenticationexception { // todo auto-generated method stub } @override protected userdetails retrieveuser(string username, usernamepasswordauthenticationtoken authentication) throws authenticationexception { string password = (string) authentication.getcredentials(); credentials creds = new credentials(); creds.setusername(username); creds.setpassword(password); resttemplate template = new resttemplate(); try { responseentity<authentication> auth = template.postforentity("http://localhost:8080/api

sql - Is it pointless to add a default value of NULL to a nullable field -

i have table used store configurable elements within system. for simplicities sake assume table structure: create table [dbo].[configuration_table] ( flag bit not null default 1, insert_datetime datetime not null default getdate(), update_datetime datetime default null) when initial insert completed time of entry has set. when update made, update date time set track when update flag occurred. is pointless set default value on nullable field null? in sql server there not advantage in doing that, because: when omit nullable column field list of insert use null when no default constraint value defined: -- insert_datetime null when no default constraint defined on column insert configuration_table (flag, insert_datetime) values (1,'20171209') if use keyword default value inserting default value use null when no constraint defined: -- insert_datetime null when no default constraint defined on colu

java - Single variable update of an Entity using a PUT request -

i have user entity follows: public class user implements serializable { @id @generatedvalue(strategy = generationtype.identity) @column(name = "id") private integer id; @column(name = "name") private string name; @column(name = "age") private integer age; @notnull @size(min = 5, max = 50) @pattern(regexp = regexconstants.email_regex, message = validationmessages.email_validation_message) @column(name = "email", unique = true) private string email; @notnull @size(min = 5, max = 50) @column(name = "password") private string password; @notnull @size(min = 5, max = 50) @column(name = "country_code") private string countrycode; /* getters , setters */ } i want update country code of user. want use put request seems appropriate choice (don't hate me using word appropriate here, might wrong) seems over-kill send user in req

php - Two symfony projects on one server/domain -

i've created 2 independent symfony projects , i've moved them prod server, example: project1.example.com [/var/www/project1/web] project2.example.com [/var/www/project2/web] the problem when open second address, project1 fired up. checked /var/www/project2/web/app.php , seems it's executed, reason, symfony loaders use /var/www/project1/ path. of course cache folders cleared. any ideas how diagnose problem? update apache config files: /etc/apache2/apache2.conf /etc/apache2/sites-enabled/project1.conf + /etc/apache2/sites-enabled/project2.conf update 2 strange thing, morning situation has reversed. both addresses show site project2 now. no config nor project files modified. you'll need enable virtual hosting in apache. take @ article on it, should answer question: https://alvinbunk.wordpress.com/2016/11/21/apache-httpd-virtualhost-config/ if need further that, can post question. use time. edit #2 - based on apache 2 conf: sug

apscheduler - python - telegram bot sendMessage in specific date -

i terribly new in python , progress snail:( want make telegram bot send message @ specific date , time. used apscheduler , telepot libraries that. , code: import telepot import sys import time time import sleep datetime import datetime apscheduler.scheduler import scheduler import logging bot = telepot.bot("***") logging.basicconfig() sched = scheduler() sched.start() exec_date = datetime(2017, 9, 12 ,1,51,0) def handle(msg): content_type,chat_type,chat_id = telepot.glance(msg) print(content_type,chat_type,chat_id) if content_type == 'text' : bot.sendmessage(chat_id,msg['text']) def sendsimpletext(): # content_type,chat_type,chat_id = telepot.glance(msg) # print(content_type,chat_type,chat_id) # # if content_type == 'text' : chat_id = telepot. bot.sendmessage(chat_id,'faez') def main(): job = sched.add_date_job(sendsimpletext, exec_date) while true: sleep(1)

vuejs2 - How to publish a vue js plugin that modifies an existing plugin -

i trying create plugin utilizes components vuejs plugin (vuetify). basically, have common components want share across multiple applications our company. i thought matter of: create github repo shared components author plugin reference repo in consuming apps via npm install here gist of plugin: // src/index.js <-- package.json/main set "src" import mycomponent "./mycomponent.vue"; import * api "./api"; export default function install(vue) { vue.component("mycomponent", mycomponent ); vue.prototype.$myapi = api; } at moment, behavior i'm seeing is: good plugin install function being executed functions api attached vue.prototype available in app components my-component available in app , renders markup bad $myapi , vuetify components not available in application instance of of my-component if copy same files app , change import, works expected. so, wonder if i'm missing regarding sharing

javascript - How to load js and css files from Assets folder with a string html in the Android Webview? -

how load js , css files custom html in android webview? here code snip below, image loading. code works on server. removing "file:///android_asset/" doesn't work too. files in "assets/katex". please help! //ria s.setjavascriptenabled(true ); // stringbuilder sb = new stringbuilder(); string customhtml = "<html><head>" + "<link rel=\"stylesheet\" type=\"text/css\" href=\"file:///android_asset/katex/katex.min.css\">" + "<script type=\"text/javascript\" src=\"file:///android_asset/katex/katex.min.js\"></script>" + "</head><body>" + "<script> alert(\"hey!\") </script>" + "<span class=\"q1\">x^2-xy+3y^2 = 15</span>" + "<p><img src=\"

Excel VBA to activate Powerpoint window by name -

i have macro in excel transfers data excel tables in powerpoint file. macro runs smoothly on computer, but, when had colleague try on his, gets run-time error '5' the error gets thrown portion of code: vba.appactivate (dir(sfilename)) sfilename defined right before file in shared folder on our network. is there better method of switching between specific excel window & specific powerpoint window? or, know might causing difference in macro's ability run on laptop vs coworkers? both have windows10 & office 2016. thanks,

python - Sort list of strings by digits appearing in each element -

this question has answer here: sort list of strings part of string 4 answers i have script purpose sort , process spatial dataset files being downloaded onto server. list looks this: list = ['file.t00z.wrff02.grib2', 'file.t00z.wrff03.grib2', 'file.t00z.wrff00.grib2', 'file.t00z.wrff05.grib2', 'file.t00z.wrff04.grib2', 'file.t00z.wrff01.grib2', 'file.t06z.wrff01.grib2', 'file.t06z.wrff00.grib2', 'file.t06z.wrff02.grib2', ...] as can see, each file has specific naming convention. later in script, files in list processed sequentially, need process them in order of time designated 2 digits following "wrff" in each filename (00, 01, 02...). i have regular expression removes files list don't match 2 digits following "file.t", necessary. there easy met

How to disable logging in nginx on root only? -

i store access logs uri other "/" particular server. however, due frequent pings on root uri, wan't disable logging uri. i'm using nginx 1.10.3. relevant configuration is: http { access_log /var/log/nginx/access.log; } server { access_log off; location ~ ^/$ { access_log /var/log/nginx/example_com_access.log combined; } } i have tried several configurations of access_log parameters. example, turning logging on server , off location using different methods match location (i.e. =, ~, (none), etc.) everything i've tried seems either log every request or log no requests server. ideas how accomplish this?

networking - How to forward packets from one network interface via another interface -

Image
see picture below architecture. i know there lot of similar questions. however, having read multiple posts , trying out still unable set required. posting new question. scenario: i have 3 containers ( c1 , c2 , c3 ) i have different interfaces each running in 3 containers ( eth0 , peervpnxx ) c1 has interfaces: eth0 , peervpn12 c2 has interfaces: eth0 , peervpn12 , peervpn23 c3 has interfaces: eth0 , peervpn23 whilst eth0 interfaces on same subnet peervpnxx interfaces on different subnets: peervpn12 - 10.12.0.0/24 peervpn23 - 10.23.0.0/24 note peervpnxx interfaces tunnel interfaces running on top of eth0 now ip_addresses assigned each container follows: c1 : 172.17.0.2 (eth0) , 10.12.0.2 (peervpn12) c2 : 172.17.0.3 (eth0) , 10.12.0.1 (peervpn12) , 10.23.0.1 (peervpn23) c3 : 172.17.0.4 (eth0) , 10.23.0.2 (peervpn23) what trying enable c1 communicate c3 via middleman c2 . in principle, trying to: route packets int

excel - UDF as criteria for advanced filter within macro error -

Image
if use udf generate criteria advanced filter, , run advanced filter using vba, 1004 error generated within udf. if advanced filter called excel, filter functions expected. why difference? (and yes, know there other methods can used. trying understand difference between calling advanced filter excel vs vba when using udf criteria). i filtering return entire row, if item in row has red font (rgb 255,0,0). udf within code below. in screenshot below, criteria formula are: a2: =isred(a8) b3: =isred(b8) c4: =isred(c8) the screenshot shows advanced filter functioning designed when called excel but when code below run, after column headers copied e1:g1 , code stops within udf above error message. @ time r.address = a8 i tried recording code when did advanced filter excel, , executing recorded code instead of below. resulted in same error. option explicit sub marine() dim rtable range dim rcriteria range dim rdestination range set rtable = range(&qu

apache - htaccess rewrite multiple conditions -

i don´t know how solve problem. need redirect http https in cases: redirect http://example.com https://example.com http://example.com/any-url https://example.com/any-url don´t redirect http://subdomain1.example.com http://subdomain2.example.com http://example.com/any-file.xml im turning on ssl domain has certification, , keep xml files without redirection avoid partners issues. any help? this rewrite should work: rewriteengine on rewritecond %{https} !=on rewritecond %{http_host} example.com rewritecond %{request_uri} !\.xml$ rewriterule (.*) https://%{http_host}%{request_uri}

html - How to align RangetoHTML code by Ron de Bruin? -

i'm working on left alignment of copied excel cells on outlook using vba. unluckily, whenever run program, excel cells copied on center alignment. need align in left form. function rangetohtml(rng range) ' changed ron de bruin 28-oct-2006 ' working in office 2000-2016 dim fso object dim ts object dim tempfile string dim tempwb workbook tempfile = environ$("temp") & "/" & format(now, "dd-mm-yy h-mm-ss") & ".htm" 'copy range , create new workbook past data in rng.copy set tempwb = workbooks.add(1) tempwb.sheets(1) .cells(1).pastespecial paste:=8 '.cells(1).pastespecial .cells(1).pastespecial xlpastevalues, , false, false .cells(1).pastespecial xlpasteformats, , false, false tempwb.sheets(1).usedrange.rows.autofit .cells(1).select 'cells(1).entirerow.autofit 'cells(1).entirecolumn.autofit application.cutcopymode = false on error resume next .drawingobjects.vi

Java: How to have a definite JProgressBar to load things? -

ok understand how indefinite jprogressbars don't understand how definite ones. example i'm using jprogressbar indicate loading game. in loading game have information want load in information files , initialize variables: private void load() { myint = 5; mydouble = 1.2; //initialize other variables } and have 4 files want load information from. how translate give accurate loading bar out of 100%? you need work in separate thread , update progress bar's model work progresses. it important perform model updates in swing event thread, can accomplished executing update code swingutilities.invokelater . for example: public class progress { public static void main(string[] args) { jframe frame = new jframe("loading..."); frame.setdefaultcloseoperation(jframe.exit_on_close); jprogressbar progressbar = new jprogressbar(0, 100); frame.add(progressbar); frame.pack(); frame.setvisible(tr

Is it possible to make some filtration in the Add Watch of Visual Studio C# -

i add large list of data a add watch of visual studio c#, , want see specific data, make filtration a in add watch such like a.where(o => o.date == today) a.groupby(o => o.symbol) ......

git - Cannot checkout GitHub repo from Jenkinsfile -

i have groovy script define jenkins workflow, , not able github checkout on 1 of jenkins server. same script works in 1st jenkins server not in another. both jenkins server on same version , githhub plugin updated console output of works: " using git_ssh set credentials github (ssh): " console output of not working: " using git_askpass set credentials github (https): " i think because of https checkout, can't figure out can change that. check in both instance git configuration, adding build step with: git config -l you might see, in case of machine using ssh, configuration like: url.ssh://git@github.com/.insteadof https://github.com/ if configuration not present in second machine, explain why https urls still used.

python - Error Msg: replace with Series.rolling(window=5).corr(other=<Series>) -

i trying find rolling correlation of 5 periods between columns ['high'] , ['low']. i manage calculate there error: futurewarning: pd.rolling_corr deprecated series , removed in future version, replace series.rolling(window=5).corr(other=) tried replacing doesnt work. help? import pandas pd df_gold = pd.read_csv('golddata.csv') df_gold['high_low'] = pd.rolling_corr(df_gold['high'],df_gold['low'],5) print(df_gold.tail()) try using df['col1'].rolling(5).corr(df['col2'])#pandas v 0.20 notice pd.rolling_corr(df['col1'],df['col2'],window=5)#panda v 0.17 (notice pd.rolling_corr deprecated series )

perl - Get value of elements using XML::DOM -

for life of me can't seem figure out. i got below sample file: <?xml version="1.0" encoding="utf-8"?> <datafile> <contract> <a>234</a> <b>234</b> <c>2fs4</c> </contract> <contract> <a>234</a> <b>21</b> <c>2fs4</c> </contract> <contract> <a>23v</a> <b>234</b> <e/> <c>2fs4</c> </contract> <contract> <a>234</a> <b>234</b> <e/> <c>2fs4</c> <d>234</d> </contract> <contract> <a>2343</a> <b>234</b> <e/> <c>2fs4</c> <d>3kv</d> </contract> </datafile> i want elem

Case in oracle sql -

what wrong code? select emp_id, emp_name emp case when :emp.designation_id = '008' designation_id = '003' case expression returns value. , case expression ends end . , case expression returns valid type. perhaps intend: select emp_id, emp_name emp designation_id = (case when :emp.designation_id = '008' designation_id = '003' end); a simpler way express this logic without case is: where :emp.designation_id = '008' , designation_id = '003' but intend: where (:emp.designation_id = '008' , designation_id = '003') or (:emp.designation_id <> '008' , designation_id = :emp.designation_id)

database - Kafka does not require that crashed nodes recover with all their data intact -

can tell me why?i don't understand why kafka not require crashed nodes recover data intact? thank much it's not required because typically kafka stores 3 copies of data spread out across multiple brokers in cluster. therefore if broker lost, can re-sync other copies of data stored on other brokers

python - How fix error in unit test? | AssertionError -

i trying write unit-test create function in django project. first experience creating of unit-tests. why cant create new data? error understand there no articles in test database. did mistake? tests.py: class articleviewtestcase(testcase): def setup(self): self.user = user.objects.create( username='user', email='user@gmail.com', password='password' ) self.client = client() def test_article_create(self): self.asserttrue(self.user) self.client.login(username='user', password='password') response = self.client.get('/article/create/') self.assertequals(response.status_code, 200) open('/home/nurzhan/downloads/planet.jpg', 'rb') image: imagestringio = stringio(image.read()) <-- error here response = self.client.post( '/article/create/', content_type='multipart/form-data', data={ 'head':

yii2 - How to change the behavior of the beforeAction? -

there beforeaction() in controller.php public function beforeaction($action) { if (parent::beforeaction($action)) { if ($this->enablecsrfvalidation && yii::$app->geterrorhandler()->exception === null && !yii::$app->getrequest()->validatecsrftoken()) { throw new badrequesthttpexception(yii::t('yii', 'unable verify data submission.')); } return true; } return false; } it throws exception want change in own controller extends controller.php. try that public function beforeaction($action) { if ($this->enablecsrfvalidation && yii::$app->geterrorhandler()->exception === null && !yii::$app->getrequest()->validatecsrftoken()) { yii::$app->session->setflash('info', 'error'); $this->goback(); } return parent::beforeaction($action); } but still shows exception. no

javascript - Search filter with regex stuck my search filter and It does work without refresh? -

i searching patient through search filter.it worked in simple case when search sabir\\ stuck , after removing searchtext sabir\\ not work.it doesn't generate request next time.how handle sabir\\ in angular2. in advance here code snippet url work , not work? work " http://172.16.1.101:8080/openmrs/ws/rest/v1/patient?q=sabir&v=full " not work " http://172.16.1.101:8080/openmrs/ws/rest/v1/patient?q=\ \&v=full" i using function handling url. validurl(str):boolean { var pattern = new regexp('^(https?:\/\/)?'+ // protocol '((([a-z\d]([a-z\d-]*[a-z\d])*)\.)+[a-z]{2,}|'+ // domain name '((\d{1,3}\.){3}\d{1,3}))'+ // or ip (v4) address '(\:\d+)?(\/[-a-z\d%_.~+]*)*'+ // port , path '(\?[;&a-z\d%_.~+=-]*)?'+ // query string '(\#[-a-z\d_]*)?$','i'); // fragment locater if(!pattern.test(str)) { return false; } else { r

amazon web services - AWS doesn't pick the zone from terraform when creating aurora rds -

currently have requirement of creating both aws instance , aurora rds instance in same availability zone. noticed rds instance doesn't pick giving availability zone. i.e : when pass zone ( eu-west-2a ) via attribute "availability_zones" inside terraform resource "aws_rds_cluster" rds instance creates in zone (eu-west-2b). common time regardless "count" value. we pass zone name "list" variable in runtime. i.e : tf_var_rds_aval_zones='[\"eu-west-2a\"]' terraform apply -var 'region=${env.region}' terraform output : ..... apply_immediately: "" => "<computed>" availability_zones.#: "" => "1" availability_zones.3230292939: "" => "eu-west-2a" backup_retention_period: "" => "1" ..... ( instance creates in "eu-west-2b". there no warnings in terraform out

tensorflow - What is the end result of this machine learning tutorial? -

i've been trying learn tensorflow , machine learning , article 1 of first tutorials i've stumbled onto: https://medium.com/towards-data-science/tensorflow-for-absolute-beginners-28c1544fb0d6 . stepped through code , thought understood vast majority of got final output set of 3 numbers, weights. how these weights supposed used? is, how put result use in real world scenario? weights trying optimize. the goal find set of weights, when given set of inputs ouput right answer. in case, have 1 (true) , -1 (false) inputs , bias one. goal learn , function. function should return 1 (true) when both inputs 1 (true), -1 (false) otherwise. when given new input [1, -1, 1] (bias 1 in case), function multiply these inputs weights computed earlier , sum result. if result of greater 0 output 1, if not, ouput -1

Azure Batch Job: using powershell how do we create batch context for "User Subscription" -

for azure batch jobs using powershell how batchcontext "user subscription" $context = get-azurermbatchaccountkeys -accountname $batchaccount -resourcegroupname $batchresourcegroup get-azurebatchpool -id $poolid -batchcontext $context get-azurebatchpool : operation returned invalid status code 'forbidden' can please let me know doing wrong.

video - Capture RTSP packets into a file -

i need suggestions on following: have capture rtsp packets flowing on network(suppose make call google hangout or skype you, there rtsp packets in network).i want capture same , save them file. any idea on how can done? can done through live media libraries?

python - gensim error : no module named gensim -

i trying import gensim. i have following code import gensim model = gensim.models.word2vec.load_word2vec_format('./model/googlenews- vectors-negative300.bin', binary=true) i got following error. importerror traceback (most recent call last) <ipython-input-5-50007be813d4> in <module>() ----> 1 import gensim 2 model = gensim.models.word2vec.load_word2vec_format('./model /googlenews-vectors-negative300.bin', binary=true) importerror: no module named 'gensim' i installed gensim in python. use genssim word2vec. install gensim using: pip install -u gensim or, if have instead downloaded , unzipped source tar.gz package, run: python setup.py test python setup.py install

javascript - focus() is not working in my html form -

i dont how working in snippet! :( checked many times. in output, password field getting focused when phone number wrong. function checkmatch() { var name = $("#username").val(); var address = $("#address").val(); var email = $("#emailid").val(); var mobile = $("#phonenum").val(); var password = $("#newpwd").val(); var cnfirmpassword = $("#confirmpwd").val(); if (password != cnfirmpassword) { alert("passwords not match."); $("#newpwd").val('').focus(); $("#confirmpwd").val(''); return false; } else if ((name == null || name == "") || (address == null || address == "") || (email == null || email == "") || (mobile = null || mobile == "") || (password == null || password == "") || (cnfirmpassword == null || cnfirmpassword == "")) { alert("please fill required fie

jquery - Auto login and access the Oracle ADF application from Oracle Apex -

i using oracle apex 5.1. in application need access oracle adf application oracle apex. used iframe view adf application apex. since logged in oracle apex, don't want login again in adf application. tried auto login while loading page using ajax post method. browser doesn't allow request due cross domain access issues. if possible way auto login or going wrong in code, please me. in advance. code used login in ajax: $.ajax({ url: 'https://xxxxxx.co.xx:7302/xxxx/faces/pages/login/login.jspx', data: {j_username: "xxxxx",j_password:"xxxxx"}, type: 'post', crossdomain: true, datatype: 'text/html', success: function() { alert("success"); }, error: function() { alert('failed!'); }, headers: { 'access-control-allow-origin': '*' } }); the error: cross-origin request blocked: same origin policy disallows reading

if statement - Multiple conditions for same variable in SAS -

i'm trying detect specific values of 1 variable , create new 1 if conditions fulfilled. here's part of data (i have more rows) : id time result 1 1 normal 1 2 normal 1 3 abnormal 2 1 normal 2 2 3 3 normal 4 1 normal 4 2 normal 4 3 abnormal 5 1 normal 5 2 normal 5 3 what want id time result base 1 1 normal 1 2 normal x 1 3 abnormal 2 1 normal x 2 2 2 3 normal 3 3 normal 4 1 normal 4 2 normal x 4 3 abnormal 5 1 normal 5 2 normal x 5 3 my baseline value (base) should populated when result exists @ timepoint (time) 2. if there's no result baseline should @ time=1. if result="" , time=2 do; if time=10 , result ne "" base=x; end; if result ne "" , time=2 base=x; ` it works correctly when time=2 , results exists. if results missing, there's

jmeter - How to consolidate the response codes from jtl file -

Image
i using jmeter doing load testing. how can consolidate response codes generated jtl files? are there best practices generate jtl file? (like failed sampler request , response) if open .jtl results file (by default normal csv file) using microsoft excel or equivalent (like libreoffice calc ) able see responsecode column hold http status codes values samplers the best practices of generating .jtl files storing absolute minimum data, , avoid of saving response data creates massive disk io overhead , may ruin test. if need store response data - add next lines user.properties file: jmeter.save.saveservice.output_format=xml jmeter.save.saveservice.response_data.on_error=true this switch .jtl files output format xml , "tell" jmeter save responses failed requests. see configuring jmeter , apache jmeter properties customization guide learn how precisely tune jmeter instances using properties. the general recommendations on jmeter usage can find in jme

excel - How to prevent XLSX Equation when write the metadata with POI -

Image
i using poi-3.16 write xlsx metadata(core/custom). fine, except if have equation textbox in excel sheet , after writing metadata equation symbols corrupted. any idea why metadata writing affect this? before writing metadata (actual value): after writing metadata (corrupted ? mark):

json - How to reformat and transform the output of jq? -

i have json string below: [{ "appid": "server1", "username": "bhavik", "scaleapp": { "imagename": "${data}/build-server:1", "internalpath": "/", "volumesfrom": [ "${data}/buildtype-mock:219", "${data}/buildtype-se:543-1.0.5-v30.2-ga" ] } }, { "appid": "server2", "username": "rajiv", "scaleapp": { "imagename": "${data}/build-server:159", "internalpath": "/", "volumesfrom": [ "${data}/buildtype-mock:218", "${data}/buildtype-se:540-1.0.5-v30.1-ga", "${data}/buildtype-nodejs:42", "${data}/b

go - How to integrate Oauth2 using golang? -

i have rest api created in golang works encrypted key authenticate requests. want integrate oauth2 authentication. couldn't find proper tutorial integrate oauth2 in project. have login api handler written in golang. func userlogin(c *gin.context){ response := responsecontroller{} var userdata userloginstruct usererr := json.newdecoder(c.request.body).decode(&userdata) if usererr != nil { response = responsecontroller{ config.failurecode, config.failureflag, "data not in proper format", nil, } getresponse(c, response) return } var err error usersaveddata, getusererror := models.getcompleteuser(bson.m{"email_id": userdata.username}) if getusererror != nil{ response = responsecontroller{ config.failurecode, config.failureflag, "invalid email", nil, } getrespons