Posts

laravel - creating different type of users -

im creating app haves 2 type of users (employers , candidates). in app have 4 tables (users, candidates, employers, account_types), users table : - email, - name, - surname, - password - account_type candidates table: - id; - user_id - other columns employers table: - id; - user_id - other columns accounts_type: -id; - title so have 2 different routes each type of user, if candidate "domain.com/candidate/register" , if employer "domain.com/employer/register". im looking @ ready code laravel im kinda strugglying right way it. im on authcontroller looking @ function create, need create 1 more record, beside record users table, need example if employer, create record , insert in employers table , vice versa if candidate. need first check type of account being passed, thought in using hidden field in registration form indentify in create function type of user , create conditionals in create function, dont think approach. can guide me in best way in passi...

language agnostic - Is floating point math broken? -

0.1 + 0.2 == 0.3 -> false 0.1 + 0.2 -> 0.30000000000000004 why happen? binary floating point math this. in programming languages, based on ieee 754 standard . javascript uses 64-bit floating point representation, same java's double . crux of problem numbers represented in format whole number times power of two; rational numbers (such 0.1 , 1/10 ) denominator not power of 2 cannot represented. for 0.1 in standard binary64 format, representation can written as 0.1000000000000000055511151231257827021181583404541015625 in decimal, or 0x1.999999999999ap-4 in c99 hexfloat notation . in contrast, rational number 0.1 , 1/10 , can written as 0.1 in decimal, or 0x1.99999999999999...p-4 in analogue of c99 hexfloat notation, ... represents unending sequence of 9's. the constants 0.2 , 0.3 in program approximations true values. happens closest double 0.2 larger rational number 0.2 closest double 0.3 smaller rational number 0.3 . sum ...

layout - Syncronize ui file with cpp on Qt -

i writing simple app using qt. project contains ui file because easier change layouts. well, edit cpp file add new. ui file not show it. for example, in cpp use qwidget *logo = new qwidget(this); logo->setstylesheet("background-color: red"); logo->setgeometry(qrect(50,50,500,110)); but when open ui file within design mode, new red rectangle not there. how update layout on ui file?

mysql - Failure To Execute SQL Subquery With Join -

please can tell me i'm not doing right. here query want execute, nothing happens when run command. i'm new sql pardon mistake, if any. select t.*, count(distinct t.subjects) subjectenrollment, u.urefnumber, u.uresidence ( select r.*, @currank := if( @prevrank = finalscore, @currank, @incrank ) position, @incrank := @incrank + 1, @prevrank = finalscore studentsreports r, ( select @currank := 0, @prevrank = null, @incrank := 1 ) c order finalscore asc ) t left join studentstbl u on t.studref = u.urefnumber t.author = :staff , t.studentname = :student , t.academicyr = :year , t.academicterm = :term , t.program = :program , t.classes = :level , t.subjects = :subject; as can seen code, i'm trying fetch students records, , include column position in each subject, number of students offering each subject. more over, want include each student's residential status, in different table. at point, want add accumulated raw scores...

c# - Look for words in a textbox text and display in data grid -

i need program windows form in c#, needs textbox , button. in textbox have type programming instruction example: for(i=0;i<10;i++) then click button , in datagrid should displayed this: for - cycle ( - agrupation i - variable = - asignation and on how can identify parts of text? i've tried foreach char i'm messed :( please here solution can use cobbled together. highly recommend familiarise regular expressions: https://msdn.microsoft.com/en-us/library/az24scfc(v=vs.110).aspx and here nice tester used: http://regexstorm.net/tester using system.text.regularexpressions; string input = "for(i=0;i<10;i++)"; string pattern = @"^(\w+)(\w)(\w)(\w).*$"; matchcollection matches = regex.matches(input, pattern); string cycle = matches[0].groups[1].value; string agrupation = matches[0].groups[2].value; string variable = matches[0].groups[3].value; string asignation = matches[0].gr...

r - Frequencies data table multiple columns -

i have data table this require(data.table) dt <- data.table(a= c("a","a","b","b","b"), b= c("a","a","c","c","e"), c=c("d","d","b","b","b")) i want count frequencies all columns . know how 1 one, want in 1 instruction because data has lot of columns. result must one: dt[,a1:=.n, = c("a")] dt[,a2:=.n, = c("b")] dt[,a3:=.n, = c("c")] require(data.table) dt <- data.table(a= c("a","a","b","b","b"), b= c("a","a","c","c","e"), c=c("d","d","b","b","b")) #dt # b c #1: a d #2: a d #3: b c b #4: b c b #5: b e b l=lapply(seq_along(colnames(dt)), function(i) dt[,eval(colnames(dt)[i]),with=f][...

c# - Store Select Results In DataTable -

i querying sql server table , storing result in data table, needing pass values datatable parameter second query. results of query stored in second datatable. syntax can not right. have, have multiple compile errors. can assist me syntax , proper syntax? sql.datatable datatable1 = new sql.datatable(); string constring = @"server=hometest;database=testing;integrated security=sspi;"; stringbuilder query = new stringbuilder(); sql.datatable datatablesupervisors = new sql.datatable(); query.append("select top 1 supervisorid activesupervisors"); using (sqlconnection cn = new sqlconnection(constring)) { using (sqldataadapter da = new sqldataadapter(query.tostring(), cn)) da.fill(datatablesupervisors); } foreach (datarow row in datatablesupervisors.rows) { using (sqlconnection conn = new sqlconnection("server=hometest;database=testing;integrated security=sspi;") { sqlcommand command = new sqlcommand(); command.commandtext = "s...