Posts

php - How to use "where not" in a Laravel Model Relationship? -

i have user table similar to: === users === id: int (pk) name: string is_coach: bool ... and coach request table similar to: === coach_requests === id: int (pk) student_id: int(fk => users.id) coach_id: int(fk => users.id) ... i have corresponding laravel models (i.e. user , coachrequest ). in user model, wish make method such given specified user, return users is_coach = true , except: him/herself , users have been matched person coach in coach_requests table. for example consider following sample data: users (1, "a", false) (2, "b", true) (3, "c", true) (4, "d", true) (5, "e", true) (6, "f", true) coach_requests (1, 2, 3) (2, 2, 4) (3, 3, 2) (4, 3, 6) (5, 4, 5) (6, 4, 6) (7, 5, 6) (8, 6, 5) (9, 1, 4) now if user with: id 1 (i.e. user "a"), return user ids: 2, 3, 5 , 6 id 2, return user ids: 5, 6 id 3, return user ids: 4, 5 id 4, return user ids: 2, 3 id 5, return user ...

c# - LINQ - Join 2 tables, Group by DateTime.Month , multiple Counts -

i'm pretty new c# , linq , i'm trying list of emails holds sum of emails, attachments , user's (the one's sent email). so current problem output of query false. number of email's equal number of attachment's obvious wrong. query: var monthquery = em in dbedoka.email join ema in dbedoka.email_attachment on em.id equals ema.email_id e e2 in e.defaultifempty() group e2 em.erstellt_am.month grouped select new entities.month { nameofmonth = grouped.firstordefault().erstellt_am.tostring(), numberofmails = grouped.distinct().count(m => m.email_id != null).tostring(), numberofattachments = grouped.count(a => a.id != null).tostring(), numberofusers = grouped.select(u => u.erstellt_von).distinct().count().tost...

audio - Python import sounddevice as sd (ImportError: No module name sounddevice) -

i have python code running on raspberry pi b++ uses sounddevice library lets play , record sounds python. have installed modules. can confirm through python command line , enter import sounddevice sd works without errors. have confirmed typing ('modules') in python command line , sounddevice module appears. when running code in independent python program importerror: no module name sounddevice appear. hope 1 can help. here included code: import sounddevice sd the error: importerror: no module name sounddevice hello after alot of trial , error final solved on pip install sounddevice --user . you need remove --user part command is: pip install sounddevice . installs through out entire system , works.

php - How to update the data in an array with a specific array key? -

i creating cart using session , 2d array problem want change content of 1 of array in 2d array , have order id make sure changes correct array, here's code please me; this code inserting new item: if(isset($_post['addtocart'])){ $count= count($_session['cart']); $newproduct= array( 'id' => $count, 'code' => $_session['code'], 'color' => $_post['color'], 'type' => $_post['type'], 'size' =>$_post['size'], 'quantity' => 1 ); $_session['cart'][]= $newproduct; } $_session['cart'] name of 2d array. here's sample list: $_session['cart']=> array([0] =>(array order=> 0, code=> 123, color=> blue, type=> us, size=> m. quantity => 1 ); ([1] =>(array order=> 1, code=> 125, color=> red, type=> uk, size=> s. quantity =...

java - How can I sum the product of two two-dimensional arrays? -

so got code 2 arrays: 1 array contains tickets sold 3 cinemas , other 1 contains adult , kid prices. code outputs total every cinema separately (3 lines of output) need total number of 3. instead of printing 828 cinema1, 644 cinema2, 1220 cinema3 , need print 2692 (total of 3 cinemas). how can sum 3 products loop? here's code: public class arrays { public arrays() {} public static void main(string[] args) { float[][] = new float[][] {{29, 149}, {59, 43}, {147, 11}}; float[] b = new float[] {8, 4}; string[] s = new string[] {"cinema 1", "cinema 2", "cinema 3"}; string[] t = new string[] {"adults", "children"}; int i,j; system.out.println("cinema complex revenue\n\n"); ( = 0 ; <= 2 ; i++ ) { ( j = 0 ; j < 1 ; j++ ) { system.out.println(s[i] + "\t$" + (a[i][j] * b[j] + a[i][j...

html - float right doesn't work -

Image
sorry basic question. i'm new in css , try work. have following markup: <div class="box-title"><p>element-betonbecken premium</p></div> <img src="img/page1/pool-top.png" class="pool-img" alt="" /> <div class="box-small-title-right"><p>elementtreppen</p></div> <div class="box-elementtreppen"></div> and have css markup: .box-title { background-color: rgba(255, 255, 255, 0.5); width: 900px !important; height: 67px; margin-top: 20px; font-weight: 600; line-height: 67px; } .box-title p { font-weight: 600; line-height: 67px; padding-left: 20px; } .box-small-title-right { background-color: rgba(255, 255, 255, 0.5); width: 460px; height: 40px; float: right; margin-top: 2px; } .box-small-title-right p { font-weight: 600; line-height: 40px; padding-left: 20px; } .box-small-title-left { opacity:...

nginx - Socket.Io under multinode cluster on loopback-pm -

i'm using process manager of strongloop called strong-pm cluster node instances, use last socket.io library websockets implementation, i saw exist node module call socket io store clusters to resolve problem using node's native cluster messaging, question module used under strong-pm resolve problem of clustering socket.io??, not how can resolve problem of cluster nodes using strong-pm , socket.io. actually make tests, using strong-pm , nginx, configure nginx connect socket.io clients server, when try broadcast event server clients event never sent, supouse need module between strong-pm , nginx manage sticky-sessions correctly. suspicious correct?? regards i resolve problem using socket.io redis adapter , force socket.io client use websockets protocol this: var socket = io({transports: ['websocket', 'flashsocket', 'htmlfile', 'xhr-polling', 'jsonp-polling', 'polling']});