Posts

Showing posts from May, 2013

android - TextView Does Not Overlay VideoView Inside of FrameLayout -

i trying have textview displayed on top (overlay) of videoview , , not happening. have 2 elements inside of framelayout textview positions below videoview. understanding, supposed place on top. i have tried various ways of adding textview programmatically , removing additional features of videoview e.g. ontouchlistener(). does have suggestions on how fix problem or explanation of overlaying views me problem? appreciated. have posted code below: activity_splash.xml <framelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.androidtitan.hotspots.activity.splashactivity"> <videoview android:id="@+id/splashvideo" android:layout_width="match_parent" android:layout_height="match_parent" /> <textview android:id="

dataframe - r remove rows from a data frame that contain a duplicate of either combination of 2 columns -

this question has answer here: remove duplicate column pairs, sort rows based on 2 columns [duplicate] 3 answers i trying remove rows data frame contain either combination of 2 columns. example, following code: vct <- c("a", "b", "c") <- b <- vct combo <- expand.grid(a,b) #generate posible combinations combo <- combo[!combo[,1] == combo[,2],] #removes rows matching column generates data frame: var1 var2 2 b 3 c 4 b 6 c b 7 c 8 b c how can remove rows duplicates of combination of 2 columns, i.e. #4 b removed because #2 b present? resulting data frame this: var1 var2 2 b 3 c 4 c b we can sort row using apply margin=1 , transpose ( t ) output, use duplicated logical index of duplicate rows, negate ( ! ) rows not duplicated, , subset dataset. comb

ios - How to play a sound using Swift? -

i play sound using swift. my code worked in swift 1.0 doesn't work anymore in swift 2 or newer. override func viewdidload() { super.viewdidload() let url:nsurl = nsbundle.mainbundle().urlforresource("soundname", withextension: "mp3")! { player = try avaudioplayer(contentsofurl: url, filetypehint: nil) } catch _{ return } bgmusic.numberofloops = 1 bgmusic.preparetoplay() if (data.backgroundmenuplayed == 0){ player.play() data.backgroundmenuplayed = 1 } } most preferably might want use avfoundation . provides essentials working audiovisual media. update: compatible swift 2 , swift 3 , swift 4 suggested of in comments. swift 2.3 import avfoundation var player: avaudioplayer? func playsound() { let url = nsbundle.mainbundle().urlforresource("soundname", withextension: "mp3")! { player = try avaudioplayer(contentsofurl: ur

linux - MongoError: topology was destroyed -

i have node-based rest api has started receiving "topology destroyed" errors mongodb. i'll try give information possible. architecture: the system running on 2 node (0.12.7) servers behind nginx reverse-proxy connected single mongodb server via private network. node processes running 1 per server under pm2. the mongodb server latest version (3.0) , hosts 2 wiredtiger databases. new system being rolled out existing application both growing rapidly 1 database @ 260k small documents, growing @ rate of ~300 documents minute, , other @ 1400 large(r) ones. the second database has single collection sparse unique key index. the node servers connect mongodb using mongojs (a thin wrapper around mongodb-core. i've checked source , don't think it's issue) 5 sockets per database set automatically reconnect on failure. the issue: in milliseconds before or after (1 - 3 ms) latter of 2 or more update requests trigger duplicate key error on second databas

php - mysql query of union and mysql_num_rows -

select tbl_post_upvote.id , count(user_id) c tbl_post_upvote left join tbl_post on (tbl_post.id=tbl_post_upvote.post_id) tbl_post.author_id = 3 , is_seen = 0 union select tbl_post_downvote.id i, count(user_id) tbl_post_downvote left join tbl_post on (tbl_post.id=tbl_post_downvote.post_id) tbl_post.author_id=3 , is_seen=0 $r_noti = mysql_query($sq_noti); $l = mysql_fetch_assoc($r_noti); $l_noti = mysql_num_rows($r_noti); if ($l['c'] > 0 && $l['i']!=0) { ?> <span class="badge"> <?= $l_noti; ?> </span> <?php } ?> it displays result value 6 , 0 , c value 1 , 0 respectively. want remove 0 ,0 row , result value 6 , c value 1 only you have add group i statements. please try following: select tbl_post_upvote.id ,count(user_id) c tbl_post_upvote left join tbl_post on (tbl_post.id=tbl_post_upvote.post_id) tbl_post.author_id=3 , is_seen=0

python - Not able to replace static image in django 1.8 -

below settings.py entries. static_url = '/static/' static_root = '/home/eankuls/django-kuls/django_test/assets' staticfiles_dirs = ( '/home/eankuls/django-kuls/django_test/static/', ) my image placed "/home/eankuls/django-kuls/django_test/static/images/ankur.jpg" . executed "python manage.py collectstatic" command created copy of image '/home/eankuls/django-kuls/django_test/assets/images/ankur.jpg' , executed perfectly. now trying replace image 'kuls.jpg' . deleted assets folder. replaced ankur.jpg kuls.jpg @ '/home/eankuls/django-kuls/django_test/static/images' , run "collectstatic" command again. it created assets folder "kuls.jpg" upon running server "ankur.jpg" visible on browser instead of "kuls.jpg" . older 1 not present in folder structure still present in output. please help. please let me know if need more details additional settings.py

html - My JavaScript code crashes in Chrome, when script tries to make fixed element visible -

i have added few elements "visibility:hidden; position:fixed;" top of page , reason, when launch script in chrome, makes "#pageoverlay" visible, fails unhide other elements. here js function fails: function showimage(element) { //locating currentgalleryitemindex (currentgalleryitemindex = firstgalleryitemindex; currentgalleryitemindex <= lastgalleryitemindex; currentgalleryitemindex++) { if (galleryitems[currentgalleryitemindex] === element) break; } //general settings fillpreviewarea(); pageoverlay.style.visibility = "visible"; previewarea.style.visibility = "visible"; previewareacloselink.style.visibility = "visible"; previewareaactive = true; } the same thing doesn't happen in firefox , ie11 , works in chrome if change "position:fixed;" "position:absolute;"; isn't want use. the page uses script here: http://spongebobia.com/spongebob-captures/gallery.php and actual script here:

How to send post request with spring @RequestBody in rest client -

i have class person. class person{ integer id; string firstname; string lastname; //other params, constructors, getters & setters } & method @requestmapping(value = "/test", method = requestmethod.post) public void testperson( @requestbody person person){ ... } now need test using rest client. tried setting “request header” section of firefox plugin have “name” = “content-type” , “value” = “application/x-www-form-urlencoded” & add parameters in body, id=1&firstname=aaa&lastname=bbb but it's giving 404. if getting 404 response, means either request url wrong or using get method instead of post or vise versa. then regarding passing person in request, if @requestbody used have pass json or xml in body of request playload. json: { "id":1, "firstname":"aaa", "lastname":bbb } xml <person> <id>1<id> <firstname>aaa</firstname

Why I am not getting a new CSS file from gulp-uncss? -

i trying further compress css file. , getting error peculiar. wondered why referenceerror: can't find variable: jquery task solely encompasses selectors html & css? unless it's reading script tags in html have selectors? update forgot mention task not spitting out, new css file! also noticed many gulp tasks have ./ preceding directory, purpose of that? anyway, see below: this gulp file, figured include it... gulp.task('uncss', function() { return gulp.src('site/assets/stylesheets/style.min.81113a5b.css') .pipe(uncss({ html: [ 'site/**/*.html' ] })) .pipe(gulp.dest('./out')); }); this error getting. referenceerror: can't find variable: jquery file:///users/antonioortiz/sites/antonioortiz.github.io/site/cookie_control/cookie_example/index.html:12 file:///users/antonioortiz/sites/antonioortiz.github.io/site/cookie_control/cookie_example/index.html:43 /users/antonioortiz/sites

direct3d - Why is this Transpose() required in my WorldViewProj matrix? -

given super-basic vertex shader such as: output.position = mul(position, _gworldviewproj); i having great deal of trouble because setting _gworldviewproj follows; tried both (a bit of flailing) make sure wasn't backwards. mworldviewproj = world * view * proj; mworldviewproj = proj * view * world; my solution turned out be: mworldview = mworld * mview; mworldviewproj = xmmatrixtranspose(worldview * proj); can explain why xmmatrixtranspose required? know there matrix differences between xna , hlsl (i think) not between vanilla c++ , hlsl, though wrong. problem don't know if i'm wrong or i'm wrong about! if tell me precisely why transpose required, won't make same mistake again. on cpu, 2d arrays stored in row-major ordering, order in memory goes x[0][0] , x[0][1] , ... in hlsl, matrix declarations default column-major ordering , order goes x[0][0] , x[1][0] , ... in order transform memory format defined on cpu order expected in hlsl, ne

javascript - iterate the json array and push each value to the list in angular js -

i new angular js.my question is, have json array getting ajax response php page. iterating json array , want push each value in list like angular.foreach($scope.companies.area, function(value, key) { $scope.comp = [ { 'name': value1 }, { 'name': value2 }, { 'name': value3 } //... ] }); how can make list? json data is {"1":"audugodi","2":"airforce station yelahanka","3":"agaram","4":"anadanagar","5":"arabic college","6" :"banasawadi","7":"banashankari","8":"banashankari ii stage","9":"banashankari iii stage","10":"bangalore city","11":"bangalore gpo","12":"bannerghatta","13":"bannerghatta road","14":"basavanagudi","15":&quo

How to import java files from folders in linux? -

in linux, have java files coped windows eclipse project, , want compile in linux. the folder structure is plutomake.java java-json.jar filter\colorfilter.java filter\darken.java filter\nofilter.java filter\vividlight.java the plutomake file has these imports , others json import filter.colorfilter; import filter.darken; import filter.nofilter; import filter.vividlight; but when try compile plutomake, says plutomake.java:12: package filter not exist import filter.colorfilter; i use compile it: javac -cp "java-json.jar" plutomake.java and other ones too. does know how import it? thanks you getting package filter not exist error because filter.* classes not present in class path. first compile java files in side folder filter compile plutomake.java using javac -cp "java-json.jar;." plutomake.java i'll advice use build tool maven or gradle or ant

php - How to index returned array by key with eager loading in Laravel Eloquent? -

i'm working on side project in trying implement "like" functionality user's posts. using laravel's orm , use eager loading make things easier, i'll outline issue below. information first, post.php model contains this: public function likes() { return $this->hasmany('app\models\postlike', 'post_id', 'post_id'); } the postcontroller.php implementing api call load posts , likes looked like: $posts = post::with("likes")->where("group_id", "=", $group_id)->get(); an example json response posts api might this: [ { "post_id":1, "group_id":1, "author_id":1, "text":"some text here.", "created_at":"2015-08-13 00:15:08", "updated_at":"2015-08-13 00:15:08", "likes":[ {"post_id":1,"user_id":1,"update

node.js - Getting error "wrong final block length" when decrypting AES256 cipher -

i'm facing same problem mentioned in this thread while encrypting , decrypting using aes. crypto.js:202 var ret = this._handle.final(); ^ error: error:0606506d:digital envelope routines:evp_decryptfinal_ex:wrong final block length @ error (native) @ decipher.cipher.final (crypto.js:202:26) these encrypt , decrypt functions: var config = { cryptkey: crypto.createhash('sha256').update('nixnogen').digest(), iv: "a2xhcgaaaaaaaaaa" }; function encrypttext(text){ console.log(config.cryptkey); var cipher = crypto.createcipheriv('aes-256-cbc', config.cryptkey, config.iv); var crypted = cipher.update(text,'utf8','binary'); crypted += cipher.final('binary'); crypted = new buffer(crypted, 'binary').tostring('base64'); return crypted; } function decrypttext(text){ console.log(config.cryptkey); if (text === null

asp.net mvc 4 - How to send email to current logged in user -

i storing email of user in session var v = //login query session["loggeduseremail"] = v.email.tostring(); after login want send email current logged in user , purpose passing session["loggeduseremail"] in msg.to.add not working. doing public void execute(ijobexecutioncontext context) { system.net.mail.mailmessage msg = new system.net.mail.mailmessage(); msg.from = new mailaddress("abc@gmail.com"); msg.to.add(session["loggeduseremail"].tostring()); msg.subject = "email"; msg.body = "hi"; msg.isbodyhtml = true; smtpclient smtp = new smtpclient(); smtp.host = "smtp.gmail.com"; smtp.port = 587; smtp.credentials = new system.net.networkcredential("abc@gmail.com", "xxxxxxx"); smtp.enablessl = true; smtp.send(msg); response.write(

arrays - Indexing into N-D matrix -

i have matrix m (4*2) values: [1 0; 0 0; 1 1; 0 1] and array x = [0.3 0.4 0.5 0.2]; all column entries of m binary (0/1). want corresponding row value mapped nd-array of [2,2] called z . each dimension here indicates 0/1, having in first row or second row. x(1) needs go z(2,1) , x(2) needs go z(1,1) , on.. z this: z = [0.4 0.2; 0.3 0.5]; currently looping on this, expensive so. please note minimal example - need 128*7 matrix 7d array. any suggestions on how speed process? you try using accumarray (not sure if it's faster): >> z = accumarray(m + 1, x, [2 2]) z = 0.4000 0.2000 0.2000 0.5000

mysql - Count specific values in column -

i'm trying count number of times multiple words appears in column named sg_event run each 1 separately. know how can combine 1 query. select count(*) metrics sg_event = 'open'; select count(*) metrics sg_event = 'delivered'; select count(*) metrics sg_event = 'click'; my desired outcome follows, open_count, delivered_count, click_count you can use conditional sum this select sum( case when sg_event = 'open' 1 else 0 end ) `open_count`, sum( case when sg_event = 'delivered' 1 else 0 end ) `delivered_count`, sum( case when sg_event = 'click' 1 else 0 end ) `click_count` metrics

ios - Swift Programming - How to set up app for taking turns -

Image
so attempting code application allow me , friend keep track of dart game. in game there several different buttons allow user add or subtract 1 or 2 users score. have buttons , have created outlets ran question how tell buttons user supposed to scoring. have attached picture of basic ui , of code using. advice really appreciated. need know how tell app users turn is, thinking possible add button "next turn" , push buttons reflect score of player , press "next turn" , switches players. therefore scoring effect next players turn. makes sense me on paper dont know start function. mind taking @ code have make labels reflect score changes, , see if logic makes sense? import uikit class viewcontroller: uiviewcontroller { @iboutlet weak var user1score: uilabel! @iboutlet weak var user2score: uilabel! @ibaction func hit(sender: anyobject) { user1score.text = "+1" } @ibaction func miss(sender: anyobject) { } @ibaction func doubleplus(sender: anyo

git - copy file content to the clipboard in linux terminal -

i'm learning git , github , i'm stuck in problem, , problem generate ssh key , how copy ssh key id_rsa.pub clipboard . i'm using linux backbox how copy content of id_rsa.pub clipboard able paste ssh key on github. suggestion , link same appreciable . you can use: cat ~/.ssh/id_rsa.pub i hope you, if not: https://confluence.atlassian.com/pages/viewpage.action?pageid=270827678

javascript - Refresh div contents without reloading page -

i'm making web page javascript , html5. wrote code adds text div. <script type="text/javascript"> var newgame = document.getelementbyid('playerstats'); newgame.innerhtml += 'name: ' + getplayername() + '<br/>'; newgame.innerhtml += 'class: ' + getplayerclass() + '<br/>'; newgame.innerhtml += 'level: ' + getplayerlevel() + '<br/>'; newgame.innerhtml += 'xp: ' + getplayerxp() + ' / ' + needxp[getplayerlevel()]; </script> now let's player's xp has changed. don't want have reload page see new xp. want div displaying player stats refresh immediately, without page reload. ideas? p.s.: using load() isn't best solution. tried , it's not working should (the div becomes smaller , weird things happen). update: did right now, there better approach? function updatestats(){ var newgame =

uitableview - IOS Simlulator Master-Detail application template -

Image
can me in master-detail application? uiimage covers half of screen when open tableview on ipad. wrong auto layouts or constraints? need uiimage pop on details page on left , cover whole thing. connected segue push control tableview cell detail page. i thhink meant want image on right side. should use showdetail segue might want refer this answer joey

html - Move the cursor for input text to the right -

i want the point @ user types text textfield moved right without moving margin of text field right . want because search button lies on top of text field styling purposes , when user begins type text starts underneath search button. need default point of cursor moved right few pixels. possible css? i definately use text-indent: 20px; =)

awk csv: print only lines where value in column 6 is greater than 1 -

i have 30 000+ line csv file , not need of it. comes supplier , want lines have value greater 1 lines 0 in 6th column shows quantity of 1 or more want print. so noticing awk command weird data , tells me because of leading space in front of 0 in 6th column awk '{ print $6 }' 2.1 link lan sata , 2u sata 1u ... goes on forever is there way filter out useless lines! here attempt this awk -f '$6 <= 1 {print $0}' here few lines 100005,pc-q08a,lian-li case pc-q08a mini tower 1/0/6 fan aluminum usb3.0 silver mini-itx retail,lian-li,cs, 0,145.98,7.92,ea,lb,csb,active,840353002388 100006,pc-q08b,lian-li case pc-q08b mini tower 1/0/6 fan aluminum usb3.0 black mini-itx retail,lian-li,cs, 0,127.28,7.92,ea,lb,csb,active,840353002395 100011,eah5450silent/di/1gd3(lp),asus video card ati radeon hd 5450 1gb ddr3 64bit low profile silent pci-express 2.1 dvi-i/hdmi/hdcp retail,asus tek,vc, 64,43.93,0.90,ea,lb,v1g,active,610839367436 100012,e78

javascript - Moving google maps api code to separate file + jquery -

this time, i'll go right point: html: <!doctype html> <html> <head> <link rel="stylesheet" type="text/css" href="style.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script> <script src="code.js"></script> </head> <body> <div id="map"></div> <script async defer src="https://maps.googleapis.com/maps/api/js?key=*snip*&callback=initmap"> </script> </body> </html> code.js: $(document).ready(function () { var map; function initmap() { map = new google.maps.map(document.getelementbyid('map'), { center: { lat: -34.397, lng: 150.644 }, zoom: 10 }); } }); result: uncaught typeerror: window.initmap not function. tips? also, wonder if pa

adding an element to JSON Array JavaScript -

i have following array in source code: var employees = [ { "question":"question 1", "answer":"answer 1" }, { "question":"question 1", "answer":"another answer 1" }, { "question":"question 2", "answer":"answer 2" } ]; i need create function can group answers related same question , put info in json object { "question":"question 1", "answer" : '[{"answer 1","another answer 1"}]' }, { "question":"question 2", "answer" : '[{"answer2"}]' } as said in comments, wrote answers strings not array of strings. what may want acheive : var employees = [ { "question":"question 1", "answers": ["answer 1"] }, { "question":"question 2", "answers"

php Foreach nested loop and array reset by itself in the middle -

Image
i have php code, 3 foreach loops , last 1 or maybe second 1 causing array reset @ point , can't find why? php code: <?php $months = range(1,12); foreach($accountsubs $subs){ ?> <tr style="display:none;" class="tablerow paddingzero childoverview <?php echo $classj;?>"> <td width="40" align="center"><?php echo $subs['codename'];?></td> <td><?php echo $subs['subclass'];?></td> <?php $itemcodes = $db->fetch_all_array("select * bg_itemcodes accountclass='".$subs['id']."' , cparent = '".$ac['id']."' "); $counter = 1; foreach($itemcodes $code){ foreach($months $ms){ echo $counter++; $makedate = strtotime($jdate.'-'.$ms.'-1'); $sdebits = $db->single("select sum($currency) $currency bg_journal factory='$jfac

linux - Connecting character device and physical PCIe driver -

i modifying existing linux device driver , library api. modification allow multiple devices (it hard-coded 1 device). 1 concept don't understand mapping between character device , pcie device itself. when initializing driver in probe method, create character device (or multiple). library api makes ioctl call using file descriptor character device. in driver itself, maintaining global variable device contains pci information. next step maintain state information pci device. what don't understand link between character devices created , pcie state information in driver. understanding character device created, , when open it, or ioctl it, commands mapped through driver. not sure how link character device receiving through device structure want control though. you can use minor device number so. when being probed, can register char devices same major number , different minor number , map own struct minor number. when ioctl called, can minor number cdev->dev

scala - Converting a foreach into contains forall matcher -

i have following expression in spec, intention of ensuring each element has value distancetoend close sum of distancefromprevious values of elements following it. foo.tails.foreach { case h +: t => h.distancetoend.miles must becloseto(t.map(_.distancefromprevious.miles).sum, 10e-10) case _ => ok } ideally, should in form foo.tails must contain { ... }.forall , have trouble understanding how create necessary valuecheck parameter contains . how convert particular example? unfortunately type inference doesn't work partial functions need match explicitly: foo.tails must contain { ts: list[foo] => ts match { case h +: t => h.distancetoend.miles must becloseto(t.map(_.distancefromprevious.miles).sum, 10e-10) case _ => ok } }.forall

jquery - Rails and Javascript in production environment -

hello stack overflow community! new ruby on rails, , nearing end of first project, having little bit of trouble getting app production ready. my first problem needed refresh page personal jquery work. fixed problem adding jquery-turbolinks gem project , adding jquery.turbolinks manifest file. however, quick solution did not work production environment, reason. changed ordering of stuff in manifest file, changed config.serve_static_files false , config.assets.compile true (in production.rb). none of js works in production. then, info gathered web, ran bundle exec rake assets:precompile. none of js or css effects evident in production! so finally, undo blunder, ran bundle exec rake assets:clean. terminal complaining have "untracked files" when committing changes git. clearly, i'm in absolutely messy situation. other blunder, project running smoothly, greatly, appreciated. ps: works in development environment... welcome stackoverflow! from you'

javascript - HTML5 FileSystem requestQuota Reservation? -

when requesting (and being granted) increase in quota filesystem api, space reserved chrome , lost other applications on device, or opportunistic quota grab, in take space quota, no more needs @ 1 time? example: navigator.webkitpersistentstorage.requestquota( 1024 * 1024 * 5000, function(grantedsize) { window.requestfilesystem(window.persistent, grantedsize, function(fs) { filesystem = fs; }, filesystemerrorhandler); }, filesystemerrorhandler); through code above chrome going assign 5gb filesystem no matter how it's filled, holding onto 5gb until it's cleared user? or chrome take needs 5 gb? chrome take needs 5 gb.

javascript - How do I implement ajax progress in TIdHTTPServer? -

i have service project provides http server via tidhttpserver, , web frontend. number of functions user may initiate can take 5-10 seconds complete, during time see gif animation while ajax request waits delphi code complete , return status. i'd implement progress bar, or percentage (perhaps estimated time remaining, etc), i'm not sure how should implemented. xmlhttprequest() has progress event, seems easy enough implement on client, how have server respond it's progress? from ajaxpatterns.org : another way deal long xmlhttprequest calls explicitly introduce second monitoring channel. while primary request takes place, sequence of monitoring requests issued ask server progress estimates. example, server might looping through 1000 records, running transformation on each of , saving database. loop variable can exposed monitoring service can convert percentage remaining figure.

php - Dynamic Text on Image Suddenly Not Working -

so i'm creating site returns quotes based on input. want quotes returned text on picture, found guide @ http://jonlim.ca/2011/11/creating-an-image-with-dynamic-text-in-php/ me. i'm running xampp test php , code looks like... <?php header("content-type: image/png"); /*$string = $_get['days'];*/ $im = imagecreatefrompng("twainpen.png"); imagealphablending($im, false); imagesavealpha($im,true); $transparent = imagecolorallocatealpha($im, 255, 255, 255, 127); imagepng($im); $black = imagecolorallocate($im, 0, 0, 0); $font = 'daniel.ttf'; $initialx = '153'; $initialy = '35'; $increasey = '23'; $fontsize = '16'; $fontrotation = '0'; $firstline = 'what mean'; $secondline = 'there ' . $string . ' days until'; $thirdline = 'christmas?! am'; $fourthline = 'i supposed until'; $fifthline = 'then? wait?! am'; $sixthline = 'not patient man!'; //i

java - how to do a sum on many ArrayLists quickly? -

in program have text file golf scores , have added each golfers scores arraylist. need sum of these scores in each arraylist total each golfer. file golf = new file("golf.txt"); scanner scan = new scanner(golf); int = 0; int parsum = 0, golfsum1 = 0, golfsum2 = 0, golfsum3 = 0, golfsum4 = 0; arraylist<integer> par = new arraylist<integer>(); arraylist<integer> golfer1 = new arraylist<integer>(); arraylist<integer> golfer2 = new arraylist<integer>(); arraylist<integer> golfer3 = new arraylist<integer>(); arraylist<integer> golfer4 = new arraylist<integer>(); while (scan.hasnext()) { par.add(i, scan.nextint()); golfer1.add(i, scan.nextint()); golfer2.add(i, scan.nextint()); golfer3.add(i, scan.nextint()); golfer4.add(i, scan.nextint()); i++; } (int j : par) { parsum += j; } (int j : golfer1)

Matlab efficient for loop possible or many needed? -

for = 1:length(startidx) j = 1:length(date(startidx(i):cutoffidx(i))) k = date(startidx(i):cutoffidx(i)); try shortidx(j)=find(and(and(and(and(and(jam>=1.2,jam<=2.3),expiration==xdates(i)),option_type=='c'),jamsym==1),quote_date==k(j)),1); catch warning('not present') shortidx(j)=0; end end end let's i = 1:4. on first pass through i, fine. when i = 2, overwriting stored shortidx data created when i 1. j length of each i , , k dates each i . tripped last part of try statement quote_date==k(j) because when i turns 2, j reset 1. though k correct set of dates i , overwriting shortidx variable, instead of appending it. there way me solve efficiently? or need create independent loop each i ? thank you. save 2d array indexed i , j . on each pass of inner loop shortidx(i, j) = someobscenelylongandstatement; for efficiency should preallocate shortidx before loo

github - Understanding on git remote -

i new git, , having difficulty in understanding git remote. suppose scenario me , friend ("mr x") works on project ("maptest"). have created project maptest , added repo. now command git remote gives me result > origin my doubt is 1)now mr x directly clone project in local, when should use git remote add [shortname] [url] command? 2)is me or mr x should run git remote add command? i went through many posts not able find answers these posts, sorry if dumb. if mr x clones repository, repository shown origin in local repository. if want pull or push repository, should use remote add able use shortcut (as origin) not having specify url pull or push every time.

php - Alert message always showing "successfully updated" even i input wrong using PDO? -

i have code updating records , working fine problem when try messed code see if working , try submit alert message displaying "successfully updated" should "updating failed" ever try displaying "successfully updated".can please me this? here's code class.user.php public function upload($id,$file_name,$file_size,$file_type,$username,$password,$province) { $stmt = $this->db->prepare("update tish_images set file_name=:file_name,file_size=:file_size,file_type=:file_type,username=:username,password=:password,province=:province id=:id"); $errors= array(); foreach($_files['files']['tmp_name'] $key => $error ){ if ($error != upload_err_ok) { $errors[] = $_files['files']['name'][$key] . ' not uploaded.'; continue; } $file_name = $key.$_files['files']['name'][$key]; $file_size = $_files['files']['size'][$key]; $file_tmp = $_files['files']['

webserver - How can I reach my localhost over the web from outside local? i.e ip/page? -

i installed usbwebserver everthing running, trying reach root page index.php? i read possibly can , sorry still cant figure out how reach localhost i reach page localhost:8080 , page want shows if replace ip:8080 not. i trying reach page outside of local network. i'm sorry, need provide separate answer reformatted question "down street" scenario. can troubleshoot few of issues you're having. isp's don't typically allow residential internet connections serve resources on port 8080, or 80. if configure computer needed, if you're on standard internet service provider they're blocking in middle if have punched holes local security in attempt serve assets on port 8080/80. assuming don't allow you're going have first configure outbound middleware(php in case) listen calls ip on different port. ( can in c:\wamp\ folder, in "wampserver" configuration file. here's walkthrough here: ( http://forum.wampserver.com/

Spring boot response REST service error -

my project @ https://github.com/murillocg/springboottest when acess uri, localhost/video, follow response: {"_links":{"search":{ "href":"http://localhost:8080/video/search" } }, "_embedded":{ "videos":[{"id":1, "name":"jogo da imitacao", "url":"www.globo.com", "duration":123, "persistententity":{ "idproperty": {"name":"id", "rawtype":"long", "field":{ "name":"id", "type":"long", "modifiers":2, "annotations":[{},{}], "synthetic":false, "declaredannotations":[{},{}], "declaringclass":"hello.repository.video", "enumconstant":false,