How do I make one child of a dom structure rise to the top of the DOM in React Native

reactjs
Question: I am working on a react native project where I have a being returned by an array with transforms being applied to the container view (making everything inside rotate, as seen below). However, I am aiming to have many of these elements and sometimes the tail end of the container view overlaps the toucharea and stops me from accessing its panhandlers. How do I make the toucharea float to the top of the stack so that it is always the first item selected when I touch it? Code: output.push( {/* Container for an entire button */} {/* First Cursor Image */} {/* First Touch Area */} {/* Container for an entire button */} {/* Second Cursor image */} {/* Second Touch Area */} this.currentLine = k} lineID={k} style={[ styles.cursorImageTouchArea,…
Read More

Error in ReactJS setup in Ubuntu 16.04

Uncategorized
Question: I tried to follow https://www.tutorialspoint.com/reactjs/reactjs_environment_setup.htm inorder to setup reactJS in my device which has Ubuntu 16.04. In the end i tried npm start but it results me following error > reactjs@1.0.0 start /var/www/html/reactjs > webpack-dev-server --hot Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema. - configuration.output.path: The provided value "./" is not an absolute path! npm ERR! Linux 4.10.0-28-generic npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "start" npm ERR! node v4.2.6 npm ERR! npm v3.5.2 npm ERR! code ELIFECYCLE npm ERR! reactjs@1.0.0 start: `webpack-dev-server --hot` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the reactjs@1.0.0 start script 'webpack-dev-server --hot'. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do,…
Read More

Java streams stored on ram or harddisk

Uncategorized
Question: HI I will get a download link to s3 file, i have to upload that to another account s3 bucket, it seems amazon not providing anything to to this from their end. so what previously coded in application is they are downloading the complete file to bytearrayoutputstream and uploading that to s3, what i know is bytearrayoutputstream will allocate memory on ram and file size can be 6-10gb, so changed that to save to temp file in java and deleting that once uploaded, but my manager saying bytearrayoutputstream won't store on ram and not an issue and asked me to revert , which approach is correct and where do streams store data until you save it to a file on hard disk , i think it's ram only right…
Read More

Download file with extension pdf and ms10 inside android webView

Uncategorized
Question: I'm trying to download pdf and ms10 extension file inside webView with the below code but it only shows "Downloading" and nothing happens. Should am I missing to add any extra intent in manifest file or any other thing I'm doing wrong? webView.setDownloadListener(new DownloadListener() { @Override public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) { DownloadManager.Request request = new DownloadManager.Request( Uri.parse(url)); request.allowScanningByMediaScanner(); request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED); //Notify client once download is completed! request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, "Name of your downloadble file goes here, example: Mathematics II "); DownloadManager dm = (DownloadManager) getSystemService(DOWNLOAD_SERVICE); dm.enqueue(request); Toast.makeText(getApplicationContext(), "Downloading File", //To notify the Client that the file is being downloaded Toast.LENGTH_LONG).show(); } }); Here is my android manifest.xml file: Any help would be much much appreciated. Answer: Useful library you can try it. Andvanced-Webview and…
Read More

pt-online-schema-change boosts so many copy threads?

mysql
Question: The other day, I use pt-online-schema-change to add a column and index to a table, the table is about 1 million rows and the .ibd file size is about 5G Bytes. I tried several times each time i got an error says the process is aborted duo to the critical load is reached (which is threads_running=60, i always use this and never failed before) I found something strange using show full process list: there are so many copy threads there like:REPLACE INTO `db`.`_some_table_new` ... running for a long time (tens and hundreds of seconds) and in a status of 'update'. As I know the pt-online-schema-change use only one copy threads and I use this tool many times and each time I can only observe one thread chunking and copying…
Read More

How to get type of object's attribute in python

Uncategorized
Question: assume I have the following class:class myClass():def __init__(self, number):self.myStr = "bla" self.myInt = number * 3 how do I get the the attributes types? I mean I want to get the following list: ['str','int']? I also want it to work on derived classes. Thanks a lot :) Answer: Use the type() function. You can even use it to print out the variable type like this:print(type(variable_name)) Read more
Read More

Filtering into specific class in BeautifulSoup

Uncategorized
Question: I was doing something like this using BeautifulSoup:for name in soup.find_all('div','name'): When I am using this filter, my understanding is that I will get all the div tags with the attribute or class name name. However, I don't want every instance of the div tag with the attribute name. I want certain instances in which they locate in a certain subtree of the HTML file. More specifically, instances within the tag ..., which is two levels above the tags I am looking for. So my question is, how would I write the filter in soup.find_all() to zoom into a class? I apologize in advance if I had mixed up any terminology. This is my first time attempting web scraping. I was not sure what to look at within the…
Read More

c encrypt decrypt not working as expected

Uncategorized
Question: I am trying to implement encode and decode of string based on this page http://www.thecrazyprogrammer.com/2016/11/caesar-cipher-c-c-encryption-decryption.html And here is the code, string encryptString(string message){ int i, key=95828205; char ch; for(i = 0; message[i] != ''; ++i){ ch = message[i]; if(ch >= 'a' && ch 'z'){ ch = ch - 'z' + 'a' - 1; } message[i] = ch; } else if(ch >= 'A' && ch 'Z'){ ch = ch - 'Z' + 'A' - 1; } message[i] = ch; } } printf("Encrypted message: %s", message); return message; } string decryptString(string message){ int i, key=95828205; char ch; for(i = 0; message[i] != ''; ++i){ ch = message[i]; if(ch >= 'a' && ch = 'A' && ch = 'a' && ch = 'a' && ch
Read More

How to store an event is happening from 2017-08-20 to 2017-08-24? What data type?

sql
Question: Say an event is happening from 2017-08-20 to 2017-08-24. I've actually seen most APIs store and return this like:date_start: date date_end: date However it might just be the case that these APIs are using MongoDB or some other NoSQL without types. Should I be doing the above or using the data types interval (not sure of an example of what it's for) or daterange (seems likely) instead? Answer: Range Types might be the best - either daterange, tsrange or tstzrange 8.17.1. Built-in Range Types PostgreSQL comes with the following built-in range types: int4range — Range of integer int8range — Range of bigint numrange — Range of numeric tsrange — Range of timestamp without time zone tstzrange — Range of timestamp with time zone daterange — Range of date GiST…
Read More

SFSafariController loads URL fine in simulator but leaves a blank screen on device

Uncategorized
Question: So I'm using SFSafariController to load up an URL downloaded from cloudkit, like so. if let yelpurl = detail.value(forKey: "Yelp") as? String { let url = URL(string: (yelpurl)) let safari = SFSafariViewController(url: url!, entersReaderIfAvailable: false) safari.delegate = self as? SFSafariViewControllerDelegate self.present(safari, animated: true, completion: { }) } else { } } The code itself is fine - no errors, pulls up the yelp page URL and loads it up in an SFSafariController in simulator, but on my device, I am left with a white blank screen. What is causing this disparity and how can I correct this on device? To add, the plist still stands without any modification. Answer: Read more
Read More