Posts

php - Regex to check if a character occurs more than X times in a string -

what regex check if character occurs more 2 times in string? example: "aab" allowed, not "aaa" or "aaba". is there way make match on valid inputs (when there less 3 repeating characters) preg_match() function returns 1 valid input (with less 3 repeating characters) , else 0? thanks! this regex find character repeats 3 times (or more because have hit 3 more). (.)\1{2} regex demo: https://regex101.com/r/wmupww/1 php usage: foreach(array('aaa', 'aab') $string) { if(preg_match('/(.)\1{2}/', $string)) { echo $string . ' doesnt match :(' . "\n"; } else { echo $string . ' matches'. "\n"; } } php demo: https://eval.in/672382

Laravel 5.3 -- Trying to check a checkbox in a dynamic list -

i have collection on user object named prefs contains collection named auctions. when dump user, can confirm such prefs: { auctions: { a320: false, a330: true, a340: true, b737cl: true, b737ng: true, b747: true, b757: true, b767: true, b777: true, regional: true, expendables: true, miscellaneous: true } } i trying check checkboxes in list of categories dynamically created (an admin can add more needed) following: <input type="checkbox" id="{{$cat->cat}}" name="categories[]" value="{{$cat->id}}" {{($user->prefs->auctions->$cat->cat ? 'checked' : '')}}> i getting errorexception in 17b600b2cf36de6dc2af6eb299cce5a13d6e20e0.php line 33: undefined property: illuminate\support\collection::$auctions (view: /users/jgravois/documents/code/_work/uaminc.com/resources/views/member...

Oracle sql query returning all of the values instead limiting the values -

full disclosure part of homework question have tried 6 different versions , stuck. trying find 1 manager every time query runs. i.e put department id in , 1 name pops out. currently, names, multiple times. have tried nesting '=' not nesting, union, intersection, etc. can manager id basic query, can't name. current version looks this: select e.ename .emp e d.managerid in (select unique d.managerid works w, .dept d, emp e1 d.did=1 , e1.eid=w.eid , d.did=w.did ); i realize basic mistake not seeing - ideas? its not clear mean 1 menager time. should different menagers time or same? lest go throw query: you select empolyes table emp manager_id in next query dataset you managers dep=1 . rest of tables , conditions not influent on result dataset. i theing did primary key table dept , if query may rewritten select e.ename emp e d.managerid in (select unique d.managerid dept d d.di...

arduino - How do I send AVRDUDE serial commands? -

when run avrdude in verbose mode, see sequence of serial commands duplicate in program. problem when send 0x30, 0x20 3 times, don't 0x14, 0x10 expect. i'm assuming there must type of mode select toggles between program , programmer. how gain access this?

ember.js - Ember livereload not working when scss file updated in pod structure -

i have following structure: app/ pods/ components/ user-login/ component.js style.scss template.hbs template files , component files livereload correctly, however, when save changes style files in atom changes not applied on webpage- applied when kill , rerun: ember server and reload webpage. have installed following: ember-cli-styles-reloader and have tried adding: "livereload": true, "watcher": "polling" to: .ember-cli and tried adding these options to: ember-cli-build.js inside app variable. what missing? there better option believe, , recommend way: first install ember-cli-sass-pods addon uses ember-cli-sass (will install automatically) , generate style scss files pods directories. to install ember install ember-cli-sass-pods then add var app = new emberapp(defaults, { // must add watched folder ember-cli-build.js sassoptions: { includepaths: ['a...

java - Unsure if I should split my subclasses -

i have text file reads in information of various employees. i've created 2 array list based on years of employee object. employee has 2 subclasses, salesman , executive. i'm wondering how should split commas if there's 2 subclasses, since can't call super class here's employee class public class employee { private string name; private double monthlysalary; public employee(string line) { string[]split=line.split(","); name=split[0]; monthlysalary=double.parsedouble(split[1]); } public string getname() { return name; } public void setname(string name) { this.name = name; } public double getmonthlysalary() { return monthlysalary; } public void setmonthlysalary(double monthlysalary) { this.monthlysalary = monthlysalary; } public double annualsalary() { return monthlysalary*12; } public string tostring() { string str; str="name: "+name; str+="\nmonthly salary: "+monthlys...

Play audio when checkbox is checked with javascript -

i'm trying make short audio file play when html checkbox checked. i'm missing elementary. here code: <body> <input type="checkbox" id="cena" onchange="myfunction()"></input><label for="cena"></label> </label><script> function myfunction(){ var audio = new audio('rusbtaudio.mp3'); audio.play(); } </script> </body> rusbtaudio.mp3 in same folder html file. <input> element self-closing. use .load() , canplay event. substitute new audio() new audio() <body> <input type="checkbox" id="cena" onchange="myfunction(this)" /> <label for="cena"></label> <script> var audio = new audio('rusbtaudio.mp3'); audio.oncanplay = function() { if (document.getelementbyid("cena").checked) this.play() } function myfunction(el) { if (el.checked) { ...