Posts

c# - Linq issues, joining two tables and a collection -

ok, need suck @ linq! this collection contains x number of time slot dto's given day. list<timeslotdto> timeslots = new list<timeslotdto>(); the timeslotdto contains datetime slotstart property , bool isreserved . collection works, contains number of timeslots want. fine. now problem. want use collection in linq query. have 2 tables," staff " , " timeslots "(well three, if might able add last table query myself) the " timeslots " table contains: staffid(fk) timeslotid(pk) slotstart activityid(fk third table). the " staff " table contains: staffid(pk) navigation property timeslots based on this...i want produce result each staff member has list of timeslots , slots in collection has same date in timeslots table isreserved prop should set true. so timeslots collection contains possible slots given day. timeslots table contains reservations. want x-check collections find reservations each staff mem...

c# - Dividing by 2 vs Multiplying by 0.5 -

consider following: void foo(int start, int end) { int mid = (start + end) / 2; } void bar(int start, int end) { int mid = (start + end) * 0.5; } why foo compiles while bar not? dividing 2 implicitly casts result int while multiplying 0.5 gives un-casted double : cannot implicitly convert type 'double int. explicit conversion exists(are missing cast?) what c# language designers' reasoning behind this? the / integer division ( 5/3 = 1 ). make float division 1 of operand must floating point ( float or double ). because there cases when application wants access quotient or remainder of division (for remainder use % ). also, integer division faster floating one. on other hand, multiplying float gives float. save integer type have type cast yourself. floating point values have different representation in memory , can lead loss of precision. it same thing in programming languages: of them have integer division , floating point division, ...

css - ie11 broken background image on rounded corners -

Image
jsfiddle example: http://jsfiddle.net/q5ajl/ screenshot jsfiddle in ie11, dev mode off: screen shot actual site: has seen before? in ie11 of borders have strange broken affect. it seems semi transparent image breaking around rounded corners. how on earth can fix this? sigh.. ie.. pain in side of web design life. .small-card{ border-radius: 5px; display: inline-block; width: 100%; max-width: 400px; margin-bottom: 25px; } .trans{ background-image: url(/png/transparent/white/40_percent.png); background-repeat: repeat; border: solid 1px #fff; } this ie11. when turn on devloper mode issue vanishes! confusing. i don't understand going on. , above, turn on developer mode issue disappears. occurs there rounded corner involved.

c++ - Swedish characters don't compare correctly -

for reason if/else statements isn't working correctly me in c++ the problem when variabel equal right (höger), won't output if statement, instead go on else statement. if replace letter 'ö' 'o' becomes 'hoger' instead, if statement work. whenever write word 'höger' won't go if statement, instead go else statement. if make variabel equal 'hoger', , write 'hoger', work. how can make possible writing 'höger' if statement recognizes instead? it's if swedish letters don't work. my code this: #include <iostream> #include <string> using namespace std; int main() { setlocale(lc_all,""); string test; // define variabel cout << " höger elle vänster"<<endl; // right or left cin >> test; if(test == "höger") { // if right, output this. cout <<"du valde höger"<<endl; } else if(test == ...

c++ - Path Include in Make/options file -

i have simple problem, think, can't find solution. i've included "mathcalls.h" file 1 of projects since need use pow(double, double) method of it. therefore i've added filepath to... ... make/options file: -iusr/include/i386-linux-gnu/bits ... include file of ide (qt creator): /usr/include/i386-linux-gnu/bits for include tried #include "mathcalls.h" #include <mathcalls.h> but when building project error: /home/user/solvernew/multiphaseeulerfoamnew.c:46: error: mathcalls.h: no such file or directory when looking @ this, seems compiler searching in project directory although have added path file? please note in "usr/include/i386-linux-gnu/bits" root has full access, others authorised "access files". how can solve problem professionally? the professional way gain access double pow(double x, double y) is: #include <cmath> or, @ pinch: #include <math.h> then there no issues grov...

machine learning - error tuning SVM in R -

i'm tuning svm in r , receive following error: #error in if (any(co)) { : missing value true/false needed i'm using caret package svmrtune <- train(x=datatrain[,predmodelcontinuous],y=datatrain[,outcome],method = "svmradial", tunelength = 14, trcontrol = trctrl) the training set structure is str(datatrain) 'data.frame': 40001 obs. of 42 variables: $ polnum : num 2e+08 2e+08 2e+08 2e+08 2e+08 ... $ sex : factor w/ 2 levels "male","female": 1 1 1 2 1 2 1 1 1 2 ... $ type : factor w/ 6 levels "a","b","c","d",..: 3 1 1 2 2 4 3 3 3 2 ... $ catgry : ord.factor w/ 3 levels "large"<"medium"<..: 2 2 2 3 3 3 3 2 2 2 ... $ occup : factor w/ 5 levels "employed","housewife",..: 2 1 1 1 5 4 1 1 4 2 ... $ age : num 48 23 23 39 24 39 28 43 45 38 ... $ group : factor w/ 20 levels "1","2"...

c - too much specular light opengl -

these settings diffuse,ambient , specualar , position of light. scene looks extremly lit specualar light. have tried adjusting position of light doesn't anything. glfloat greendiffusematerial[] = {0.0, 1.0, 0.0,1.0}; glfloat whitespecularmaterial[] = {1.0, 1.0, 1.0,1.0}; glfloat greenambientmaterial[] = {0.0, 1.0, 0.2,1.0}; glfloat greenemissivematerial[] = {0.0, 1.0, 0.5,1.0}; glfloat lightposition[] = { 0.0,1.0,0.0, 0.0}; glfloat ambientlight[] = { 0.0, 0.0, 0.0, 1.0 }; glfloat diffuselight[] = { 1.0, 1.0, 1.0, 1.0 }; glfloat specularlight[] = { 1.0, 1.0, 1.0, 1.0 }; edit 1 (int g =0;g<6400;g++){ glbegin(gl_quads); if(mounttext %2 ==0){gltexcoord2f(islandvert[g][0] /xscale,islandvert[g][2] / zscale);} else{ glenable(gl_normalize); gldisable(gl_texture_2d); glshademodel(gl_smooth); glenable(gl_color_material); glenable(gl_depth_test); glmaterialfv(gl_front_and_...