Posts

ios - Xcode8 : Why Xcode8 is not building/compiling after converting to Swift3 syntax's -

Image
i ran project in xcode8 asked me convert swift3 syntax's did it, there many errors errors fixing 2 days. after converted swift3 step step(error resolving). when build not ran once either in device or simulator. why not moving further ? it not throwing errors fix any(checked again , again) i worried. there need check in build settings or in code ? please refer below image warnings: xcode8 compiler bug : sometimes compiler not detecting errors in xcode8 so started commenting 1 one method/class in swift files there found 1 method troubling compiler has not updated swift3 syntax's after changed syntax's ran successfully many things need check if facing above issue in xcode8 swift3 please refer below syntax's thank above comments helps me think issue nsfetchrequest before : //let fetchrequest = nsfetchrequest() nsfetchrequest in swift3: let fetchrequest = nsfetchrequest<sample>(entityname: "sample") note: *...

c# - Encrypt-then-MAC, how to afterwards add data to HMAC -

i want include iv , salt in hmacsha512 calculation without add encrypted data. @ moment change iv , wouldn't noticed that. i chain different streams ensure encrypt-then-mac, later want encrypt large files, design necessary. if add the iv , salt stream, e.g. new memorystream(iv).copyto(hmacstream); result contain data. this code far: private static ihmacanddata encryptinternal(byte[] key, byte[] iv, byte[] plaindata, byte[] salt) { byte[] hmachash; byte[] encryptedbytes; using (var aesmanaged = createaesmanaged(iv, key)) { var encryptor = aesmanaged.createencryptor(aesmanaged.key, aesmanaged.iv); var hmacsha512 = new hmacsha512(key); using (var resultstream = new memorystream()) { using (var hmacstream = new cryptostream(resultstream, hmacsha512, cryptostreammode.write)) { using (var aesstream = new cryptostream(hmacstream...

ruby on rails - scrape json from viewsource page -

so i'm trying scrape json exists in website source , use in own site. heres example site: view-source: http://www.viagogo.co.uk/theatre-tickets/musicals/the-lion-king/the-lion-king-london-tickets/e-1545516 if partway down there var eventlistings i code exists in var so far have this: url = "http://www.viagogo.co.uk/theatre-tickets/musicals/the-lion-king/the-lion-king-london-tickets/e-1545516" doc = open(url).read any ideas how can this? thanks the code have far (basically) function using open-uri ruby standard library . standard library module, require 'open-uri' @ top of file in use it. open::uri treats job give contents of file. if comfortable using tools search raw text particular contents looking for, may enough. there few gems, though, assume html , provide special support finding html elements , inspecting contents. this post uses mechanize in turn built on top of nokogiri . easier write working code when using library...

regex - Redirect sitemap.xml to a file in /assets/sitemap/ using htaccess -

if have subdomain, how can redirect it's sitemap.xml file found in /assets/sitemap? subdomain1.example.com/sitemap.xml -> /assets/sitemap/subdomain1.xml subdomain2.example.com/sitemap.xml -> /assets/sitemap/subdomain2.xml i used static code how make dynamic depending on subdomain name? rewriteengine on rewriterule ^sitemap\.xml /assets/sitemap/subdomain1.xml [l] you can use rewritecond , capture subdomain name there: rewriteengine on rewritecond %{http_host} ^(?!www\.)([^.]+) [nc] rewriterule ^sitemap\.xml$ /assets/sitemap/%1.xml [l,nc]

ios - Swift async method and return / completion block -

i'm trying create async method in project takes input parameters. if parameters correct stuff , call completion block. however, if input parameters not correct won't stuff (and completion block won't run , i'd have call myself). anyway, i'm wondering best approach this... i'm thinking have method return status enum includes wrong input , have completion block. the problem there error completion block. maybe should different error type? something this... (using login example). enum loginrequeststatus { case missingemail case missingpassword case requestinglogin } and error completion might be... enum loginerror: error { case nouserfound case invalidpassword case success } then function might this... func login(withemail email: string, password: string, completion: (loginerror?) -> ()) -> loginstatus { if email.isempty() { return loginstatus.missingemail } if password.isempty() { re...

postgresql - Difference between JSON and JSONB in Postgres -

this question has answer here: explanation of jsonb introduced postgresql 6 answers what's difference between json , jsonb data type in posgressql? when should used specific one? what's benefits or disadvantages respect other? this explain: https://www.citusdata.com/blog/2016/07/14/choosing-nosql-hstore-json-jsonb/ in cases jsonb want when looking nosql, schema-less, datatype. hstore , json can have place it’s less common. more broadly, jsonb isn’t fit in every data model. can normalize there benefits, if have schema has large number of optional columns (such event data) or schema differs based on tenant id jsonb can great fit. in general want: jsonb - in cases json - if you’re processing logs, don’t need query, , use more of audit trail hstore - can work fine text based key-value looks, in general jsonb can still work great h...

go - How to get list of objects from sub folder of Amazon S3 bucket using golang? -

how list of objects sub folder of amazon s3 bucket using golang? i tried: svc := s3.new(session.new(), &aws.config{region: aws.string("us-east-1")}) params := &s3.listobjectsinput{ bucket: aws.string("bucket"), } resp, _ := svc.listobjects(params) _, key := range resp.contents { fmt.println(*key.key) } i got list of objects in bucket, need list of objects in subfolder. add prefix parameter in params params := &s3.listobjectsinput { bucket: aws.string("bucket"), prefix: aws.string("root/subfolder"), } will list objects subfolder/