Posts

Showing posts from September, 2014

php - How can I assert two possible values for a key in an array using Phpunit? -

this question has answer here: is there way in phpunit possibly assert 2 values key in array? 1 answer $array = [a => '1', b => '2'] for example, want check if either 1 or 3. thought using work. $this->assertthat( $this->assertcontains('1',$array), $this->logicalor( $this->assertcontains('3',$array) )); pass assertions arguments logicalor $this->assertthat($array, $this->logicalor( $this->assertcontains('3',$array), $this->assertcontains('1',$array) ));

c# - Apparent ODBC recordset size limit -

platform windows 10. i doing stress testing on 32 bit app using components purport intelligent caching large data sets built around adodb operations. have 64 bit postgresql v9.6 server installed using default user inputs, , i'm using psqlodbc 32 bit odbc driver offered installed during server install, , referencing driver through standard odbc connection set through 32 bit odbc control panel applet. i loaded database table 5 million records testing. worked expected, know odbc connection , write new rows part of api working correctly. the table has bigint primary key (bigserial actually) , text field contains key value formatted out take space. rows can seen , browsed in pgadmin4 app installs server. in app, open recordset query: select * mytable; this takes 20 sec server process , control returned app ui. expected recordset count of 5000000. instead, recordset 84796 records in it. can please explain might going on here, , how work around it, if possible? thanks.

python - Problems establishing connection with DB -

platform: linux. i beginner of mongodb , pymongo. after installing pymongo, here simple test tried on ipython: import pymongo client = pymongo.mongoclient(); # tried specify local host , port number db = client['mydb'] collections = db['temptables'] collections.insert({'a':'1'}) at point, chokes. , in end, spits out "error 111: connection refused" error. so, tried invoking mongodb straight terminal , still got error below [look @ far end]. so, searched bit , tried: removing lock ( sudo rm /var/lib/mongodb/mongod.lock ). turns out there no lock in first place. sudo mongod --repair i saw suggestion comment out host , port number config file. tried too, didn't work. none of above worked. this error see when try invoke mongodb command line. 017-08-17t15:25:30.265-0700 w network [thread1] failed connect 127.0.0.1:27017, in(checking socket error after poll), reason: connection refused 2017-08-17t15:25:30.265-0700 e

html - ASP Razor Web Pages - Form Submit is Moving My Data -

Image
when submit login email (aka username), want keep in login form. when submit register email (aka username), want keep in register form. what happening is: when submit login form, writes email (aka username) register form. please see image happening. @{ page.title = "login"; var username = ""; var password = ""; var errormessage = ""; var confirmpassword = ""; var regmsg = ""; var conftoken = ""; var emailbody = ""; var minpass = 2; var maxpass = 5; if (!ispost) { if (websecurity.isauthenticated) {errormessage = string.format("you logged in. (username: {0})", websecurity.currentusername);} } if(websecurity.isauthenticated){ errormessage = string.format("you logged in. (username: {0})", websecurity.currentusername); } if(ispost){ // login form if (request.form["loginsub&q

google apps script - How can I put the formula only in the last 20 rows of this range? -

i want code works in last 20 rows of sheet. sets formula in of blanks cells of column want code in 20 last rows. function setformulainblankcells() { //----------------- colonna --------------- // formula solo su celle vuote "area" var sheet=spreadsheetapp.getactivesheet(); var lastrow=sheet.getmaxrows(); var lastcolumn=sheet.getmaxcolumns(); var range=sheet.getrange(1, 1, lastrow, 1); var data=range.getvalues(); for(var i=0;i<data.length;i++) { if(!data[i][0]) { var e1=sheet.getrange(i+1,5).geta1notation(); var i1=sheet.getrange(i+1,9).geta1notation(); var formula='=iferror(if(' + e1 + '="";"";if(' + i1 + '="";"ru";"st")))' sheet.getrange(i+1,1).setformula(formula); } } } i guess meant in last 20 rows of sheet function setformulainblankcells() { var sheet=spreadsheetapp.getactivesheet(); var lastrow=sheet.getmaxrows(); var ra

How to learn spatial temporal guassian proces? -

i want simulation spatial temporal gaussian process. currently, know how learn spatial gaussian process. code using gpml matlab code. need specify mean, cov, , liklihood function. however, when comes spatial temporal gaussian process, don't know how specify mean , covariance functions learning; how incorporate time factor mean , covariance functions. btw, can tell me how generate spatial temporal data simulation. lot

R - Issues with double precision while writing to an excel file -

i have multiple columns in data frame called 'export', of numeric double precision. class(export) [1] "grouped_df" "tbl_df" "tbl" "data.frame" when write down table using following code, excel file has values such 13.0000000000001, 11, 3.9968e-14 write.xlsx(as.data.frame(export), file="test.xlsx", sheetname="test", row.names=false) i'm trying columns show pure integer value , columns show 1 decimal. i did try define of columns integer. export$col1<-0l but, doesn't seem work. assume it's because process column later on using group_by , summarize functions of dplyr package seems turning these columns double again. my question how 1 column write integer , other columns number 1 decimal? thank you!

shell - Trying to move a file to another directory with the inode number attached -

so have slight issue code. trying move file users wants in deleted directory. situation file needs have inode attached within deleted directory in form $filename_$inode. instance, in home directory have file named good.txt. want move deleted directory , file should in format of good.txt_12234. should do? tried using brace expressions here reason keep getting errors. i've attached part of code below. once solve issue, rest of code work. everyone! echo "safe_rm cannot remove '$1' : directory" 38 exit 1 39 fi 40 } 41 error_checking $1 42 43 ## test 3 error conditions based on file given. 44 45 ##5. 46 47 file_inode(){ 48 49 filename="$1" 50 inode=$(ls -i "$1"| cut -d" " -f1) 51 mv $1 $home/deleted 52 } 53 54 file_inode $1 update: able kind of figure out problem. did following: mv $1 $home/deleted/$1_$inode. file able move deleted directory. however, when try .restore.info, keeps showing message

iphone - iOS Reset App Data without Resetting Phone -

i looking answer end-user perspective. have app requires no login create saved on app on side if delete app , reinstall app store. way make information app gone reinstall iphone. of know other way of deleting/resetting whatever associated app remembers me each time install app on specific device without having erase content , settings. third-party software if knows specific name or other way. thanks

How can I pass values to a class constructor with inversifyJS? -

hi have typescript test project inversify , requirejs can cloned from: https://github.com/ahedreville/ioctest.git his package.json follows { "name": "ioctest", "version": "1.0.0", "description": "test of ioc inversify , requirejs", "scripts": { "start": "http-server" }, "author": "alexandre hedreville", "license": "isc", "devdependencies": { "http-server": "^0.10.0" }, "dependencies": { "@types/requirejs": "^2.1.30", "inversify": "^4.3.0", "reflect-metadata": "^0.1.10", "requirejs": "^2.3.4" } } you can project running on browser issuing following commands... mkdir temp cd temp git clone https://github.com/ahedreville/ioctest.git cd ioctest c:\

php - Displaying dates in EST -

i have blog on site. each blog-post has comments section @ end. when user comments, comments show per central time. however, looking display them per est. have included code snippet displays timestamp. works fine, except instead of est, time displayed central. $dateformat = '%b %e, %y %i:%m %p'; i have used parameters described here - http://php.net/manual/en/function.strftime.php the site hosted godaddy, falls under central time. not sure, if fact site hosted on godaddy server has this. have called , checked godaddy, unable offer advice. appreciated. thanks! use this: date_default_timezone_set('america/new_york');

Finish activity on Android back button press, even when soft keyboard is open -

in activity, soft keyboard should more or less open. when user presses button, activity should finish normally. however, default android behavior close keyboard instead when open. makes user have click twice exit activity. how can override behavior activity finishes when button pressed, when soft keyboard open? there simple way this? i'm sure common problem, did not find direct question. try this. medittext.setonkeylistener(new view.onkeylistener() { @override public boolean onkey(view v, int keycode, keyevent event) { finish(); return false; } }); you can hide keyboard , finish activity. if use dialog,you can this. mdialog.setonkeylistener(new view.onkeylistener() { @override public boolean onkey(view v, int keycode, keyevent event) { if (keycode == keyevent.keycode_back) { if (isshowdialog) { isshowdialog = false; mdialog.dism

jquery - Rotating car using multiple images -

i want take animation via css or jquery using multiple images. ideea when see windows skin. possible? car rotating. advices please. thank you i've before simple javascript. made "slideshow" every click cycle image rotate left or right. front have 10 images, if keep going "right" 1 , on create rotate.

python - Need pvr.vbox KODI addon build instructions for Android and iOS -

i'm interested in kodi addon. want know pvr.vbox kodi addon. the following link 1 vbox home tv gateway pvr client https://github.com/kodi-pvr/pvr.vbox . but there build instructions windows/linux. think kodi cross-platform project, believe there android/ios addon it.

javascript - React JS - Render one Component in another -

i'm brand new react pardon sloppiness here. have 2 asynchronous calls api's , trying display returned data 1 component inside another. here first component async call api: var program = react.createclass({ getinitialstate: function(){ return{ data: [] }; }, componentdidmount(){ this.getdatafromserver('https://api.myjson.com/bins/5bdb3'); }, displayresponse: function(response) { this.setstate({ data: response }) }, getdatafromserver: function(url){ $.ajax({ type: 'get', datatype: 'json', url: url, success: function(response, i) { this.displayresponse(response) }.bind(this) }); }, render: function() { var size = 3; // show top 3 results var list = this.state.data; var result = list.slice(0, si

php - Codeigniter Autoloading Entire Folder -

i'm new codeigniter , have been reading autoloader functions. example in application/config/autoload.php can add file names assigned array have autoload. not want. have option add custom files these folders below | 1. packages | 2. libraries | 3. drivers | 4. helper files | 5. custom config files | 6. language files | 7. models in scenario, i'd add folder called "objects" @ same level folders listed above. add 8. objects list of available autoload paths. but problem file must specify filenames of files want autoloaded in directory. i'd autoload entire directory of "objects". i've been searching right spot hours feel im going in circles in code. so ultimate questions are... 1. can add new autoload path controllers? 2. how can load within new folder? thanks in advance.

vue.js - Parent rerenders every time nested route changes -

i have project simple folder structure similar following: pages/ --items.vue --items/ ----_id.vue i have included <nuxt-child/> inside items.vue along list of items link different id's. _id.vue renders modal displays info based on id passed param. this working , rendering except each time item clicked, items.vue component re-renders causing reset state , lose users scroll position. is expected behavior? possible have dynamic nested routes without re-rendering parent each route change?

omnet++ - VEINS, OMNET,SUMO -

i new veins. downloaded , successful run example included. able run simulation , examine numbers @ end, example messages sent, messages lost , on. experimented altering tx power , able notice difference had on result. my question is, want implement algorithm, alters tx transmission power cars moving, how can that? cannot find useful resources or start at. if can me, great. thank you.

c++ - socket accepted but m_socket.remote_endpoint raise Transport endpoint is not connected -

code: listener.hpp: template <typename sockettype> void listener<sockettype>::beginaccept() { auto worker = selectworker(); auto socket = worker->createsocket(); m_acceptor->async_accept(socket->getasiosocket(), [this, worker, socket] (const boost::system::error_code &ec) { this->onaccept(worker, socket, ec); }); } template <typename sockettype> void listener<sockettype>::onaccept(networkthread<sockettype> *worker, std::shared_ptr<sockettype> const& socket, const boost::system::error_code &ec) { // error has occurred if (ec) worker->removesocket(socket.get()); else socket->open(); beginaccept(); } socket.cpp: bool socket::open() { try { const_cast<std::string &>(m_address) = m_socket.remote_endpoint().address().to_string(); const_cast<std::string &>(m_remoteendpoint) = boost::lexical_cast<std:

java - JDK7 JVM different from JDK8 -

when run code public static void main(string[] args) { byte[] b = null; for(int i=0;i<10;i++) b = new byte[1024 * 1024]; } with jvm options -xmx20m -xms20m -xmn1m -xx:+printgcdetails in jdk7,console print enter image description here . when run jvm options in jdk8,it print error occurred during initialization of vm gc triggered before vm initialization completed. try increasing newsize, current value 1536k. java hotspot(tm) 64-bit server vm warning: newsize (1536k) greater maxnewsize (1024k). new max generation size of 1536k used. why? the error message contains reason. gc triggered before vm initialization completed. it unrelated code since vm initialization happens before main runs.

python - Delete all elements in an array corresponding to Boolean mask -

i have boolean mask exists 2-d numpy array (boolean array) array([[ true, true, true, true, true, true, true], [ true, true, true, true, true, true, true], [ true, true, true, true, true, true, true], [ true, true, true, true, true, true, true], [false, false, false, false, false, false, false], [false, false, false, false, false, false, false], [false, false, false, false, false, false, false]], dtype=bool) i have separate 2-d numpy array of values of same dimensions boolean mask (values array) array([[ 19.189 , 23.2535, 23.1555, 23.4655, 22.6795, 20.3295, 19.7005], [ 20.688 , 20.537 , 23.8465, 21.2265, 24.5805, 25.842 , 23.198 ], [ 22.418 , 21.0115, 21.0355, 20.217 , 24.1275, 24.4595, 21.981 ], [ 21.156 , 18.6195, 23.299 , 22.5535, 23.2305, 28.749 , 21.0245], [ 21.7495, 19.614 , 20.3025, 21.706 , 22.853 , 19.623 , 16.7415], [ 20.9715, 21.9505,

php - Java Web platform for data analysis -

i working on data analytics project , built website laravel (php). however, required : analyze massive amount of data database keep lot of in-memory objects have system running 24/7 analyzing , processing data i don't believe php best suited task , thinking of using java instead ( use api process data , return results website viewing). have run on server. these types of data analysis need : retrieve 10,000 plus records mysql , hold. analyze data patterns. build models data. analyze graphs i have never used java services/frameworks online , wondering best suited task. came across : spring jersey you try combine apache storm + spring framework resolve problem. working on similar project yours.

android - Onclick of recyclerview nothing happens -

adapter of recyclerview public class songsadapter extends recyclerview.adapter<songsadapter.myviewholder>{ context context; arraylist<hashmap<string, string>> songlist; public songsadapter(arraylist<hashmap<string, string>> songlist,context context) { this.songlist = songlist; this.context=context; } @override public myviewholder oncreateviewholder(viewgroup parent, int viewtype) { view view = layoutinflater.from(parent.getcontext()).inflate(r.layout.list_item, parent, false); return new myviewholder(view,context); } @override public void onbindviewholder(myviewholder holder, int position) { holder.textview.settext(songlist.get(position).get("file_name")); } @override public int getitemcount() { return songlist.size(); } public class myviewholder extends recyclerview.viewholder implements view.onclicklistener { private tex

windows - What is the difference between user variables and system variables? -

what difference between user variables such path , tmp , etc. , system variables? i accidentally deleted user variable path . supposed do? right-click computer , go properties->advanced->environmental variables... what's above user variables, , below system variables. elements combined when creating environment application. system variables shared users, user variables account/profile. if deleted system ones accident, bring registry editor, go hklm\controlset002\control\session manager\environment (assuming current control set not controlset002 ). find path value , copy data path value of hklm\currentcontrolset\control\session manager\environment . might need reboot computer. (hopefully, these backups weren't long ago, , contain info need.)

Copy table row and return insert ID on PHP Programming with Oracle Database -

i have problem returning inserted id when copying data auto increment id (php programming oracle database) here code : $sql = "insert z_tbl_ad_pp ppa (ppa.id,ppa.orgid,ppa.vendorid,ppa.start_date,ppa.status) select '',ppb.orgid,ppb.vendorid,ppb.start_date,'1' z_tbl_ad_pp ppb ppb.id='$ppid' returning id :id"; $stid = oci_parse($this->db_connect, $sql); oci_bind_by_name($stid,":id",$id,-1,oci_b_int); $r = oci_execute($stid); $inserted_id=$id; here error message: oci_execute(): ora-00933: sql command not ended

ios - UISearch is not Working in JSON api UITable View -

all i trying develop app. need search video list using uisearch view. here code. can see search bar it's not working. import uikit import googlemobileads class viewcontroller: uiviewcontroller, uitableviewdelegate, uitableviewdatasource, gadinterstitialdelegate, uialertviewdelegate, uisearchbardelegate { @iboutlet weak var tblvideos: uitableview! @iboutlet weak var banner3: gadbannerview! var interstitial: gadinterstitial! @iboutlet weak var viewwait: uiview! var channelsdataarray: array<dictionary<string, any>> = [] var apikey = "" var selectedvideoindex: int! override func viewdidload() { super.viewdidload() // additional setup after loading view, typically nib. if connectedtonetwork() == true { tblvideos.delegate = self tblvideos.datasource = self print("google mobile ads sdk version: " + gadrequest.sdkversion()) banner3.adunitid = "" banner3.rootviewcontrol

how to combine multiple rows into one row with same column value v1 in android -

Image
view_id , mac_qr_code common in multiple rows button_id different. want when retrieving view_id should treated single v1 , on image click event view 3 button_id . insert query public void insertdata(string view_id, string button_id, string publish_topic, string subscribe_topic, byte[] image, string qr_code){ sqlitedatabase database = getwritabledatabase(); string sql = "insert config values (null, ?, ?, ?, ?, ?, ?)"; sqlitestatement statement = database.compilestatement(sql); statement.clearbindings(); statement.bindstring(1, view_id); statement.bindstring(2, button_id); statement.bindstring(3, publish_topic); statement.bindstring(4, subscribe_topic); statement.bindblob(5, image); statement.bindstring(6, qr_code); statement.executeinsert(); } get data sqlite // data sqlite cursor cursor =sqlitehelper.getdata("select * config"); getadapter1.clear(); while (cursor.movetonext()) { i

Correct way to get image pixel data in PHP? -

i trying image pixel data in php way in js canvas ctx.getimagedata(); my php function image pixel data: function canvasgetimagedata($canvas) { $imagewidth = imagesx($canvas); $imageheight = imagesy($canvas); $imgdata = array(); // loop on each single pixel. ($y = 0; $y < $imageheight; $y++) { ($x = 0; $x < $imagewidth; $x++) { $colorinfo = imagecolorsforindex($canvas, imagecolorat($canvas, $x, $y)); // line #44 array_push($imgdata,$colorinfo['red']); array_push($imgdata,$colorinfo['green']); array_push($imgdata,$colorinfo['blue']); array_push($imgdata,$colorinfo['alpha']); } } return $imgdata; } i call $mglink = 'image link'; $canvas = imagecreatefrompng($mglink); $imgdata = canvasgetimagedata($canvas); i have 1 image of resolu

osx - MacOS Swift - GUI Programming -

https://snag.gy/iudznr.jpg what's name of widget on left in xcode? or similar? scrollview ? im trying create list of images on program. also, while i'm here might explain desired functionality. i'd user able drag images desktop or finder etc app , adds thumbnail list. also, when clicked on, should show image in imageview. need maintain lists traits, path every file , image name. that ui not xcode, it's preview.app. and functionality you're describing along left edge nscollectionview . you're describing, you'd need create custom (subclassed) nscollectionviewcells in can save file path (or url), image name, nsimage, ec.

osx - How to upload wxPython Mac app to Mac App Store -

1. use pyinstaller build app: pyinstaller -w -n "salus eu coordinator upgrade tool" --osx-bundle-identifier "com.computime.salus-eu-coordinator-upgrade-tool" --add-data "img:img" -i img/icon.icns update.py 2. signing app: codesign --deep -v -f -s "3rd party mac developer application: salus limited (2pz653697v)" --entitlements entitlements.plist "salus eu coordinator upgrade tool.app" and got following errors when double click "salus eu coordinator upgrade tool.app". ideas? process: salus eu coordinator upgrade tool [82809] path: /applications/salus eu coordinator upgrade tool.app/contents/macos/salus eu coordinator upgrade tool identifier: salus eu coordinator upgrade tool version: 3.6 (5) code type: x86-64 (native) parent process: ??? [82808] responsible: salus eu coordinator upgrade tool [82809] user id: 501 date/time:

html5 - W3C validation error for input type=date -

<input type="date" max="1995-12-31" class="form-control" id="dob"/> when try validate w3c got error line: the date input type not supported in browsers. please sure test, , consider using polyfill. how solve it? maintainer of w3c html checker (validator) here. message warning message, not error. , reason have html checker emit warning is, input type=date isn’t supported in desktop safari or internet explorer, nor in versions of firefox before firefox 57, nor on android before android 4.4. for exact details browser support, see https://caniuse.com/#search=date so warning’s purpose give heads-up document has feature doesn’t work specified users of internet explorer, safari, , older versions of firefox , android. that’s why warning mentions consider using polyfill—in order ensure feature works users expected. to make input type=date work in browsers, can choose among many available polyfills: https://www.n

bash - POSIX smallest allowable upper limit on argument length (all systems) -

i know has been posted multiple times couldnt find answer anywhere hence posting again. my current system limits are:-- root@vm-test-001:~/mongosearch# xargs --show-limits environment variables take 1925 bytes posix upper limit on argument length (this system): 2093179 posix smallest allowable upper limit on argument length (all systems): 4096 maximum length of command use: 2091254 size of command buffer using: 131072 maximum parallelism (--max-procs must no greater): 2147483647 now, when running mongo command bash shell , fails due posix smallest allowable upper limit on argument length (all systems): 4096 limitation number of argument length huge. i tried using stty -icanon , ulimit -s 32768 nothing helped. below command failing . mongo host:port/db_name -u db_user -p password < count.js >> count.txt so, how run external command larger argument list ? read there options available running internal commands regards

spring - In Java is Exception is not handled in try catch id there is an if else in try block -

i new hibernate , springs, developing project unable understand why try catch block not working. the project structure follows: jsp > controllers > services > dao i have bean named seller necessary fields in it, passed seller controller making update in database follows: @requestmapping(value = "/updateseller") public string updatesellerprofile(model model, httpsession session, sellerformbean seller) { int action = seller.getaction(); try { if (action == 1 || action == 2) { //this modify seller profile giving exception of dataintegrityviolationexception: not-null property references null or transient value seller = sellerservice.modifysellerprofile(seller); model.addattribute("countries", commonservice.getcountrydropdown()); } if (action == 3 || action == 4) { sellerservice.modifycasestudies(seller.getsellerid(), seller.getcasestudies());

php - Javascript Ajax - Contact form does not display prompts and send button doesn't work -

i looking on different examples contact form sent using javascript / ajax. solutions don't seems work. i'm trying rewrite existing chunk of code. here left (with few of own modifications). i don't quite understand functionality going wrong. send button nothing, not send email , goes top of page. javascript: <script type="text/javascript"> $('#submit').click(function(){ var name = $("#name").val(); var email = $("#email").val(); var phone = $("#phone").val(); var message = $("#message").val(); if (name == "") { $('.errormess').html('<div class="alert alert-warning"><strong>please insert name</strong></div>'); return false; } if (email == "") { $('.errormess').html('<div class="alert alert-warning"><strong>pl

javascript - Ajax sometimes working sometimes it doesn't -

i have problem ajax code have in asp.net website. ajax supposed retrieve filename of uploaded image through ajaxfileupload asp.net server. unfortunately outcome is, give me object reference not set instance of object in asp.net code-behind because doesn't return value image uploaded using ajaxfileupload. , after bunch of tries, work. , after couple of minutes, not work again. cycle code work, not , work again. don't know if problem ajax code or maybe internet connection. kindly me guys on figuring 1 out. here code aspx(i have included of code main focus on ajax script , ajaxfileupload has id of itemfileupload1 , itemfileupload2): <%@ page language="c#" autoeventwireup="true" codefile="createbrands.aspx.cs" inherits="pages_createbrands" %> <%@ register assembly="ajaxcontroltoolkit" namespace="ajaxcontroltoolkit" tagprefix="asp"%> <!doctype html> <html xmlns="http://www.w