Posts

Featured post

javascript - Is getTimezoneOffset() stable during daylight saving transition? -

i have date time below conversion logic in javascript converting utc time passed timezone's local time. wondering logic work fine during daylight transition? if not remedy that? can't use third party library. have use pure javascript or angular js. function mytime() { var d1= document.getelementbyid("txtdate").value; var zoffset = document.getelementbyid("txtoffset").value; console.log("date1",d1); var d2 = new date(d1.replace(/ /g,'t')); var d3= d2.gettime()+(d2.gettimezoneoffset()*60000); console.log("date2",d2); console.log("date3",d3); var d4 = new date(d3 + (3600000 * zoffset)); console.log("date3",d3); console.log("date 4",d4); var d5 = d4.tolocaletimestring(); console.log("date 5",d5); ...

How to check data type in C++? -

i'm new c++, i've been using python. i'm trying check type of variable of value stored in objects i'm working on. remember in python there comand isinstance use condition run commands, if next value string, a, , if it's int b. is there way check what's data type on variable in c++? example: in python had array math operation, each character in field [3,"+",2] as read array separate ints strings isinstance command if isinstance(list[0],int): aux1.append(list[0]) list=list[1:] else: if isinstance(lista[0],str): aux2.append(list[0 list=list[1:] now in c++ need similar, time each character in node linked list , again, need separate them, ints in linked list, , strings in linked list what seem struggling c++ statically , (relatively) typed language. discussion each of these terms mean refer this other question , it's explained there better could. first of should sure need...

java - Random generator Letters and Integers -

sas pgmr learning java android random generator-'rank amateur'. suppose wish display random of a/b/c/d. suppose random of 1/2/3/4 , 'if 2 display b, if 4 display d'? you store letters in array. random 1 array. int dex = new random().nextint(letters.length); string random = (letters[dex]); but comes out same.

formula - R: how to pass in a reference to the variable in glm or lm? -

so let's have named vector: sorted = c(1,2,3) names(sorted) = c("a","b","c") and it'll following: > sorted b c 1 2 3 so vector named a,b,c, , has value 1,2,3 respectively. and have sample data: data.ex = as.data.frame(matrix(rep(c(1,2,3,4),3), nrow = 3, ncol = 3)) colnames(data.ex) = c("a","b","c") so data frame has 3 columns named a,b,c well. i want predict c using value in glm(): fit.ex = glm(formula = c ~ names(sorted)[2], data = data.ex, family = binomial(link = "logit")) but then, i'll keep getting following error message: error in model.frame.default(formula = c ~ names(sorted)[2], data = data.ex,: variable lengths differ (found 'names(sorted)[2]') i read article here , found as.name() function, still not working: http://www.ats.ucla.edu/stat/r/pages/looping_strings.htm and cannot find else thats similar problem. please, if the...

sql server - SQL Query returns one result, does not return 0 or NULL result -

i trying query list advisers , provide count of active students each. can list advisers have 1 student, exclude more 1, can not return advisers 0 or null count. select advisors.advisorid, advisors.firstname, advisors.lastname, count(case students.isactive when '1' 1 else null end) "number of students" advisors, students advisors.advisorid=students.advisorid group advisors.advisorid, advisors.firstname, advisors.lastname having count(case students.isactive when '1' 1 else null end)='1' counts active studnets, , returns advisor list advisor 1 student, advisers 0 students come blank. missing? select advisors.advisorid, advisors.firstname, advisors.lastname, count(case students.isactive when '1' 1 else null end) "number of students" advisors, students advisors.advisorid=students.advisorid group advisors.advisorid, advisors.firstname, advisors.lastname having count(case students.isactive when '1' 1 else null end) null ...

xcode - Having trouble with Unity + iOS + Amazon ads -

i have been stuck hours. implemented amazon mobile ads unity project ios application. added unity plugin , framework amazon ads in unity project. build iphone , ipad , amazon ads work perfectly! but, when go archive project in order send apple, mach-o linker error. says amazonadoptions.o built without using bitcode. tried disabling bitcode made more errors. have no idea i'm doing wrong. appreciate opinions on i'm missing. guys!

Why does PHP consider 0 to be equal to a string? -

i have following piece of code: $item['price'] = 0; /*code item information goes in here*/ if($item['price'] == 'e') { $item['price'] = -1; } it intended initialize item price 0 , information it. if price informed 'e' means exchange instead of sell, indicated negative value because stored in database requires numeric value. there possibility leave price 0, either because item bonus or because price set in later moment. but, when price not set, leaves initial value of 0, if loop indicated above evaluates true , price set -1. is, considers 0 equal 'e'. how can explained? edit: when price provided 0 (after initialization), behavior erratic: if evaluates true, evaluates false. you doing == sorts out types you. 0 int, in case going cast 'e' int. not parseable one, , become 0 . string '0e' become 0 , , match! use ===