Posts

Showing posts from August, 2015

php - setISODate work that way? -

i testing these cases: $date = new \datetime(); echo($date->format('y.m.d')) . php_eol; $date->setisodate(2018, 1, 1); echo($date->format('y.m.d')) . php_eol; $date->setisodate(2019, 1, 1); echo($date->format('y.m.d')) . php_eol; $date->setisodate(2020, 1, 1); echo($date->format('y.m.d')) . php_eol; ouput: 2017.08.17 2018.01.01 2018.12.31 2019.12.30 i understood show this: 2017.08.17 2018.01.01 2019.01.01 2020.01.01 why happen? surely there did not quite understand. the arguments year , week , dayofweek . php's week starts on monday, , week 1 of year first week has @ least 4 days in january. in 2018, year starts on monday, week 1 starts on january 1, , that's day 1 of week. in 2019, year starts on tuesday, week 1 starts on monday, december 31, 2018, , that's day 1 of week. in 2020, year starts on wednesday, week 1 starts on monday, december 30, 2019, that's day 1 of week.

python - How can i update pandas dataframe columns based on index -

in pandas have dataframe: df1 = pd.dataframe({'type':['application','application','hardware'], 'category': ['none','none','hardware']}) i have following index retrieve rows type contains "application" , category contains 'none'. df1[df1['type'].str.contains('application') & df1['category'].str.contains('none')] category type 0 none application 1 none application i update column category such value 'some new value' each row. i have tried same following loc index no success df1[df1.loc[:,'type'].str.contains('application') \ & df1.loc[:,'category'].str.contains('none')] thanks. are looking this? df1.loc[(df1['type'] == 'application') & (df1['category'] == 'none'), 'category'] = 'new category' category

html - How to make 3 absolute-positioned elements stick together even they are scaled resonsively? -

Image
i trying achieve this: the 3 drinks stuck in mobile version. know, scale browser width, elements should scaled well. it's hard use percentage width , height's measurement. i have following code: <div class="s-drinks"> <div class="drink-wrap-col1"> <div class="drink"> <img src="https://placehold.it/300x500" alt="popular drink"> </div> </div> <div class="drink-wrap-col2"> <div class="drink--secondary"> <img src="https://placehold.it/300x500" alt="popular drink"> </div> </div> <div class="drink-wrap-col3"> <div class="drink

regex - `Nothing` in macro crashes Excel 2013 -

Image
i'm trying use regex in excel 2015 macro. don't know if i'm doing wrong, every time run it, excel crashes. here's macro: sub makeexplicit() dim whitespace regexp set whitespace = new regexp whitespace.pattern = "\s+" whitespace.multiline = true whitespace.global = true dim implicit regexp set implicit = new regexp implicit.pattern = "^\d+-\d+$" dim row range each row in activesheet.usedrange.rows dim first range set first = row.cells(1, 1) dim str string str = first.text str = whitespace.replace(str, nothing) if implicit.test(str) 'fixme here crashes dim fromto variant fromto = split(str, "-") dim sfrom, sto integer sfrom = fromto(1) sto = fromto(2) ' doplň chybějící číslice ' např [2345, 78] doplní ' na [2345, 2378]

c++ - For-Loop on Pointer: Does it move the whole address range? -

i have bit of code: int count_x(char* p, char x) { if (p == nullptr) return 0; int count = 0; (; *p != 0; p++) { if (*p == x) count++; } return count; } the input in case char-array: char v[] = { "ich habe einen beispielsatz erstellt!"}; since looking cpp book "c++ programming language - 4th edition" got code there , trying figure out. when stepping through it, noticed loop moves memory address in increments of one. not surprising me, following question arose , couldn't find answer yet: loop reduce overall memory range or whole range being moved? since knowlege use "block" in whole storing such char-array (or type of array), guess later since don't see reducing boundries. "knowledge" have ask: doesn't cause major issues theoretically possible read parts of memory programm shouldn't have access to? will have keep in mind when dealing (very) long arrays? in c , c++, "strings thi

python - Trouble Transforming IEEE 754 data to be displayed in PyQt4 -

i have large image stored in nparry each pixel ieee 754 formatted. trying view image in pyqt4. have tried using qimage , qpixmap available formats have been unable view image properly. hoping there module transforms ieee 754 data format pyqt4 able display.

python 3.x - Difference between python3 and python3m executables -

what difference between /usr/bin/python3 , /usr/bin/python3m executibles? i observing them on ubuntu 13.04, google suggests exist on other distributions too. the 2 files have same md5sum, not seem symbolic links or hard links; 2 files have different inode numbers returned ls -li , testing find -xdev -samefile /usr/bin/python3.3 not return other files. someone asked similar question on askubuntu , wanted find out more difference between 2 files. credit goes chepner pointing out had link solution. python implementations may include additional flags in file name tag appropriate. example, on posix systems these flags contribute file name: --with-pydebug (flag: d) --with-pymalloc (flag: m) --with-wide-unicode (flag: u) via pep 3149 . regarding m flag specifically, pymalloc is: pymalloc, specialized object allocator written vladimir marangozov, feature added python 2.1. pymalloc intended faster system malloc() , have less memo

git - Cannot merge branch into master nor checkout -

i have following 3 branches in local git repo: $ git branch all_athors_&_views * master third_requirement when try merge "all_athors_&_views" "master", shows following error: $ git merge all_athors_&_views [1] 27637 -bash: _views: command not found merge: all_athors_ - not can merge [1]+ exit 1 git merge all_athors_ when try checkout "all_athors_&_views", shows following error: $ git checkout all_athors_&_views [1] 27648 -bash: _views: command not found error: pathspec 'all_athors_' did not match file(s) known git. [1]+ exit 1 git checkout all_athors_ it checkouts between "master" , "third_requirement". first time run problem , haven't been able figure out. have mention file shared virtual machine via vagrant directory (not sure if information helpful). try wrapping branch names in quotes: git "merge all_athors_&_views" th

php - Where is the Xampp mailoutput folder on mac? -

i know on windows has c:\xampp\mailoutput folder however, same folder on mac? (i want test out sending email on localhost, , said can find email sent through c:\xampp\mailoutput folder , have find same folder on mac in order see mails ) default install path : /applications/xampp

haskell - Recursion error while sorting a list of numbers without quicksort -

order :: [int] -> [int] order [] = [] order [x] = [x] order (x:y:xs) = if x>y [y] ++ (order (x:xs)) else [x] ++ (order (y:xs)) i tried use haskell code sort list of numbers, when input list more 4 elements doesn't sort them correctly. want keep code compiles don't know how make recursion work correctly. the code fine , implemented, implemented not in fact sort list. let's try [4,3,2] : order [4,3,2] order [] = [] -- nope not empty list order [x] = [x] -- nope not singleton order (x:y:xs) = if x>y -- x=4, y=3, xs =[2]; x >y true [y] ++ (order (x:xs)) -- branch [3] ++ (order [4,2]) else [x] ++ (order (y:xs)) -- not branch so [3] ++ (order [4,2]) . question you: how 2 move other side of 3 ?

testing - Can I use Appium desktop to run test scripts? -

have gone through several appium desktop tutorial of them showed how manually test in inspector window. does appium desktop support automation test scripts? if so, how send tests written in node it, or there handy npm package connection? thanks! finally connected webdriver appium . turns out webdriver can used mobile testing. here several points got me confused, hope can came same scene: webdriver not web exclusive - can used mobile e2e testing. appium server , appium inspector not work together. once server started, can connected appium inspector or other services, e.g. webdriver. inspector manual inspection. far haven't seen possibility supply automation test scripts it. and here's complete walkthrough who're not familiar appium.

amazon web services - Sample javascript browser code for uploading multiple files into AWS S3 -

i have searched topic didn't luck. have tried following: $.each(uploadingdata.files, function(key, value) { file = value; var params = { key: 'content-upload-development/' + file.name, contenttype: file.type, body: file }; bucket.upload(params).on('httpuploadprogress', function(evt){ console.log(1); var percent = parseint((evt.loaded * 100) / evt.total); var signedformdata = null; console.log(percent); $(document).trigger("amazonstatusupdateevent", ["uploading", file.name, percent, signedformdata]); }).send(function(err, data) { var signedformdata = {}; console.log('error is: ' + err); //signedformdata.fileurl = data.location; signedformdata.filesize = "400m"; $( document ).trigger( "amazonstatusupdateevent", [ "completed", file.name, 100, signedformdata ] ); }); if(counte

pycaffe - Making sure if Caffe is using multiple-GPUs -

i new using training neural networks. have access gpu cluster , fine-tuning version of alex-net scene classification. i have access 2 gpus right , want use both of them training. nvidia-smi command gives me id of gpus (which 0 , 1). this how training use both of gpus: caffe.set_mode_gpu() caffe.set_device([0,1]) is right way use it? python allows choose single gpu using set_device() . multi-gpu supported on c++ interface. --gpu flag used purpose discussed here . gpus used training can set --gpu flag on command line caffe tool. example, build/tools/caffe train --solver=models/bvlc_alexnet/solver.prototxt --gpu=0,1 will train on gpus 0 , 1.

data structures - For "any" binary tree, what is the relation between all nodes and internal nodes -

the original question below. for any binary tree n nodes , internal nodes, relation between n , _____ <= i. in opinion i thought n/2 <= i, can't not figure out condition let n/2 = i. want ask root node internal node? in full tree there 1 + 2 + ... + 2^(h-1) internal nodes , 2^h leaf nodes (where h height of tree). that means total number of nodes n = 1 + 2 + .... + 2^h = 2^(h+1)-1 = 1 + 2 + ... + 2^h-1 = 2^h - 1 now, relation looking for: n-i = 2^h+1 - 1 - 2^h + 1 = 2^h+1 - 2^h = 2*2^h - 2^h = 2^h since 2^h = i+1 , get: n - = i+1 n - 1 = 2i (n - 1)/2 = (note there no issue non integer result, since n odd in full tree). now, have left show full tree indeed 1 highest such ratio (this left reader).

unity3d - Can't link iOS project with il2cpp and Unity -

Image
any of know happening project ? there error: ld: symbol(s) not found architecture arm64 unity player settings this: il2cpp scripting backend support deploying arm 64-bit on ios, , mandatory deploy apple app-store releasing new apps. there ios 64 bit upgrade guide provided unity states how start using il2cpp on ios pick in scripting backend dropdown in player settings. by default build universal architecture (including both arm64 , armv7), if needed might switch specific architecture in player settings. there number of things should done before application , running in 64 bits: you need 64 bit capable device test on. these ios devices a7 or later chip (currently these are: iphone 5s, ipad air, ipad mini retina, iphone 6, iphone 6 plus, ipad mini 3, ipad air 2). you need native plugins compiled 64 bit support (or provided source code). if using 3rd party plugin, should contact plugin vendor obtain 64 bit capable , il2cpp compatible version of plugin.

jquery - Button click has to be in order in javascript -

i have 2 buttons in same form 1 submit , save cm , want give alert if user clicking save cm button out first clicking search button . calling same js function both of these onclick event passing variable says clicked function setaction(var) if (var == action) { } else // save cm { } i tried many ways nothing working 1. tried include hidden variable in form , changed hidden variable value in if( var ==search ) , when clicked save cm again going function again new call , not able previous function call value if (action == 'save cm') { if(document.getelementbyid('searchbuttonclicked').value==='notclicked') { alert(document.getelementbyid('searchbuttonclicked').value); alert('please search physician before saving content manager'); return false; } } the above condition true i tried disable button when page loads and in search action fun

typescript - Lost in asynchronous function. Aways get undefinned -

sorry english. can't head around asynchronous programming ! need update node call stoken of user wich variable useraux2 . no matter how try undefineed . have read every question , tried many diferrents ways, don't know how set useraux2 = return snapshot.key; (wich btw, snapshot prints ok in console). i hope can me, don't know else do! thanks!! async loginuser(newemail: string, newpassword: string, company: string): firebase.promise<any> { var useraux2: string; await this.getcurrentuserid(newemail, company).then((useraux) => { useraux2 = useraux; }); console.log('useraux2 ==============>>>> ' + useraux2); //this 1 undefinned await this.updatetoken(useraux2, company).then(() => { return this.afauth.auth.signinwithemailandpassword(newemail, newpassword); }); } // id of single user async getcurrentuserid(email: string, company: string): promise<any>{ var

jquery - How to load a php or html file in append -

i need load php file shown below."how can insert or load php code" <script> $(document).ready(function() { $("#tabs").tabs(); $("#btn2").click(function() { var num_tabs = $("div#tabs ul li").length + 1; $("#tabs ul").append("<li><a href='#tabs-" + num_tabs + "'>ajay#" + num_tabs + "</a></li>"); $("div#tabs").append("<div id='tabs-" + num_tabs + "'>" how can insert or load php code " < /div>").append(aj); $("#tabs").tabs("refresh"); }); }); </script> you need pass num_tabs value in php file. here in example have passed using tab_num variable. get tab_num variable using $_get in php file. echo desired html in php file , data in data variable. <script> $(document).ready(function() {

machine learning - how to use iter_size in caffe -

Image
i dont know exact meaning of 'iter_size' in caffe solver though googled lot. it says 'iter_size' way increase batch size without requiring gpu memory . could understand this: if set bach_size=10,iter_size=10, behavior same batch_size = 100. but 2 tests on this: total samples = 6. batch_size = 6, iter_size = 1, trainning samples , test samples same. loss , accuracy graph : total samples = 6. batch_size = 1, iter_size = 6, trainning samples , test samples same. from 2 tests, can see behaves differently. so misunderstood true meaning of 'iter_size' . how can behavior of gradient descent same on samples rather mini_batch? give me help?

plsql - How to handle Special char in xml file while using DBMS_SQL.EXECUTE ? in dynamic query -

when pass collection record of cursor "c" , execute using dbms_sql.execute xml file, have using special character "&" etc... other non spl-char record has been executed dynamic query value using special char throwing error - ora-31011: xml parsing failed. here code c := dbms_sql.open_cursor; -- parse sql statement dbms_sql.parse(c, p_sql(i), dbms_sql.native); -- start execution of sql statement d := dbms_sql.execute(c);

java - Refactoring usage of a util method -

in 1 of our projects, there has been utils defined follows: // check if collection null or empty public static boolean isnullorempty(collection collection) { return collection == null || collection.isempty(); } but of api usages of form: list<string> samplelist = null; // process samplelist if(!utils.isnullorempty(samplelist)) { // action } where end checking inverse. there's proposal add method: public static boolean isnotnullorempty(collection collection) { return !isnullorempty(collection); } which replace such usages of api shared above if(utils.isnotnullorempty(samplelist)) { // action } imp : wouldn't want alter usages utils.isnullorempty not accompanied ! . q1. 1 task here refactor existing usages once we've added isnotnullorempty utility. there ide implementation can such refactoring (using intellij) q2. in terms of implementation, usefulness can derived change? remember intellij's inspection results reporti

how to pass client id and respective things in parser.add_argument in python -

hi in python code there function called parser.add_argument.so in how pass client id,client secret,path,query id.can please me how solve problem.below code.so please tell me how pass client id , in parser.add.argument.help me out of problem.thank you import argparse contextlib import closing datetime import datetime datetime import timedelta import os import urllib2 # .util import parttypenum # optional filtering arguments. parser = argparse.argumentparser(description='downloads report if has ' 'been created in given timeframe.') parser.add_argument('--client_id', required=true, help=('your client id google developers console.' 'this should provided along ' 'client_secret first time run example.')) parser.add_argument('--client_secret', required=true, help=('your client secret google develop

c# - Getting an Exception "AccessViolationException was unhandled" in Native C++ -

hi working in visual studio 2013 1 solution has c# , c++ projects. c++ written in both managed , unmanaged code. i getting exception while loading image file ui , flow of code explained below: ui (c# code) shall call --> c++ (managed) shall call --> c++ (native/unmanaged code) , getting exception here. i feel marshaling may solve issue.. can suggest how can sort exception? given code snippet of flow call stack flow c# manged c++ , native c++: i_engine.dll!ccadinterface::setside(int side) line 275 c++ i_engine.dll!ardimport::read(char* filename) line 82 c++ [external code] i_engine.dll!i_cut::i_engine::getcurvefile(system::string^ filename, filetypeenum filetype, system::string^ mappingname, visiondatabasic* pvisiondata, system::string^& errortext) line 1178 + 0x45 bytes c++ i_engine.dll!i_cut::i_engine::createvisiondata(system::windows::forms::form^ parent, i_cut::jobproducer^ jobproducer, i_cut::pmwrapper^ pm, bool creatingpreview) line 517

How to create a list to hold images inside a webix form -

i have webix form below: var myform = { id: "formid", view : "form", scroll: false, elements : datasheet, rules : { "name":webix.rules.isnotempty } }; var datasheet = [ {view:"text", label:'name', name:"fname", value: "put name"}, {view: "checkbox", id:"field_a", label:"second age", value:1}, {view: "template", template: "header template", type: "header"}, {view: "template", template:"<div id= 'mydiv'><ul><li>1st item</li><li>2nd item</li></ul></div>"} ] in similar fashion above, want have list (< ul> < /ul> or < li> < /li>, may inside div) hold image items. how can define inside datasheet variable above can manage list later populating or removing items. thanks. just place webix list widg

php - WoCommerce Add-On products as single products -

we want show customers in our woocommerce shop add-on products @ footer of single product. example: product „computer case“. , instead of releated products @ end of single product page want show add-on products mainboard example. but want integrate these products single products, not addons plugin https://woocommerce.com/products/product-add-ons/ is there solution - maybe use releated product feature?

python 2.7 - importing files from multiple directories -

though have found multiple post on topic none has been proved solution problem. i have directory structure- /home/ss/pos/ python module score.py tag.py rdrtag.py sits. importing score , rdrtag in tag.py . rdrtag.py importing functions other directory present in /home/ss/pos/ now need create python file in other location needs make call function in tag.py . using imp module's load_source function create module object , call function of tag.py . throws error no score rdrtaf module exist. other directory references used in rdrtag not working import imp h=imp.load_source('tag',"/home/ss/pos/tag.py")

converter - how to get html code from pdf,docx,doc using php -

i want convert pdf,docx,doc file html code using php. same style in pdf. not getting proper solution. config::set('pdftohtml.bin', 'c:/poppler-0.37/bin/pdftohtml.exe'); // change pdfinfo bin location config::set('pdfinfo.bin', 'c:/poppler-0.37/bin/pdfinfo.exe'); // initiate $pdf = new gufy\pdftohtml\pdf($item); // convert html , return [dom object](https://github.com/paquettg/php-html-parser) $html = $pdf->html(); not working me. i think this post in first time. one, you'll able convert pdf html code using php. after this, can use provided this post convert .doc , .docx pdf using php. i think can built function each document extension want convert html. good luck.

javascript - Backbone.js - Solving method -

backbone , jquery i have piece of code: var chatmessage = backbone.view.extend({ el : '#friend-list', events : {}, initialize : function() {}, loadmessage : function(parent_id) { //ukrycie komunikatów etc. $("#chat_body").html(''); $("#end-record-info").hide(); $("#end-record-load").hide(); page = 1; this.ajax(parent_id,page); //initial data load }, ajax : function(parent_id,page) { $.getjson( "/**/**/"+parent_id+"/"+page, function( json ) { $("#end-record-load").hide(); this.build(json.message, page); page ++; //page increment loading = false; //set loading flag off end_record = false; if(json.max < page){ //no more records end_record = true; //set end record flag on return; //exit } });

core - How to compare two different dates in velocity in Java? -

#set( $currentdate = 'june 1,2016') #set( $settledate = 'dec 1,2016') #if( $currentdate < $settledate) <li>xyz</li> #end you can use comparison tool difference function $date.difference('2016-12-01','2016-06-01') or whenis $date.whenis('2016-12-01','2016-06-01')

javascript - how to mock module when using jest -

i'm using jest unit test in vuejs2 project got stuck in mocking howler.js , library imported in component. suppose have component named player.vue <template> <div class="player"> <button class="player-button" @click="play">player</button> </div> </template> <script> import { howl } 'howler'; export default { name: 'audioplayer', methods: { play() { console.log('player button clicked'); new howl({ src: [ 'whatever.wav' ], }).play(); } } } </script> then have test file named player.spec.js . test code written based on answer here , test failed since called wasn't set true. seems mocked constructor won't called when running test. import player './player'; import vue 'vue'; describe('player', () => { let called = false; jest.mock('howler', () => ({ howl({ src

linux - VMware kernel module updater error in Parrot Security -

i'm using parrot security os v3.7 kernel v4.11 , while using vmware on device installs perfectly, when try run vmware, kernel module updater fails , gives me "unable start services" error. i tried online not working me. there anyway around it? or have downgrade kernel fix problem (if yes, version?).

sql server - Why jdbc executing sqlserver proceduce takes 10 min but navicat or ssms only 50s? -

i use sqlserver-jdbc driver execute query in java, have wait 700s before returning result set, it's 50s when navicat or ssms instead. has similar problem, can't find reason since don't know datebase much,. use script cached execution plans of sp: select cp.objtype objecttype, object_name(st.objectid,st.dbid) objectname, cp.usecounts executioncount, st.text as querytext, qp.query_plan queryplan sys.dm_exec_cached_plans cp cross apply sys.dm_exec_query_plan(cp.plan_handle) qp cross apply sys.dm_exec_sql_text(cp.plan_handle) st objtype ='proc' and object_name(st.objectid,st.dbid) = '__your_sp_name__'; i suppose ssms , sqlserver-jdbc driver use different cached plans.

rspec - Running unit tests for Puppet modules -

i add rspec unit tests puppet 4 modules. started , confirm basic functioning, first run unit tests come standard puppet modules such puppetlabs/apt . if try running specific unit test so cd modules/apt rspec spec/classes/apt_spec.rb i failures, , of diagnostic output seems indicate part of puppet runtime environment (such module stdlib , defines function merge ) not picked correctly: failures: 1) apt defaults should contain file[sources.list] notifies class[apt::update] failure/error: { is_expected.to contain_file('sources.list').that_notifies('class[apt::update]').only_with({ :ensure => 'file', :path => '/etc/apt/sources.list', :owner => 'root', :group => 'root', :mode => '0644', :notify => 'class[apt::update]', })} puppet::preformattederror: evaluation error: unknown function: 'merge'

c# - Application seems loaded wrong dll when runing in standalone mode -

i upgrade .net3.5+vs2008 .net4.6.1+vs2015, , goes smooth @ beginning. when trying start application in standalone mode(by publish or debug folder) problems happened. this cs project including framework/common/login provide dll, , final application reference these dlls. when running debug, application goes fine , break point can set. but, when debug folder, application seems loaded wrong dll, don't know goes, business logical not correct. attaching vs, can see break point in not hit. i checked dll loaded in running process using process explorer, found dlls correct , x86/debug folder. does meet similar issues before, or have advise. application load cache?

reactjs - Avoiding mutiple refs to props in component -

a typical component duplicate props, there best practice props once component? rather set them again in submitform() class screen3 extends component { constructor() { super(); this.submitform = this.submitform.bind(this); this.onchange = this.onchange.bind(this); } submitform(e) { const age = this.props.age; const gender = this.props.gender; const ethnicity = this.props.ethnicity; .... } onchange(e) { const field = e.target.name; const value = e.target.value; ... } render() { let { age, gender, ethnicity } = this.props; .... const mapstatetoprops = store => { return { age: store.userdetails.age, gender: store.userdetails.gender, ethnicity: store.userdetails.ethnicity }; };

python - Makefiles does not start conda environment -

i have makefile .phony: start-generate start-generate: source activate myenv mkdir "data_channels_`date +%y%m%d_%h%m%s`" python main/datageneration.py ./"data_channels_`date +%y%m%d_%h%m%s`" 3 but when run get $ make start-generate source activate myenv make: source: command not found make: *** [start-generate] error 127 although able run source activate myenv outside make. if alternatively try start-generate: ( \ source activate myenv; \ mkdir "data_channels_`date +%y%m%d_%h%m%s`"; \ python main/datageneration.py ./"data_channels_`date +%y%m%d_%h%m%s`" 3; \ ) i error /bin/sh: 2: source: not found traceback (most recent call last): file "main/datageneration.py", line 1, in <module> import pandas pd importerror: no module named pandas make: *** [start-generate] fehler 1 the error pandas obviously, because source-command did not work. , regarding there message

php - Is there any way to include HighCharts graph into DomPdf -

i using dompdf generate pdf in php, need include graphs generated pdf. using highcharts generating charts. there way. code: $dompdf = new dompdf(); $html1 = ' abc {padding: 0; margin: 0; font-family: arial, helvetica, sans-serif; color: #000; box-sizing: border-box;} .page {width: 750px; margin: 0 auto; position: relative;} .name, .date, .pera {position: absolute; z-index: 1;} .name, .date {left: 288px; font-size: 24px;} .name {bottom: 380px;} .date {bottom: 330px;} .pera {top: 185px; left: 0; width: 100%; padding: 0 90px 0 40px; font-size: 21px;} .pera strong {font-style: italic;} '; $html1 .= 'gaurav saxena'; $html1 .= ''.$daten.''; $html1 .=' '; $dompdf->loadhtml($html1); /* render html pdf */ $dompdf->render(); $pdf1 = $dompdf->output(); $pdf_name1 = "chart-report"; $file_location1 = $_server['document_root']."/assessments/secure/admin/pdfreports/".$pdf_name1.".pdf&

java - Parsing <T extends Interface<T>> and ending a potential infinite cycle -

consider class definition starts class pokemon extends playable<pokemon> this similar more common class pokemon implements comparable<pokemon> , imposes total ordering on pokemons. although have been seeing , writing time, realized (after fielding question) theoretical standpoint @ least, there risk of infinite loop in parsing if 1 not careful. consider this: step 1: compiler or classloader tries parse (or load) pokemon , sees needs parse playable<.> first. step 2: compiler realizes because playable parameterized pokemon , needs load or parse pokemon . find ourselves going step 1, , never-ending cycle established. in practice, know not case, because works. how cycle broken? theory @ end of step 2, compiler or classloader stops , use "reference" pokemon instead of pulling pokemon source code. don't know enough javac or classloaders affirm this. weigh in? this similar "loop" in declaration: class linkedlistnode {

postgresql - How to declare a record on a user-defined type in postgres -

i have snippet of code in oracle, creating variable of record type type t_article record (article_id sch.article.article_id%type, short_article_title sch.article.short_article_title%type, short_article_text sch.article.short_article_text%type, pub_ts sch.article.pub_ts%type, paren_info varchar2(500), article_date sch.article.article_date%type); v_article_rec t_article; how can declare above code create user defined record in postgres? i tried using below code in postgres, type v_article_rec (article_id sch.article.article_id%type, short_article_title sch.article.short_article_title%type, short_article_text sch.article.short_article_text%type, pub_ts sch.article.pub_ts%type, paren_info varchar2(500),

rethinkdb - How to use ReQL filter and match command on arrays -

i have table in rethinkdb each row has following structure - { 'name':'clustername', 'services':[ { 'name':'service1' }, { 'name':'service2' } ] } i running query filter service2 object this r.table('clusters').filter({"name": "clustername"}) .pluck('services').filter((service) => { return service("name").match('service2') }) but not returning anything: no results returned query can tell why happening? pluck returns sequence, query: r.table('clusters').filter({"name": "clustername"}).pluck('services') will return: { "services": [ { "name": "service1" } , { "name": "service2" } ] } you need services field it, return array services field of

javascript - How to set a specific json response object as a js var - Cloudinary -

i using cloudinary host profile images set users. i'm using php web application -> here instructions provided cloudinary http://cloudinary.com/documentation/php_image_upload#overview the problem encounter want display image directly after upload parsing newly created url image returned json. when console.log provided cloudinary: $(document).ready(function() { $('.cloudinary-fileupload').bind('cloudinarydone', function(e, data) { console.log(data); return true; }); }); this console.log response receive can please me javascript or jquery function can use in order display updated image in image tag. you need read tree... jqxhr.responsejson.url in case, use data.result.url see example of http://cloudinary.com/documentation/php_image_upload#preview_thumbnail_progress_indication_multiple_images

android - Can I use a custom decoder to downsample an image before loading it in Glide? -

i'm trying make panorama viewer takes 360 degree picture , map cylinder. i've gotten part right, based on modification of md360player4android library, , i'm using glide instead of picasso. however, problem right when try load 360 picture (which 2500-3000px x 19168px in size), image fails load oom exception. the glide method used results in oom: glide.with(getactivity()) .load(path) .asbitmap() .override((int)(width/2.4f), (int)(height/2.4f)) .fitcenter() .diskcachestrategy(diskcachestrategy.none) .into(commonsimpletarget); currently have method instead: new asynctask<void, void, bitmap>() { @override protected bitmap doinbackground(void... params) { //downsampling image opts.insamplesize = 4; opts.injustdecodebounds = false; try { bitmap res = bitmapfactory.decodestream(getactivity().getcontentresolver().openinputstream(uri), null, opts); if(height > width){

c# - Transparent background for WPF Listview Header -

i wish create table using listview . the background of table header must transparent. how achieve this? set background of listview transparent , define gridviewcolumnheader style sets background transparent : <listview ... background="transparent"> <listview.resources> <style targettype="gridviewcolumnheader"> <setter property="background" value="transparent" /> </style> </listview.resources> <listview.view> <gridview> <gridviewcolumn .../> </gridview> </listview.view> </listview>

python 2.7 - There are two format of Time series datetime in the same series, how to change them to one format? -

Image
i want split time series 2 set: train , test. here's code: train = data.iloc[:1100] test = data.iloc[1101:] here's time series looks like: and here's train series:there's no time, date in index. finally, test: how change index same form? consider simplified series s s = pd.series(1, pd.date_range('2010-08-16', periods=5, freq='12h')) s 2010-08-16 00:00:00 1 2010-08-16 12:00:00 1 2010-08-17 00:00:00 1 2010-08-17 12:00:00 1 2010-08-18 00:00:00 1 freq: 12h, dtype: int64 but when subset s leaving timestamp s need no time element, pandas me "favor" of not displaying bunch of zeros no reason. s.iloc[::2] 2010-08-16 1 2010-08-17 1 2010-08-18 1 freq: 24h, dtype: int64 but rest assured, values same: s.iloc[::2].index[0] == s.index[0] true and have same dtype , precision print(s.iloc[::2].index.values.dtype) dtype('<m8[ns]') and print(s.index.values.dtype) dtype('&l

c# - Icon color remains blue on IOS toolbar xamarin.forms -

Image
i have used red icon on toolbar , still remains in color blue it's default. how can change color red. because icon's color red. how can tackle please. below image : and xaml code : <?xml version="1.0" encoding="utf-8"?> <contentpage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" icon ="nav_icon.png" title="ea " x:class="eamobiledirectory.masterpage"> <stacklayout> <image source="featured_newline_1.png" margin="0,1,0,0"/> <listview x:name="listview" margin="0,10,0,0" verticaloptions="fillandexpand" separatorvisibility="none"> <listview.itemtemplate> <datatemplate> <imagecell text="{binding title}" imagesource="{binding ico

Android crash in some actions when Instant run is turn off -

i have strange problem. when have instant run turn on, works fine. when turn off instant run, actions crash application. cant debug because if comment lines or use try-catch aplicattion still crash. same problem when make apk , try run on phone. aplication crush on action, , can not check wrong. can me problem?

prediction - How to predict with ARIMA in Python -

the following code adapted a related question , have never got working. def objfunc(order, endog, exog=none): statsmodels.tsa.arima_model import arima fit = arima(endog, order, exog, freq='d').fit() return fit.aic scipy.optimize import brute grid = (slice(1, 3, 1), slice(1, 3, 1), slice(1, 3, 1)) brute(objfunc, grid, args=([1.350320637, 1.39735651, 1.712129712, 1.718507051, 1.772633255, 1.766728163, 1.590842962, 1.386521041, 1.71810019, 1.743380606, 1.718501449, 1.77709043, 1.823061287, 1.562814653],), finish=none) it throws exception when bruteforcing: the computed initial ar coefficients not stationary should induce stationarity, choose different model order, or can pass own start_params. i read post on problem here , yet didn't find quite helpful. speaking of seasonality, suggests using x13as handle automatically. instruction on that? anyway, desperately need rock-solid example on arima in python. there shouldn't pain, isn't it?

C# Console Rest API header payload -

i need access portal controlled bearer authentication. client needs obtain authentication token add each request url ~/token method post content-type application/x-www-form-urlencoded payload grant_type=password&username=username&password=password **how add payload includes grant type , username , password code ** so far code follows : using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; using system.net; namespace consolerestclient { class program { static void main(string[] args) { string uri = "https://token"; webrequest request = webrequest.create(uri); request.method = "post"; request.contenttype = "application/x-www-form-urlencoded"; } }` } you should sending request content type "application/json" , put requested login variable on body. give idea: headers: content-type:appl

wordpress - WP ACF plugin max_vars issue (PHP suhosin) -

i have problem advanced custom fields plugin in wordpress site. when tried add 15th field wp redirects me posts instead of saving field. it's server issue beacuse i've cloned wp database server , works fine. i've found tutorial on mentioned server haven't got php suhosin support, , don't know how solve this. do knows workaround solve issue ? i've tried both php.ini , .htaccess methods. overview ordinarily misconceived there's limit on amount of fields you'll increase field cluster. acf doesn't contain limit, however, server contain limit on percentage variables used on every page. to ingeminate, acf isn't limiting amount of fields you'll save, instead, server terminating save method before acf end it’s job. the common answer extend max_vars setting. {this is|this often|this often} php setting determines percentage variables can employed in 1 page load. increasing limit, you'll enable acf finish it’s job. php.ini

arrays - Error in loop in mips -

can tell me problem in one? `#initializing indexes i,j,k addi $s0, $zero, 0 addi $s1, $zero, 0 addi $s2, $zero, 0 addi $sp, $sp, -16 sw $s0, 0($sp) sw $s1, 4($sp) sw $s2, 8($sp) while1: bgt $s0,2,exit1 while2: sw $ra, 12($sp) bgt $s1,2,exit2 addi $s1,$s1,1 while3: sw $ra, 12($sp) bgt $s2,2,exit3 mul $t0,$s0,$s0 add $t1,$t0,$s1 sll $t2,$t1,3 add $t3,$t2,$a0 add $t4,$t2,$a1 add $t5,$t2,$a2 ldc1 $f4, ($t3) ldc1 $f6, ($t4) ldc1 $f8, ($t5) mul.d $f8,$f6,$f4 sdc1 $f8, ($t5) addi $s2,$s2,1 j while3 addi $s1,$s1,1 j while2 addi $s0,$s0,1 j while1 exit1: lw $s0, 0($sp) addi $sp, $sp, 16 jr $ra exit2: lw $s1, 4($sp) jr $ra exit3: lw $s1, 8($sp) jr $ra addi $t2,$zero,0 while: beq $t2,24,exit ldc1 $f2, 0($a2) li $v0, 3 add.d $f12,$f2,$f0 syscall addi $t2,$t2,8 li $v0, 10 syscall it tells me exception occurred @ pc=0x000000 , bad address in text read: 0x0000000 , attempt execute non-instruction @ 0x80000180.. want mul

android - Linking.getInitialURL constantly being executed and app being duplicated -

Image
sorry long winded title. here's componentdidmount() function componentdidmount() { linking.getinitialurl().then(data => { console.log(data); }); } when boot app, data rightfully set null . a user logs in via google chrome opened via linking.open('https://...); when user gets redirected app, can see data has been populated. , good. however, when redirected back, see duplicate components. here's screenshot react native debugger. have <appcontainer root=1..> , <appcontainer root=11..> because of duplication, app calls componentdidmount() twice , linking.getinitialurl() called multiple times. furthermore, if refresh app via developer menu, data returned linking.getinitialurl 's promise still populated when should null . the solution problem add android:launchmode="singletask" .mainactivity activity. solution found on this github thread.

javascript - school bus tracking gps web app -

i developing 1 school management application in php.for need develop 1 module school bus tracking.but new topic. have gone through many searches.but no luck. <script> var watchid = null; $(document).ready(function() { var optn = { enablehighaccuracy: true, timeout: infinity, maximumage: 0 }; if (navigator.geolocation) navigator.geolocation.watchposition(success, fail, optn); else $("p").html("html5 not supported"); $("button").click(function() { if (watchid) navigator.geolocation.clearwatch(watchid); watchid = null; return false; }); }); function success(position) { var googlelatlng = new google.maps.latlng(position.coords.latitude, position.coords.longitude); var mapotn = { zoom: 10, center: googlelatlng,

android - NullPointerException when trying to access inherited field -

i`m getting npe when trying access overridden variable in parent class java.lang.nullpointerexception: attempt length of null array @ app.deadmc.materiallivewallpaper.model.square.<init>(square.kt:29) @ app.deadmc.materiallivewallpaper.model.cube.<init>(cube.kt:8) @ app.deadmc.materiallivewallpaper.renderer.materialrenderer.onsurfacecreated(materialrenderer.kt:40) @ android.opengl.glsurfaceview$glthread.guardedrun(glsurfaceview.java:1548) @ android.opengl.glsurfaceview$glthread.run(glsurfaceview.java:1286) i show simplified code undestanding problem i have class drawing square open class square(renderer: readyrenderer) { val coords_per_vertex = 3 open val trianglecoords = floatarrayof( //first triangle -1.0f, 1.0f, 0.0f, -1.0f, -1.0f, 0.0f, 1.0f, 1.0f, 0.0f, //second triangle -1.0f, -1.0f, 0.0f, 1.0f, -1.0f, 0.0f, 1.0f, 1.0f, 0.0f) private val vertexcount:int = trianglecoords.size / coords_per_vertex

python - get diff between 2 columns in postgresql by sqlalchemy -

i have posgresql , 2 columns datetime values. how can difference between columns sqlalchemy? ideally, need 1 row max difference value assuming have defined classes , other code required create session database, can query maximum difference this: # code set database engine... class sometable(base): __tablename__ = 'some_table' id_ = column(integer, primary_key=true) datetime_1 = column(datetime) datetime_2 = column(datetime) # code set session... >>> sqlalchemy.sql import func >>> q = session.query(func.max(sometable.datetime_1 - sometable.datetime_2)) >>> print(q) select max(some_table.datetime_1 - some_table.datetime_2) max_1 some_table >>> print(q.one()) (datetime.timedelta(133, 28552, 844875),) >>> diff = q.scalar() # value directly >>> diff datetime.timedelta(133, 28552, 844875) >>> print(diff) 133 days, 7:55:52.844875

python execute multiple command subprocess -

i have command like command = "su - user; cd $config; grep domain domains.xml" and need execute commands 1 after other , capture output of grep. def subprocess_cmd(command): fnlogs("comand = " + command) process = subprocess.popen(command,stdout=subprocess.pipe, shell=true) proc_stdout = process.communicate()[0].strip() fnlogs("proc_stdout = " +proc_stdout + "\n") subprocess_cmd('su - user; cd $config; grep domain domains.xml') output says grep: domains.xml: no such file or directory, although file exists not able find it. it seems not passing value config . if know intended value within script, can do d = dict(os.environ) d["config"] = "/some/directory" process = subprocess.popen(command,stdout=subprocess.pipe, shell=true, env=d) you might have call sudo -e preserve environment pass first outermost shell (see https://stackoverflow.com/a/8633575/69314