tag:blogger.com,1999:blog-68803245864461935622024-03-05T13:49:49.127+08:00Dora the TechplorerSG female geek shares reviews and tutorials related to Apple gadgets like iPhone, Macbook, IPad as well as other IT technologies like Android and Windows etc.Unknownnoreply@blogger.comBlogger114125tag:blogger.com,1999:blog-6880324586446193562.post-68276337683609148192020-08-01T20:13:00.001+08:002020-08-01T20:13:09.830+08:00Embed JSX code with if condition in React app<div><font face="courier" size="2"> </font></div><div><font face="courier" size="2">renderPrice(pt) {</font></div><div><font face="courier" size="2"> if (pt.amountpaid!="") {</font></div><div><font face="courier" size="2"> let ctrl = (</font></div><div><font face="courier" size="2"> <></font></div><div><font face="courier" size="2"> <div></font></div><div><font face="courier" size="2"> <label>Price</label><br/></font></div><div><font face="courier" size="2"> <input type="text" readOnly name="amountpaid" value={pt.amountpaid} /></font></div><div><font face="courier" size="2"> </div></font></div><div><font face="courier" size="2"> </></font></div><div><font face="courier" size="2"> );</font></div><div><font face="courier" size="2"> return ctrl;</font></div><div><font face="courier" size="2"> } //end if</font></div><div><font face="courier" size="2">} //end renderPrice</font></div><div><br /></div><div><br /></div><div><div style="background-color: #1e1e1e; color: #d4d4d4; font-family: Consolas, "Courier New", monospace; font-size: 14px; line-height: 19px; white-space: pre;"><span style="color: #dcdcaa;">render</span>() {</div></div><div style="background-color: #1e1e1e; color: #d4d4d4; font-family: Consolas, "Courier New", monospace; font-size: 14px; line-height: 19px; white-space: pre;"> <span style="color: #569cd6;">const</span> <span style="color: #4fc1ff;">priceElement</span> = <span style="color: #569cd6;">this</span>.<span style="color: #dcdcaa;">renderPrice</span>(<span style="color: #4fc1ff;">purchasetransaction</span>);</div><div style="background-color: #1e1e1e; color: #d4d4d4; font-family: Consolas, "Courier New", monospace; font-size: 14px; line-height: 19px; white-space: pre;"><div style="line-height: 19px;"><div><span style="color: #c586c0;"> return</span> (</div><div> <span style="color: grey;"><</span><span style="color: #569cd6;">div</span> <span style="color: #9cdcfe;">style</span>=<span style="color: #569cd6;">{</span>{<span style="color: #9cdcfe;">marginTop</span><span style="color: #9cdcfe;">:</span> <span style="color: #ce9178;">'5em'</span>,<span style="color: #9cdcfe;">marginLeft</span><span style="color: #9cdcfe;">:</span><span style="color: #ce9178;">'2em'</span>}<span style="color: #569cd6;">}</span><span style="color: grey;">></span></div><div><div style="line-height: 19px;"><div> </div><div> </div><div> <span style="color: #569cd6;">{</span><span style="color: #4fc1ff;">priceElement</span><span style="color: #569cd6;">}</span></div><br /><div> <span style="color: grey;"><</span><span style="color: #569cd6;">p</span><span style="color: grey;">></</span><span style="color: #569cd6;">p</span><span style="color: grey;">></span></div><div><div style="line-height: 19px;"><div> <span style="color: grey;"></</span><span style="color: #569cd6;">div</span><span style="color: grey;">></span></div><div> )</div><br /><br /><div> } <span style="color: #6a9955;">//end render</span></div></div></div><div><span style="color: grey;"><br /></span></div></div></div><div><span style="color: grey;"><br /></span></div></div></div>Ms Dora Chuahttp://www.blogger.com/profile/03680229013954976976noreply@blogger.com0tag:blogger.com,1999:blog-6880324586446193562.post-80087296510559423842020-07-28T15:23:00.002+08:002020-07-28T15:23:35.884+08:00Reset root password on MySQL on Windows 10 laptopStop SQL Server<div><br /></div><div>Create a text file "mysql-init.txt" in C:\temp directory and paste in this content</div><div><font face="courier">ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';</font><br /><div><br /></div><div>Open a command prompt window and run this command</div><div><span style="background-color: #666666; font-family: verdana; font-size: small;"><font color="#ffffff">mysqld --defaults-file="C:\\ProgramData\\MySQL\\MySQL Server 8.0\\my.ini" --init-file="C:\\temp\\mysql-init.txt"</font></span></div></div>Ms Dora Chuahttp://www.blogger.com/profile/03680229013954976976noreply@blogger.com0tag:blogger.com,1999:blog-6880324586446193562.post-77730266440467120882020-07-28T15:05:00.000+08:002020-07-28T15:05:26.576+08:00Create a SQL table with autoincrement id and timestamps<div>CREATE TABLE `tutorials` (</div><div> `id` int(11) NOT NULL AUTO_INCREMENT,</div><div> `title` varchar(255) DEFAULT NULL,</div><div> `description` varchar(255) DEFAULT NULL,</div><div> `published` tinyint(1) DEFAULT '1',</div><div> `createdAt` timestamp NULL DEFAULT CURRENT_TIMESTAMP,</div><div> `updatedAt` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,</div><div> PRIMARY KEY (`id`)</div><div>) </div>Ms Dora Chuahttp://www.blogger.com/profile/03680229013954976976noreply@blogger.com0tag:blogger.com,1999:blog-6880324586446193562.post-14420917091047884992019-05-26T22:23:00.001+08:002019-05-26T22:23:57.100+08:00AWS Policy editor<a href="https://awspolicygen.s3.amazonaws.com/policygen.html">https://awspolicygen.s3.amazonaws.com/policygen.html</a>Ms Dora Chuahttp://www.blogger.com/profile/03680229013954976976noreply@blogger.com0tag:blogger.com,1999:blog-6880324586446193562.post-86283851890273484032019-05-02T10:33:00.000+08:002019-05-02T10:33:09.410+08:00Download files from Databricks Community EditionSyntax is:<br />
<br />
https://community.cloud.databricks.com/files/myStuffs/yourdata.csv/part-00000?o=<yournumber>Ms Dora Chuahttp://www.blogger.com/profile/03680229013954976976noreply@blogger.com0tag:blogger.com,1999:blog-6880324586446193562.post-37966783158694637462019-04-17T10:44:00.001+08:002019-04-17T12:08:47.692+08:00Run pyspark on Juypter notebook$which python<br />
$whereis python<br />
<br />
# install EPEL repository first<br />
$ sudo yum install epel-release<br />
# install python-pip<br />
$ sudo yum -y install python-pip<br />
<br />
<span style="background-color: white; color: #24292e; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; font-size: 14px;">sudo pip install --upgrade setuptools</span><br />
<span style="background-color: white; color: #24292e; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; font-size: 14px;"><br /></span>
<span style="color: #24292e; font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol;"><span style="font-size: 14px;">wget https://repo.anaconda.com/archive/Anaconda2-5.0.1-Linux-x86_64.sh</span></span><br />
<span style="color: #24292e; font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol;"><span style="background-color: white; font-size: 14px;"></span></span><br />
<span style="color: #24292e; font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol;"><span style="font-size: 14px;">sudo sh Anaconda2-5.0.1-Linux-x86_64.sh</span></span><br />
<br />
1) Install PySpark<br />
pip install pyspark<br />
<br />
2) Install Java<br />
<br />
3) Install Jupyter notebook<br />
pip install jupyter<br />
<br />
4) Install find<br />
pip install findspark<br />
<br />
%env SPARK_HOME=c:\spark<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"># To find out where the pyspark</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;">import findspark</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;">findspark.init()</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"># Creating Spark Context</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;">from pyspark import SparkContext</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;">sc = SparkContext("local", "first app")</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"># Calculating words count</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;">text_file = sc.textFile("OneSentence.txt")</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;">counts = text_file.flatMap(lambda line: line.split(" ")) \</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"> .map(lambda word: (word, 1)) \</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"> .reduceByKey(lambda a, b: a + b)</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"># Printing each word with its respective count</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;">output = counts.collect()</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;">for (word, count) in output:</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"> print("{}: {}".format(word, count))</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"># Stopping Spark Context</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;">sc.stop()</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><br /></span>
<br />
<h3>
Install Python 3.5 on Centos 6</h3>
sudo yum install centos-release-scl<br />
sudo yum info rh-python35<br />
sudo yum install rh-python35<br />
sudo scl enable rh-python35 bash<br />
<br />
<a href="https://www.2daygeek.com/3-methods-to-install-latest-python3-package-on-centos-6-system/">https://www.2daygeek.com/3-methods-to-install-latest-python3-package-on-centos-6-system/</a>Ms Dora Chuahttp://www.blogger.com/profile/03680229013954976976noreply@blogger.com0tag:blogger.com,1999:blog-6880324586446193562.post-20966057989094064992019-04-16T09:46:00.002+08:002019-04-16T09:55:13.438+08:00Useful icons<a href="https://pngtree.com/free-icon/node-other-database-cluster_741016">https://pngtree.com/free-icon/node-other-database-cluster_741016</a><br />
<a href="https://www.clipartmax.com/">https://www.clipartmax.com/</a>Ms Dora Chuahttp://www.blogger.com/profile/03680229013954976976noreply@blogger.com0tag:blogger.com,1999:blog-6880324586446193562.post-29626778303716164042019-04-08T16:26:00.002+08:002019-04-08T16:26:44.883+08:00Set up Cloudera CDH 5.13 todosudo /etc/resolv.conf<br />
<br />
Edit Virtual Box forwarding, add port 22Ms Dora Chuahttp://www.blogger.com/profile/03680229013954976976noreply@blogger.com0tag:blogger.com,1999:blog-6880324586446193562.post-62774012387152635392019-04-08T13:31:00.003+08:002019-04-08T16:25:48.725+08:00Troubleshooting Hive<a href="https://www.cloudera.com/documentation/enterprise/5-14-x/topics/cdh_ig_hiveserver2_start_stop.html"><span style="font-size: xx-small;">https://www.cloudera.com/documentation/enterprise/5-14-x/topics/cdh_ig_hiveserver2_start_stop.html</span></a><br />
<br />
Check if Hive metastore is running<br />
sudo service hive-metastore status<br />
sudo service hive-metastore stop<br />
<div>
sudo service hive-metastore start<br />
sudo service hive-metastore restart</div>
<div>
<br /></div>
<div>
sudo service hive-server2 stop</div>
<div>
<br /></div>
Check if Hive Server2 is running<br />
$ sudo service hive-server2 status<br />
<br />
Start HiveServer2:<br />
$ sudo service hive-server2 start<br />
<br />
To stop HiveServer2:<br />
$ sudo service hive-server2 stop<br />
<br />
Check Hive warehouse<br />
<span style="background-color: white; color: #666666; font-family: , "arial"; font-size: 16px;">hadoop fs -ls /user/hive/warehouse</span><br />
<span style="background-color: white; color: #666666; font-family: , "arial"; font-size: 16px;"><br /></span>
<span style="background-color: white; color: #666666; font-family: , "arial"; font-size: 16px;">Connect using Beeline</span><br />
<span style="background-color: white; color: #666666; font-family: , "arial"; font-size: 16px;"><span lang="EN-US" style="font-family: "Calibri",sans-serif; font-size: 12.0pt; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: TH; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-SG; mso-hansi-theme-font: minor-latin; mso-no-proof: yes;">beeline -u jdbc:hive2://</span></span><br />
<span style="background-color: white; color: #666666; font-family: , "arial"; font-size: 16px;"><span lang="EN-US" style="font-family: "Calibri",sans-serif; font-size: 12.0pt; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: TH; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-SG; mso-hansi-theme-font: minor-latin; mso-no-proof: yes;">!connect -u jdbc:hive2://</span></span>Ms Dora Chuahttp://www.blogger.com/profile/03680229013954976976noreply@blogger.com0tag:blogger.com,1999:blog-6880324586446193562.post-62301934021314766912019-04-03T15:39:00.000+08:002019-04-03T15:39:08.977+08:00Login Hortonworks Sandbox with WinSCPssh root@sandbox-hdp.hortonworks.com -p 2222<br />
<br />
First-time login, use hadoop as password<br />
You will be asked to change password upon first login<br />
<br />
C:\Users\<username>\.sshMs Dora Chuahttp://www.blogger.com/profile/03680229013954976976noreply@blogger.com0tag:blogger.com,1999:blog-6880324586446193562.post-1791647890672262992019-04-03T15:11:00.002+08:002019-04-03T15:11:40.094+08:00kill yum process <span style="font-family: Monaco, Consolas, "Andale Mono", "DejaVu Sans Mono", monospace; font-size: 14px;">yum list</span><br />
ps -ef | grep 13023<br />
kill -9 13023Ms Dora Chuahttp://www.blogger.com/profile/03680229013954976976noreply@blogger.com0tag:blogger.com,1999:blog-6880324586446193562.post-4050436529094646442019-04-02T11:39:00.001+08:002019-04-02T11:43:50.046+08:00Troubleshoot DNS on CDH sudo nano /etc/resolv.conf<br />
<br />
nameserver 8.8.8.8<br />
<br />
<span style="background-color: #f5f7f8; color: #212529; font-family: Inconsolata, monospace; font-size: 14px;"># /etc/init.d/network stop</span><br style="box-sizing: inherit; color: #212529; font-family: Inconsolata, monospace; font-size: 14px;" /><span style="background-color: #f5f7f8; color: #212529; font-family: Inconsolata, monospace; font-size: 14px;"># /etc/init.d/network start</span><br />
<span style="background-color: #f5f7f8; color: #212529; font-family: Inconsolata, monospace; font-size: 14px;"><br /></span>
<span style="background-color: #f5f7f8; color: #212529; font-family: Inconsolata, monospace; font-size: 14px;">sudo systemctl restart network</span><br />
<span style="background-color: #f5f7f8; color: #212529; font-family: Inconsolata, monospace; font-size: 14px;"><br /></span>
<a href="https://www.cyberciti.biz/faq/linux-restart-network-interface/">https://www.cyberciti.biz/faq/linux-restart-network-interface/</a>Ms Dora Chuahttp://www.blogger.com/profile/03680229013954976976noreply@blogger.com0tag:blogger.com,1999:blog-6880324586446193562.post-74281103165923429582019-03-04T14:44:00.002+08:002019-03-04T14:45:12.738+08:00Download zip file using Pythonhttps://www.zerotosingularity.com/blog/downloading-datasets-introducting-pdl/<br />
<br />
<br />
import requests<br />
import zipfile<br />
import os<br />
<br />
# download file<br />
resp = requests.get(f"{url}{file}", allow_redirects=True, stream=True)<br />
<br />
filename = f"{download_dir}{file}"<br />
<br />
zfile = open(filename, 'wb')<br />
zfile.write(resp.content)<br />
zfile.close()<br />
<br />
zipf = zipfile.ZipFile(filename, 'r')<br />
zipf.extractall(download_dir)<br />
zipf.close()<br />
<br />
os.remove(filename)<br />
<br />
<br />
<br />
<pre data-type="programlisting" style="-webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; background-color: rgb(251, 251, 251) !important; border: 0px; box-sizing: border-box; color: #404040; font-family: "Ubuntu Mono", monospace; font-size: 15.104px; font-stretch: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; hyphens: none; line-height: inherit; margin-bottom: 25px; margin-left: 20px; margin-top: 25px; overflow-wrap: break-word; overflow: auto hidden; padding: 0px; vertical-align: baseline; white-space: pre-wrap; word-break: keep-all !important;">YEAR=2015
for MONTH=`seq -w 1 12`; do
PARAMS="UserTableName...
RESPONSE=$(curl -X POST --data "$PARAMS"
http://www.transtats.bts.gov/DownLoad_Table.asp?Table_ID=236&Has_Group=3&Is_
Zipped=0)
echo "Received $RESPONSE"
ZIPFILE=$(echo $RESPONSE | tr '\"' '\n' | grep zip)
echo $ZIPFILE
curl -o $YEAR$MONTH.zip $ZIPFILE
done</pre>
<div>
Is this useful?<br />
https://stackoverflow.com/questions/51665087/python-download-zip-file-from-restapi<br />
<br /></div>
Ms Dora Chuahttp://www.blogger.com/profile/03680229013954976976noreply@blogger.com0tag:blogger.com,1999:blog-6880324586446193562.post-13186878010275318452019-03-01T15:44:00.001+08:002019-03-01T15:44:06.925+08:00Get a book from Gutenberg<pre class="brush: text; plain-text" id="code" style="font-size: 12px; overflow-wrap: break-word; padding: 10px; white-space: pre-wrap;">wget http://www.gutenberg.org/cache/epub/11/pg11.txt</pre>
Ms Dora Chuahttp://www.blogger.com/profile/03680229013954976976noreply@blogger.com0tag:blogger.com,1999:blog-6880324586446193562.post-21109704899364321672019-01-30T14:57:00.002+08:002019-01-30T14:57:42.145+08:00utorial: Using pandas with Large Data Setshttps://www.dataquest.io/blog/pandas-big-data/Ms Dora Chuahttp://www.blogger.com/profile/03680229013954976976noreply@blogger.com0tag:blogger.com,1999:blog-6880324586446193562.post-13457395652053239692019-01-30T14:56:00.000+08:002019-01-30T14:56:50.767+08:00Adjust width of pandas dataframehttps://stackoverflow.com/questions/52369572/python-how-to-get-data-types-for-all-columns-in-csv-file<br />
<br />
<pre class="lang-py prettyprint prettyprinted" style="background-color: #eff0f1; border: 0px; box-sizing: inherit; color: #393318; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; font-size: 13px; font-stretch: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; line-height: inherit; margin-bottom: 1em; max-height: 600px; overflow-wrap: normal; overflow: auto; padding: 5px; vertical-align: baseline; width: auto;"><code style="border: 0px; box-sizing: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline; white-space: inherit;"><span class="pln" style="border: 0px; box-sizing: inherit; color: #303336; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">pd</span><span class="pun" style="border: 0px; box-sizing: inherit; color: #303336; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="pln" style="border: 0px; box-sizing: inherit; color: #303336; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">set_option</span><span class="pun" style="border: 0px; box-sizing: inherit; color: #303336; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">(</span><span class="str" style="border: 0px; box-sizing: inherit; color: #7d2727; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">'max_info_columns'</span><span class="pun" style="border: 0px; box-sizing: inherit; color: #303336; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">,</span><span class="pln" style="border: 0px; box-sizing: inherit; color: #303336; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="lit" style="border: 0px; box-sizing: inherit; color: #7d2727; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">200</span><span class="pun" style="border: 0px; box-sizing: inherit; color: #303336; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">)</span></code></pre>
Ms Dora Chuahttp://www.blogger.com/profile/03680229013954976976noreply@blogger.com0tag:blogger.com,1999:blog-6880324586446193562.post-43218171709359079462019-01-29T20:57:00.003+08:002019-02-15T13:16:57.450+08:00Create a Python 3.6 environment on top of Python 3.7cd d:\<br />
python -m venv D:\mypython36_venv<br />
rem cd d:\mypython36_venv<br />
D:\mypython36_venv\Scripts\activate<br />
D:\mypython36_venv\Scripts\deactivate<br />
<br />
<br />
This one is for Python 2.7 on Raspberry Pi<br />
python -m virtualenv python_venv<br />
cd python_venv<br />
source mypython/bin/activateMs Dora Chuahttp://www.blogger.com/profile/03680229013954976976noreply@blogger.com0tag:blogger.com,1999:blog-6880324586446193562.post-30604050466709241442019-01-24T14:52:00.003+08:002019-01-24T14:52:43.628+08:00Find out where is mysql data directory<pre class="lang-sql prettyprint prettyprinted" style="background-color: #eff0f1; border: 0px; box-sizing: inherit; color: #393318; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; font-size: 13px; font-stretch: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; line-height: inherit; margin-bottom: 1em; max-height: 600px; overflow-wrap: normal; overflow: auto; padding: 5px; vertical-align: baseline; width: auto;"><code style="border: 0px; box-sizing: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline; white-space: inherit;"><span class="str" style="border: 0px; box-sizing: inherit; color: #7d2727; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">'SHOW VARIABLES WHERE Variable_Name LIKE "%dir"</span></code></pre>
<pre class="lang-sql prettyprint prettyprinted" style="background-color: #eff0f1; border: 0px; box-sizing: inherit; color: #393318; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; font-size: 13px; font-stretch: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; line-height: inherit; margin-bottom: 1em; max-height: 600px; overflow-wrap: normal; overflow: auto; padding: 5px; vertical-align: baseline; width: auto;"><code style="border: 0px; box-sizing: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline; white-space: inherit;"><span class="str" style="border: 0px; box-sizing: inherit; color: #7d2727; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">'SHOW VARIABLES WHERE Variable_Name = "datadir"'</span></code></pre>
Ms Dora Chuahttp://www.blogger.com/profile/03680229013954976976noreply@blogger.com0tag:blogger.com,1999:blog-6880324586446193562.post-38914174638069864612019-01-23T17:04:00.002+08:002019-01-23T17:04:45.165+08:00datasetshttps://www.chicago.gov/city/en/depts/dhr/dataset/current_employeenamessalariesandpositiontitles.html<br />
<br />
Sourced from: https://janakiev.com/blog/pandas-groupby/<br />
<br />
<br />Ms Dora Chuahttp://www.blogger.com/profile/03680229013954976976noreply@blogger.com0tag:blogger.com,1999:blog-6880324586446193562.post-90941577999495363382019-01-16T22:31:00.001+08:002019-01-16T22:48:23.056+08:00check if ambari is readyhttps://ambari.apache.org/1.2.0/installing-hadoop-using-ambari/content/ambari-chap2-3.html\<br />
<br />
3. Start the Ambari Server<br />
To start the Ambari Server:<br />
<br />
ambari-server start<br />
To check the Ambari Server processes:<br />
<br />
ps -ef | grep Ambari<br />
To stop the Ambari Server:<br />
<br />
ambari-server stop<br />
<br />
https://cwiki.apache.org/confluence/display/AMBARI/Ambari+Shell<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVyChECX1RcHKSCAP-L3DLBcxkMOAFqtP3gJDgJ3nlebiEoxfQ-bThx9oLmQWRCj-3Jo8i7E83AnMUh6U2ohmsN3S-oy8qVJfdRATD2Ki73mvWMNCNQONqmVHHvYWJcE8MAmgqb1kU_w4/s1600/2019-01-16_224707+ambari+takes+very+long+to+start+services.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="535" data-original-width="1294" height="132" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVyChECX1RcHKSCAP-L3DLBcxkMOAFqtP3gJDgJ3nlebiEoxfQ-bThx9oLmQWRCj-3Jo8i7E83AnMUh6U2ohmsN3S-oy8qVJfdRATD2Ki73mvWMNCNQONqmVHHvYWJcE8MAmgqb1kU_w4/s320/2019-01-16_224707+ambari+takes+very+long+to+start+services.png" width="320" /></a></div>
<br />Ms Dora Chuahttp://www.blogger.com/profile/03680229013954976976noreply@blogger.com0tag:blogger.com,1999:blog-6880324586446193562.post-51770676043310373352019-01-01T22:24:00.002+08:002019-01-01T22:48:30.681+08:00Install mysql on hortonworks sandboxhttps://community.hortonworks.com/questions/78566/where-is-mysql-in-hdp-25.html<br />
<br />
https://community.hortonworks.com/questions/203206/mysql-default-password-first-time-sandbox-login.htmlMs Dora Chuahttp://www.blogger.com/profile/03680229013954976976noreply@blogger.com0tag:blogger.com,1999:blog-6880324586446193562.post-23651027068696567082019-01-01T20:32:00.002+08:002019-01-01T20:32:37.805+08:00Transfer files from Windows laptop to the Hortonworks VMOn Windows laptop, open a new terminal window, navigate to the folder where you have stored your files.<br />
Execute the following commands to transfer the files from your laptop to your Hortonworks VM<br />
<br />
scp -P 2222 * filetotransfer.txt root@sandbox-hdp.hortonworks.com:/tmp/data<br />
<div>
<br /></div>
Ms Dora Chuahttp://www.blogger.com/profile/03680229013954976976noreply@blogger.com0tag:blogger.com,1999:blog-6880324586446193562.post-11993853797865916522019-01-01T14:15:00.001+08:002019-01-01T14:15:13.064+08:00Hortonworks Settings to change<h2>
Minimum replicated blocks %</h2>
Change to zero<br />
<br />
This will prevent HDFS from going into safe mode, which will in turn cause YARN not to run properlyMs Dora Chuahttp://www.blogger.com/profile/03680229013954976976noreply@blogger.com0tag:blogger.com,1999:blog-6880324586446193562.post-4488748531847964892019-01-01T14:08:00.002+08:002019-01-01T14:08:36.258+08:00YARN service starting problem<h2>
Check if HDFS is in safe mode</h2>
hdfs dfsadmin -safemode get<br />
<br />
<h2>
Force HDFS to leave safe mode</h2>
hdfs dfsadmin -safemode leave<br />
<br />
<h2>
HDFS safemode command</h2>
hdfs dfsadmin -safemode [enter | leave | get]Ms Dora Chuahttp://www.blogger.com/profile/03680229013954976976noreply@blogger.com0tag:blogger.com,1999:blog-6880324586446193562.post-13851802129147598722018-12-22T22:55:00.002+08:002018-12-22T22:55:32.465+08:00Install GUI on Debian stretch<pre style="background-color: #f5f6f7; border: 1px solid rgb(210, 211, 215); font-size: 13px; line-height: 2em; margin: 2em 1.5em; outline: 0px; overflow-wrap: break-word; overflow: auto; padding: 1em; vertical-align: baseline;">apt-get install task-gnome-desktop</pre>
Ms Dora Chuahttp://www.blogger.com/profile/03680229013954976976noreply@blogger.com0