Posts

php - Laravel multiple many to many relationships? -

so using laravel , running issue, have relational model adsale, have setup hasone relationship adimpressions. example grab adsale records userid = 1. 5 different rows back, each of 5 rows have 5 adimpression rows match , have info clicks , impressions. end goal adimpression rows. when run has 1 impressions() method undefined method. if foreach on adsale records individually , run impresssions() method works. here code class adsale extends eloquent{ protected $table = 'adsale'; public function impressions() { return $this->hasone('adimpression','adsaleid','id'); } } here connecting adsale respective adimpression via adsaleid in adimpression table. this running in controller. $sales= adsale::where('userid','=', 1)->get(); $impressions = $sales->impressions(); now expect $impressions variable have adimpressions entry correlates adsaleid, getting undefined function since there multiple val...

java - Getting the coordinates of the panel -

using mouseevents, able x , y coordinates of frame, yet unable x , y coordinates of panel. below codes me getting x , y coordinates of frame. public void mousemoved(mouseevent e) { x = e.getx(); y = e.gety(); text = integer.tostring(x) +","+integer.tostring(y); frame.frame.repaint(); } the below codes me trying x , y coordinates of panel, it's painting out 0's instead. paint.paint name of jpanel. don't know i'm doing wrong. please if can. public void mousemoved(mouseevent e) { x = paint.paint.getx(); y = paint.paint.gety(); text = integer.tostring(x) +","+integer.tostring(y); frame.frame.repaint(); } if understand right, mouselistener registered jframe, , wish x/y relative jpanel contained within jframe. x , y within mouseevent refer component in mouselistener registered. if have mouselistener registered on parent container, , coordinates of mouseevent relative child component, can using swinguti...

Meteor Collections schema not allowing Google authentication -

i'm building simple user account using meteorjs. user given option login/register using google. if registering first time, users prompted fill out profile information after authenticating user account. i'm using collections2 manage schema user account , attaching meteor.users, seen here: var schemas = {}; schemas.userprofile = new simpleschema({ firstname: { type: string, regex: /^[a-za-z-]{2,25}$/, optional: true }, lastname: { type: string, regex: /^[a-za-z]{2,25}$/, optional: true }, gender: { type: string, allowedvalues: ['male', 'female'], optional: true } }); schemas.user = new simpleschema({ username: { type: string, regex: /^[a-z0-9a-z_]{3,15}$/ }, _id : { type: string }, createdat: { type: date }, profile: { type: object }, services: { type: object, black...

string - How to get a character from an extended ascii number -

the ascii code charts "ü" @ 129 (decimal). when trace("ü".charcodeat(0)) ... answer 252 - wrong. seems string.charcodeat() works 0-127. how convert between char , charcode values ranges 128-255? since there more 1 character set call "extended ascii," there isn't meaning term. ascii used. as you've found, important know character set , encoding using. although libraries flexible in adapting "the platform default," programs aren't written way and, if read or write data across systems, flexibility moot. there no text encoded text. when pass text, have data loss if don't give encoding metadata. actionscript strings sequences of unicode/utf-16 code units. see charcodeat() . unlike character sets, unicode has several encodings; utf-16 being 2 of them. (integers stored big endian or little endian , utf-16 code unit. utf-16 means either utf-16be or utf-16le, depending platform, through use of bom in string, data can s...

javascript - How to do dropdown item on navbar with material angular -

i'm using angularjs googles material angular library https://material.angularjs.org/ they have drop down items in navbar on site, can't find object or example make 1 of own. how can achieve this? thank you! angular material side menu use below code markup <md-sidenav layout="column" class="md-sidenav-left md-whiteframe-z2" md-component-id="left" md-is-locked-open="$mdmedia('gt-md')"> <md-list> <md-item ng-repeat="item in menu"> <a> <md-item-content md-ink-ripple layout="row" layout-align="start center" ng-click="$parent.navigate(item.icon)"> <div class="inset"> <ng-md-icon icon="{{item.icon}}" ></ng-md-icon> <md-tooltip md-direction="right">{{item.title}}</md-tooltip> </div> </md-item-content> <...

audio - C# How does the following code for Low Pass Filter run? -

i have following c# code low pass filter found on naudio site: public void setvalues(isampleprovider sourceprovider,int cutofffreq) { this.sourceprovider = sourceprovider; this.cutofffreq = cutofffreq; filter_lowpass(); } private void filter_lowpass() { channels = sourceprovider.waveformat.channels; filters = new biquadfilter[channels]; (int n = 0; n < channels; n++) if (filters[n] == null) filters[n] = biquadfilter.lowpassfilter(44100, cutofffreq, 1); else filters[n].setlowpassfilter(44100, cutofffreq, 1); } public waveformat waveformat { { return sourceprovider.waveformat; } } public int read(float[] buffer, int offset, int count) { int samplesread = sourceprovider.read(buffer, offset, count); (int = 0; < samplesread; i++) buffer[offset + i] = filters[(i % channels)].transform(buffer[offset + i]); ...

jdeveloper - Oracle ADF: af:selectOneChoice Hierarchy changes -

Image
i developing web application using oracle adf. in have page follows in above image have 2 select lists. first 1 country , second 1 state. requirement when user select value country list have add appropriate states states list programatically. suppose user has selected india need states in india ap, ka, mh, tn that. i have tried this post . fixed , need add values dynamically. please me in achieving this. in advance. tthe way approach though programatic view objects. adf build work best adf bc more exactly: create simple vo based on sql statement: select '' country, '' state dual for country attribute, need create programatic view object : countrylov. same thing state attribute - statelov. this not simple task, can find quite few examples around: http://andrejusb.blogspot.co.uk/2013/12/detail-view-object-instance.html http://adfpractice-fedor.blogspot.co.uk/2011/01/adf-bc-programmatically-populated-vo.html http://www.jobinesh.com/201...