How to parse a api for swift 3?

Uncategorized
Question: Have been researching on the parsing for quite a bit. With plethora of information avilable for JSON nothing seems to explain how to do in a sensible way to extract information with swift 3. This is what got so far func getBookDetails() { let scriptUrl = "https://www.googleapis.com/books/v1/volumes?q=isbn:9781451648546" . let myurl = URL(string:scriptUrl) let request = NSMutableURLRequest(url: myurl!) request.httpMethod = "GET" let task = URLSession.shared.dataTask(with: myurl! ) { (data, response, error) in if error != nil{ print("THIS ERROR",error!) return } else{ if let mydata = data{ do{ let myJson = try (JSONSerialization.jsonObject(with: mydata, options: JSONSerialization.ReadingOptions.mutableContainers)) as AnyObject // print("this is the MY JSON",myJson) ---> prints out the json if let dictonary = myJson["items"] as AnyObject? { print("the DICTONARY",dictonary) // ----> OUTPUT if let dictonaryAA = dictonary["accessInfo"] as AnyObject? { print("the…
Read More

Solr search engine need to restart after adding docs

Uncategorized
Question: I am working with solr 6.6.0 using solr PHP client. I am adding the docs using below code and it is working properly :foreach ($data as $key => $value) { $docs['doc_no'.$i]['id'] = $value['id']; $docs['doc_no'.$i]['name'] = $value['name']; $docs['doc_no'.$i]['sub_title'] = strip_tags($value['sub_title']); $docs['doc_no'.$i]['small_image'] = $value['small_image']; $docs['doc_no'.$i]['project_type'] = $value['project_type']; $docs['doc_no'.$i]['project_status'] = $value['project_status']; $docs['doc_no'.$i]['logo'] = $value['logo']; $docs['doc_no'.$i]['price'] = $value['price']; $docs['doc_no'.$i]['url'] = $value['url']; $docs['doc_no'.$i]['flat_type_desc'] = $value['flat_type_desc']; $docs['doc_no'.$i]['project_config'] = $value['project_config']; $docs['doc_no'.$i]['address'] = $value['address']; $docs['doc_no'.$i]['location'] = $value['location']; $i++; } //print_r($docs);exit; $documents = array(); foreach($docs as $item => $fields) { $part = new Apache_Solr_Document(); foreach ( $fields as $key => $value ) { if ( is_array( $value ) ) { foreach ( $value as $data ) { $part->setMultiValue( $key, $data ); } } else{ $part->$key = $value; } } $documents[] = $part; } try { $solr->addDocuments( $documents );…
Read More

Difference between media queries and javascript resize event

Uncategorized
Question: What is the difference between media queries and the javascript resize event. Both of them looks quite similar. Which pros and cons have media queries, and which the resize event? Answer: Media query is a CSS technique introduced in CSS3. It uses the @media rule to include a block of CSS properties only if a >certain condition is true. https://www.w3schools.com/css/css_rwd_mediaqueries.asp Read more
Read More

Why this c rabin implementation does not generate blocks more than 64KB?

Uncategorized
Question: I got the following Rabin fingerprint implementation from GitHub. It works fine with lower size BLOCK configurations. For example it produces desired result when the block sizes are set as 2KB,4KB,16KB for MIN,AVG and MAX respectively. I want it to work for 256KB, 1MB, 2MB min, avg, max configuration. But it does not produce any md5 digests beyond the first block when it is set so. Plus the maximum block size that it has processed so far is 64KB. Please help!! rabin_polynomial_constants.h #ifndef RAB_MAX_BLOCK_SIZE #define RAB_MAX_BLOCK_SIZE 1024*1024//1MB #endif #ifndef RAB_MIN_BLOCK_SIZE #define RAB_MIN_BLOCK_SIZE 1024*32//32KB #endif #ifndef RAB_POLYNOMIAL_REM #define RAB_POLYNOMIAL_REM 3 #endif #ifndef RAB_POLYNOMIAL_AVG_BLOCK_SIZE #define RAB_POLYNOMIAL_AVG_BLOCK_SIZE 1024*128//128KB #endif #ifndef RAB_POLYNOMIAL_WIN_SIZE #define RAB_POLYNOMIAL_WIN_SIZE 48 #endif #ifndef RAB_POLYNOMIAL_MIN_WIN_SIZE #define RAB_POLYNOMIAL_MIN_WIN_SIZE 31 #endif #ifndef RAB_POLYNOMIAL_MAX_WIN_SIZE #define RAB_POLYNOMIAL_MAX_WIN_SIZE 63 #endif //# of bytes to read…
Read More

how to increase navbar size for mobile phone?

Uncategorized
Question: I have done coding in Bootstrap 3.6.When i open navbar for small devices all works perfectly but i given logo and name of website on navbar,in small screen website name going outside to navbar. Please fine below Code Webmap Cities Urban Growth in Mumbai Metropolitan Area 1975-2014 Mumbai Delhi Bengaluru Also check this link to know output: http://www.responsinator.com/?url=http%3A%2F%2F176.9.117.220%3A8282%2Ftrail_menu_8_8_2017%2520-%2520Copy.html Thanks. Answer: Read more
Read More