Posts

How to use the varchar data type in c#? -

i have piece of code , want make varchar not string. appropriate syntax in c# string emri = row["nome"].tostring(); i have query have run , use emri in , compare column in table have created in mysql. column in mysql of type varchar(20). when execute code gives error in query , guessing maybe reason i have query string query = "if not exists(select * clienti codcliente= " + id + " , nome = '" + emri + "' , ragionesociale=' " + ragsoc + " ' , partitaiva=' " + piva + " ') insert clienti values(" + id + " ,' " + emri + " ',' " + ragsoc + " ',' " + piva + " ') else update clienti set( " + id + " ,' " + emri + " ',' " + ragsoc + " ',' " + piva + " ')"; and gives me problem you have error in sql syntax; check manual corresponds mysql server version right syntax use...

list - Transform from [[Char]] to own data type in Haskell -

this question exact duplicate of: scanl in haskell 1 answer scanl (\exp y -> scanl (\x -> if (isletter x) update exp (literal x) "" else if x=='+' update exp epsilon "+" else if x=='*' update exp epsilon "*" else update exp epsilon "|") y) epsilon q my data type is: data reg = epsilon | literal char | or reg reg | reg reg | star reg deriving eq and update:: reg -> reg -> [char] -> reg update b "" = (a `then` b) update b "|"= (a `or` b) update b "*" = (star a) update b "+" = (plus a) update b "?" = (opt a) and trying transform ["a|","bc"] (then (or b c)) using functions above , can't use parsec . please don't "manually", end ...

iphone - Facebook SDK FBLoginView getting EXC_BAD_ACCESS -

i'm following hellofacebooksample project bundled facebook sdk 3.5. i've virtually copied , pasted own app, stuff appdelegate, yet reason clicking login button freezes app. record, authenticates correctly when connecting integrated framework in ios 6, done through fb sdk anyway. it's when try log in using web, i.e. hit fbloginview website opens, authenticated, return app. here code in samepl project, , i'll compare mine: fbloginview *loginview = [[fbloginview alloc] init]; loginview.frame = cgrectoffset(loginview.frame, 5, 5); loginview.delegate = self; [self.view addsubview:loginview]; [loginview sizetofit]; mine little different: loginview = [[fbloginview alloc] init]; loginview.delegate = self; [self.facebookcell addsubview:loginview]; [loginview sizetofit]; as delegate methods, i've implemented them verbatim. why app crash? there no valid reason crash when code pretty identical between app , sample app. debugger doesn't zombie objects on. ac...

python - Random Phrase Creator -

i want create program generate random phrase creating 10 random integers 1 20, , depending on each variables integer, word or phrase produced. there easier way following: #this random phrase generator import random rand1 = random.randint (1, 20) rand2 = random.randint (1, 20) rand3 = random.randint (1, 20) rand4 = random.randint (1, 20) rand5 = random.randint (1, 20) rand6 = random.randint (1, 20) rand7 = random.randint (1, 20) rand8 = random.randint (1, 20) rand9 = random.randint (1, 20) rand10 = random.randint (1, 20) if rand1 ==1: print ('squirrel') and on... p.s. using python 3 thank helpful advice. new python, , helpful have people can me create better code. if cares, used program talks you, , offers chance hear jokes , play several games. have nice day. pps ended going with: import random words = 'squirrel orca ceiling crayon boot grocery jump' .split() def getrandomword(wordlist): # function returns random string passed list of strin...

java - Changed & Improved passing data from WebServlet to a WebService -

i'm pretty new writing servlet , rest services, i'm @ problem i'm not sure if i'm doing correctly. service this: @post @produces ("application/json") @path ("/register") public string register( @formparam("name") string name, @formparam("username") string username, @formparam("password") string password, @context httpservletresponse servletresponse) throws ioexception { if( this.user_taken(username) ) return "username_taken"; user user = new user(name,username,password); ..... return mapper.writevalueasstring(user); } so can see service takes care of doing end (database , creating user) servlet on other hand in charge of taking request form, validating , passing service . servlet code: ... validate user input form ... clientconfig config = new defaultclientconfig(); client client = client.create(config); webresource service = client.resource("http://localhos...

Import hashed user passwords into Meteor app -

i have existing site has user passwords hashed using sha1 hashing algorithm. need port users (and passwords) new meteor site. is possible? i encountered similiar problem , migrated accounts , had users reset passwords. can use built standard accounts methods handle login+reset functions. login method call: meteor.loginwithpassword(email, password, function(err){ if (err){ if(err.reason === "user has no password set"){ session.set('loginerrormessage', 'you have been migrated... reset password...'); //your template push user reset password } }else{ //normal login } }); can if have custom login form, possibly lightly customize accounts-ui package if desired this approach has worked pretty app far, users have follow password reset procedure , go

r - change distance of x-axis labels from axis in sciplot bargraph -

Image
i'm constructing plot using bargraph.ci sciplot. x-axis represents categorical variable, values of variable names different positions on x-axis. unfortunately these names long, @ default settings, of them disappear. solved problem splitting them multiple lines injecting "\n" needed. worked, because names multi-line, close x-axis. need move them farther away. how? i know can mgp, affects y-axis too. i know can set axisnames=false in call barplot.ci, use axis create separate x-axis. (in fact, i'm doing that, make x-axis extend farther default- see code below.) give x-axis own mgp parameter not affect y-axis. far can tell, axis() set ordinal or continuous variables , doesn't seem work great categorical variables. after fiddling, couldn't put names in right locations (i.e. right under correspondence bars) finally, tried using mgp.axis.labels hmisc set x-axis mgp, precisely want, far tell had no effect on anything. ideas? here's code. ylim = c(...