Posts

Showing posts from December, 2017

Create App Icons for React Native Android App

Image
First you need one png file as your launcher icon. Then you need to resize this icon file to needed resolutions. There is a simple service to resize your app icon to all needed resolutions with rocket speed . Then you can download all your needed icons. Then replace each ic_launcher.png via image with correct resolution. webrowser/android$ find -name "ic_launcher.png" ./app/src/main/res/mipmap-hdpi/ic_launcher.png ./app/src/main/res/mipmap-mdpi/ic_launcher.png ./app/src/main/res/mipmap-xhdpi/ic_launcher.png ./app/src/main/res/mipmap-xxhdpi/ic_launcher.png Or you can use Image Asset Studio to create App Icons. 1.open Android Studio poject in your react native application. 2.use Image Asset Studio In the Foreground Layer tab, select an Asset Type, and then specify the asset in the field underneath: Select Image to specify the path for an image file. If your app supports Android 8.0, create adaptive and legacy launcher icons. If your app supports versions no

Configure Proxy Settings for CMD.EXE, WinHttp

Image
Microsoft Windows [Version 6.1.7601] Copyright (c) 2009 Microsoft Corporation. All rights reserved. C:\Users\lenger>netsh netsh>winhttp netsh winhttp>set proxy /? Usage: set proxy [proxy-server=] [bypass-list=] Parameters: Tag Value proxy-server - proxy server for use for http and/or https protocol bypass-list - a list of sites that should be visited bypassing the proxy (use " " to bypass all short name hosts) Examples: set proxy myproxy set proxy myproxy:80 " ;bar" set proxy proxy-server="http=myproxy;https=sproxy:88" bypass-list="*.foo.com" netsh winhttp> set HTTP_PROXY=server:port set HTTPS_PROXY=server:port Refer https://technet.microsoft.com/en-us/library/bb430772(v=exchg.141).aspx

install and build your first React Native app on windows

Image
Installing Chocolatey with cmd.exe @"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin" Installing Node, Python2 and JDK with Chocolatey choco install -y nodejs.install python2 jdk8 Install The React Native CLI npm install -g react-native-cli Setup Android Studio Create Virtual Device Create New Application react-native init AwesomeProject Run android Launch your AVD before run-android react-native run-android If every works well, below is your final result: Refer https://facebook.github.io/react-native/docs/getting-started.html https://chocolatey.org/install Troubleshooting page npm proxy set run-android connection timeout unable to load index.android.bundle

Unable to load script from assets index.android.bundle

Image
Solution mkdir android/app/src/main/assets react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res Run react-native run-android Total time: 23.641 secs 'adb' is not recognized as an internal or external command, operable program or batch file. Starting the app (C:\Users\lenger\AppData\Local\Android\Sdk/platform-tools/adb shell am start -n com.webrowser/com.webrowser.MainActivity... Starting: Intent { cmp=com.webrowser/.MainActivity }

react-native run-android : Connection timed out

Error Log Downloading https://services.gradle.org/distributions/gradle-2.14.1-all.zip Exception in thread "main" java.net.ConnectException: Connection timed out: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source) at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source) at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source) at java.net.AbstractPlainSocketImpl.connect(Unknown Source) at java.net.PlainSocketImpl.connect(Unknown Source) at java.net.SocksSocketImpl.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at sun.security.ssl.SSLSocketImpl.connect(Unknown Source) at sun.security.ssl.BaseSSLSocketImpl.connect(Unknown Source) at sun.net.NetworkClient.doConnect(Unknown Source) at sun.net.www.http.HttpClient.openServer(Unknown Source) at sun.net.www.http.HttpClient.openServer(Unknown Source) at sun.net.www.protocol.https.HttpsClient. (Unknown

npm config http/https proxy

npm --proxy http://username:password@server :port install packagename npm config set proxy http://username:password@server :port npm config set https-proxy http://username:password@server :port   npm config set strict-ssl false npm config set registry " http://registry.npmjs.org/ " npm config rm proxy npm config rm https-proxy

show hospitality to strangers

Image
你们务要常存弟兄相爱的心。 (希伯来书 13:1 和合本) Keep on loving one another as brothers and sisters. (Hebrews 13:1 NIV) 不可忘记用爱心接待客旅;因为曾有接待客旅的,不知不觉就接待了天使。 (希伯来书 13:2 和合本) Do not forget to show hospitality to strangers, for by so doing some people have shown hospitality to angels without knowing it. (Hebrews 13:2 NIV) 你们要记念被捆绑的人,好像与他们同受捆绑;也要记念遭苦害的人,想到自己也在肉身之内。 (希伯来书 13:3 和合本) Continue to remember those in prison as if you were together with them in prison, and those who are mistreated as if you yourselves were suffering. (Hebrews 13:3 NIV) Photo by Diego PH / Unsplash

Trust in the Lord

Image
天怎样高过地,照样,我的道路高过你们的道路;我的意念高过你们的意念。 (以赛亚书 55:9 和合本) "As the heavens are higher than the earth, so are my ways higher than your ways and my thoughts than your thoughts. (Isaiah 55:9 NIV) 你要专心仰赖耶和华,不可倚靠自己的聪明, (箴言 3:5 和合本) Trust in the Lord with all your heart and lean not on your own understanding; (Proverbs 3:5 NIV) 在你一切所行的事上都要认定他,他必指引你的路。 (箴言 3:6 和合本) in all your ways submit to him, and he will make your paths straight. (Proverbs 3:6 NIV) Photo by Federico Respini / Unsplash

微信开放平台 创建移动应用 Android 应用签名

Image
keystore file decide it. In fact, it is MD5 value of the keystore file. please refer https://errong.win/generate-keystore/ to generate the keystore file. You can get the MD5 via keytool -list -v -keystore webrowser.keystore MD5: 4F:87:B6:11:A4:37:5A:29:E4:A2:F7:BD:2B:DC:CC:18 Remove all ":" and turn the string to lower case. Application signature is : 4f87b611a4375a29e4a2f7bd2bdccc18

Generate keystore file to sign your android apk

Tool keytool You can get this tool after you installed jdk . Command C:\Program Files\Java\jdk1.8.0_121\bin>keytool.exe -genkey -alias "webrowser" -keyalg "RSA" -validity 10000 -keystore "webrowser.keystore" Enter keystore password: Re-enter new password: What is your first and last name? [Unknown]: Errong What is the name of your organizational unit? [Unknown]: Errong What is the name of your organization? [Unknown]: Errong What is the name of your City or Locality? [Unknown]: Nanjing What is the name of your State or Province? [Unknown]: JiangSu What is the two-letter country code for this unit? [Unknown]: CN Is CN=Errong, OU=Errong, O=Errong, L=Nanjing, ST=JiangSu, C=CN correct? [no]: What is your first and last name? [Errong]: What is the name of your organizational unit? [Errong]: What is the name of your organization? [Errong]: What is the name of your City or Locality? [Nanjing]: What is the name of your State

We Browser

light web browser, heave social share

Godliness Training

Image
"操练身体,益处还少;惟独敬虔,凡事都有益处,因有今生和来生的应许。" (提摩太前书 4:8 和合本) For physical training is of some value, but godliness has value for all things, holding promise for both the present life and the life to come. (1 Timothy 4:8 NIV) Photo by Ines Álvarez Fdez / Unsplash

wrong LC_NUMBERIC cause CSS unsupported value

warning: unsupported value position: absolute; width: 12.9em; transform: translateX(16.27em); ^ and you know, some countries uses decimal point as comma - not point. so scanf function cannot read "12.9em" if we set NUMERIC at that country. Such as French.   // query LC_NUMERIC  char* locale = setlocale(LC_NUMERIC, NULL);  // set LC_NUMERIC  char* locale = "en_US.utf8";  setlocale(LC_NUMERIC, locale);    if LC_NUMERIC was set to "frCA.UTF-8" , 12.9em can't be read as a Decimal. The correct should be like "en_US.utf8" Refer: https://en.wikipedia.org/wiki/Decimal_mark http://man7.org/linux/man-pages/man3/setlocale.3.html

故意犯罪 真是可怕的

Image
If we deliberately keep on sinning after we have received the knowledge of the truth, no sacrifice for sins is left, (Hebrews 10:26 NIV) 惟有战惧等候审判和那烧灭众敌人的烈火。 (希伯来书 10:27 和合本) but only a fearful expectation of judgment and of raging fire that will consume the enemies of God. (Hebrews 10:27 NIV) 人干犯摩西的律法,凭两三个见证人,尚且不得怜恤而死, (希伯来书 10:28 和合本) Anyone who rejected the law of Moses died without mercy on the testimony of two or three witnesses. (Hebrews 10:28 NIV) 何况人践踏 神的儿子,将那使他成圣之约的血当作平常,又亵慢施恩的圣灵,你们想,他要受的刑罚该怎样加重呢! (希伯来书 10:29 和合本) How much more severely do you think someone deserves to be punished who has trampled the Son of God underfoot, who has treated as an unholy thing the blood of the covenant that sanctified them, and who has insulted the Spirit of grace? (Hebrews 10:29 NIV) 因为我们知道谁说:"伸冤在我,我必报应";又说:"主要审判他的百姓。" (希伯来书 10:30 和合本) For we know him who said, "It is mine to avenge; I will repay," and again, "The Lord will judge his people."

主啊!你在我生命的旨意是什么?

Image
人一生虚度的日子,就如影儿经过,谁知道什么与他有益呢?谁能告诉他身后在日光之下有什么事呢? (传道书 6:12 和合本) For who knows what is good for a person in life, during the few and meaningless days they pass through like a shadow? Who can tell them what will happen under the sun after they are gone? (Ecclesiastes 6:12 NIV) Photo by Jonatan Pie / Unsplash

Let gdb ignore SIGPIPE signal

(gdb) handle SIGPIPE nostop noprint

auto learn account

Image
会计人员继续教育网上培训 只需要登录你的账号。 所有的课程将会自动开始学习 无需你再理会 只要开着浏览器即可。 自动勾选学习过程中弹出的问题,学习过程不会再被卡住。 https://www.youtube.com/watch?v=V9zXnnQQRUE&feature=youtu.be FireFox Plugin: https://addons.mozilla.org/en-US/firefox/addon/auto-learn-account/

HOW ARE YOUR EYES?

Image
耶稣过去的时候,看见一个人生来是瞎眼的。 (约翰福音 9:1 和合本) As he went along, he saw a man blind from birth. (John 9:1 NIV) 门徒问耶稣说:"拉比,这人生来是瞎眼的,是谁犯了罪?是这人呢?是他父母呢?" (约翰福音 9:2 和合本) His disciples asked him, "Rabbi, who sinned, this man or his parents, that he was born blind?" (John 9:2 NIV) 耶稣回答说:"也不是这人犯了罪,也不是他父母犯了罪,是要在他身上显出 神的作为来。 (约翰福音 9:3 和合本) "Neither this man nor his parents sinned,"said Jesus, "but this happened so that the works of God might be displayed in him. (John 9:3 NIV) 趁着白日,我们必须做那差我来者的工;黑夜将到,就没有人能做工了。 (约翰福音 9:4 和合本) As long as it is day, we must do the works of him who sent me. Night is coming, when no one can work. (John 9:4 NIV) 我在世上的时候,是世上的光。" (约翰福音 9:5 和合本) While I am in the world, I am the light of the world." (John 9:5 NIV) 耶稣说了这话,就吐唾沫在地上,用唾沫和泥抹在瞎子的眼睛上, (约翰福音 9:6 和合本) After saying this, he spit on the ground, made some mud with the saliva, and put it on the man's eyes. (John 9:6 NIV) 对他说:"你往西罗亚池子里去洗。"(西罗亚翻出来就

CHRIST’S INVITATION

Image
节期的末日,就是最大之日,耶稣站着高声说:"人若渴了,可以到我这里来喝。 (约翰福音 7:37 和合本) On the last and greatest day of the festival, Jesus stood and said in a loud voice, "Let anyone who is thirsty come to me and drink. (John 7:37 NIV) 信我的人就如经上所说:'从他腹中要流出活水的江河来。'" (约翰福音 7:38 和合本) Whoever believes in me, as Scripture has said, rivers of living water will flow from within them." (John 7:38 NIV) Photo by Michael Bomke / Unsplash

PETER’S CONFESSION

Image
耶稣到了凯撒利亚·腓立比的境内,就问门徒说:"人说我(有古卷没有我字) —人子是谁?" (马太福音 16:13 和合本) When Jesus came to the region of Caesarea Philippi, he asked his disciples, "Who do people say the Son of Man is?" (Matthew 16:13 NIV) 他们说:"有人说是施洗的约翰;有人说是以利亚;又有人说是耶利米或是先知里的一位。" (马太福音 16:14 和合本) They replied, "Some say John the Baptist; others say Elijah; and still others, Jeremiah or one of the prophets." (Matthew 16:14 NIV) 耶稣说:"你们说我是谁?" (马太福音 16:15 和合本) "But what about you?"he asked. "Who do you say I am?" (Matthew 16:15 NIV) 西门·彼得回答说:"你是基督,是永生 神的儿子。" (马太福音 16:16 和合本) Simon Peter answered, "You are the Messiah, the Son of the living God." (Matthew 16:16 NIV) 耶稣对他说:"西门·巴·约拿,你是有福的!因为这不是属血肉的指示你的,乃是我在天上的父指示的。 (马太福音 16:17 和合本) Jesus replied, "Blessed are you, Simon son of Jonah, for this was not revealed to you by flesh and blood, but by my Father in heaven. (Matthew 16:17 NIV) 我还告诉你,你是彼得,我要把我的教会建造在这磐石上;阴间的权柄(权柄:原

KVM folder share, networking, host and guest IP

Image
Create Virtual Machine via KVM Host IP of KVM, run ifconfig on host ~$ ifconfig virbr0 Link encap:Ethernet HWaddr fe:54:00:ad:73:64 inet addr:192.168.122.1 Bcast:192.168.122.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:588122 errors:0 dropped:0 overruns:0 frame:0 TX packets:749737 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:31412184 (31.4 MB) TX bytes:1267281456 (1.2 GB) Guest IP, run ifconfig on created virtual machine. ~$ ifconfig eth0 Link encap:Ethernet HWaddr 52:54:00:ad:73:64 inet addr:192.168.122.112 Bcast:192.168.122.255 Mask:255.255.255.0 inet6 addr: fe80::5054:ff:fead:7364/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:415799 errors:0 dropped:3 overruns:0 frame:0 TX packets:252791 errors:0 dropped:0 overruns:0 carrier:0 collisio

Install KVM and Create Virtual Machines on Ubuntu

Image
Refer to: https://www.howtogeek.com/117635/how-to-install-kvm-and-create-virtual-machines-on-ubuntu/ Summary: Determine whether your CPU support hardware virtualization egrep -c '(svm|vmx)' /proc/cpuinfo A 0 indicates that your CPU doesn't support hardware virtualization, while a 1 or more indicates that it does. You still have to enable hardware virtualization support in your computer's BIOS, even if this command returns a 1 or more. Otherwise you will get a warning later on: KVM is not available. This may mean the KVM package is not installed,  or the KVM kernel modules are not loaded.  Your virtual machines may perform poorly. Install KVM sudo apt-get install qemu-kvm libvirt-bin bridge-utils virt-manager Add user to libvirtd group sudo adduser name libvirtd Create Virtual Machines via virt-manager virt-manager Click the Create New Virtual Machine button on the toolbar and the Virtual Machine Manager will walk you through selecting an installati

The Lord has done great things

当耶和华将那些被掳的带回锡安的时候,我们好像做梦的人。 (诗篇 126:1 和合本) When the Lord restored the fortunes of Zion, we were like those who dreamed. (Psalms 126:1 NIV) 我们满口喜笑、满舌欢呼的时候,外邦中就有人说:耶和华为他们行了大事! (诗篇 126:2 和合本) Our mouths were filled with laughter, our tongues with songs of joy. Then it was said among the nations, "The Lord has done great things for them." (Psalms 126:2 NIV) 耶和华果然为我们行了大事,我们就欢喜。 (诗篇 126:3 和合本) The Lord has done great things for us, and we are filled with joy. (Psalms 126:3 NIV) 耶和华啊,求你使我们被掳的人归回,好像南地的河水复流。 (诗篇 126:4 和合本) Restore our fortunes, Lord , like streams in the Negev. (Psalms 126:4 NIV) 流泪撒种的,必欢呼收割! (诗篇 126:5 和合本) Those who sow with tears will reap with songs of joy. (Psalms 126:5 NIV) 那带种流泪出去的,必要欢欢乐乐地带禾捆回来! (诗篇 126:6 和合本) Those who go out weeping, carrying seed to sow, will return with songs of joy, carrying sheaves with them. (Psalms 126:6 NIV)

Where are you?

Image
于是女人见那棵树的果子好作食物,也悦人的眼目,且是可喜爱的,能使人有智慧,就摘下果子来吃了,又给她丈夫,她丈夫也吃了。 (创世记 3:6 和合本) When the woman saw that the fruit of the tree was good for food and pleasing to the eye, and also desirable for gaining wisdom, she took some and ate it. She also gave some to her husband, who was with her, and he ate it. (Genesis 3:6 NIV) 他们二人的眼睛就明亮了,才知道自己是赤身露体,便拿无花果树的叶子为自己编做裙子。 (创世记 3:7 和合本) Then the eyes of both of them were opened, and they realized they were naked; so they sewed fig leaves together and made coverings for themselves. (Genesis 3:7 NIV) 天起了凉风,耶和华 神在园中行走。那人和他妻子听见 神的声音,就藏在园里的树木中,躲避耶和华 神的面。 (创世记 3:8 和合本) Then the man and his wife heard the sound of the Lord God as he was walking in the garden in the cool of the day, and they hid from the Lord God among the trees of the garden. (Genesis 3:8 NIV) 耶和华 神呼唤那人,对他说:"你在哪里?" (创世记 3:9 和合本) But the Lord God called to the man, "Where are you?" (Genesis 3:9 NIV) Photo by chuttersnap / Unsplash

Can pthread_mutex_lock still work after pthread mutex_destroy ?

Refer: https://linux.die.net/man/3/pthread_mutex_init The pthread_mutex_destroy() function shall destroy the mutex object referenced by mutex; the mutex object becomes, in effect, uninitialized. An implementation may cause pthread_mutex_destroy() to set the object referenced by mutex to an invalid value. A destroyed mutex object can be reinitialized using pthread_mutex_init(); the results of otherwise referencing the object after it has been destroyed are undefined. What is the undefined behavior ? Let's us wirte sample codes to verify it. #include <pthread.h> #include <iostream> #include <unistd.h> using namespace std; static pthread_mutex_t foo_mutex; static void * thread1(void *arg) { while(1) { pthread_mutex_lock(&foo_mutex); cout << "thread 1 running" << endl; sleep(2); } } static void * thread2(void *arg) { while(1) { pthread_mutex_lock(&foo_mutex); cout << "thread