# Issue
>> >> at BunserBuf.<anonymous> (/home/errong_leng/Ghost/core/client/node_modules/fb-watchman/index.js:95:23)
>> at emitOne (events.js:116:13)
>> at BunserBuf.emit (events.js:211:7)
>> at BunserBuf.process (/home/errong_leng/Ghost/core/client/node_modules/bser/index.js:292:10)
>> at /home/errong_leng/Ghost/core/client/node_modules/bser/index.js:247:12
>> at _combinedTickCallback (internal/process/next_tick.js:131:7)
>> at process._tickCallback (internal/process/next_tick.js:180:9)
>> A non-recoverable condition has triggered. Watchman needs your help!
>> The triggering condition was at timestamp=1509698956: inotify-add-watch(/home/errong_leng/Ghost/core/client/node_modules/ember-cli-node-assets/node_modules/broccoli-funnel/node_modules/.bin) -> The user limit on the total number of inotify watches was reached; increase the fs.inotify.max_user_watches sysctl
>> All requests will continue to fail with this message until you resolve
>> the underlying problem. You will find more information on fixing this at
>> https://facebook.github.io/watchman/docs/troubleshooting.html#poison-inotify-add-watch
>> Error: A non-recoverable condition has triggered. Watchman needs your help!
>> The triggering condition was at timestamp=1509698956: inotify-add-watch(/home/errong_leng/Ghost/core/client/node_modules/ember-cli-node-assets/node_modules/broccoli-funnel/node_modules/.bin) -> The user limit on the total number of inotify watches was reached; increase the fs.inotify.max_user_watches sysctl
>> All requests will continue to fail with this message until you resolve
>> the underlying problem. You will find more information on fixing this at
>> https://facebook.github.io/watchman/docs/troubleshooting.html#poison-inotify-add-watch
>>
# Solution
sudo su -
echo 8192000 > /proc/sys/fs/inotify/max_user_watches
be entrusted with the gospel
For the appeal we make does not spring from error or impure motives, nor are we trying to trick you. (1 Thessalonians 2:3 NIV)
我们的劝勉不是出于错误,不是出于污秽,也不是用诡诈。 (帖撒罗尼迦前书 2:3 和合本)
On the contrary, we speak as those approved by God to be entrusted with the gospel. We are not trying to please people but God, who tests our hearts. (1 Thessalonians 2:4 NIV)
但 神既然验中了我们,把福音托付我们,我们就照样讲,不是要讨人喜欢,乃是要讨那察验我们心的 神喜欢。 (帖撒罗尼迦前书 2:4 和合本)
我们的劝勉不是出于错误,不是出于污秽,也不是用诡诈。 (帖撒罗尼迦前书 2:3 和合本)
On the contrary, we speak as those approved by God to be entrusted with the gospel. We are not trying to please people but God, who tests our hearts. (1 Thessalonians 2:4 NIV)
但 神既然验中了我们,把福音托付我们,我们就照样讲,不是要讨人喜欢,乃是要讨那察验我们心的 神喜欢。 (帖撒罗尼迦前书 2:4 和合本)
knapsack problem
knapsack problem
Question:
give two integer n and m, select rand numbers from 1,2,3,...,n-1, n,
let the sum of the combination is equal to m.
print out all possible combinations.
Examples:
n = 8 m = 10
8 2
7 3
7 2 1
6 4
6 3 1
5 4 1
5 3 2
4 3 2 1
Answer:
#include <iostream>
#include <vector>
using namespace std;
void printNumbersWithSum(int n, int m, vector<int>& numbers) {
if (m <= 0 || n <= 0)
return;
if (m == n) {
for (int number : numbers)
cout << number << " ";
cout << n << endl;
}
numbers.push_back(n);
printNumbersWithSum(n-1, m - n, numbers);
numbers.pop_back();
printNumbersWithSum(n-1, m, numbers);
}
int main() {
vector<int> numbers;
int n, m;
cin >> n >> m;
printNumbersWithSum(n, m, numbers);
return 0;
}
Question:
give two integer n and m, select rand numbers from 1,2,3,...,n-1, n,
let the sum of the combination is equal to m.
print out all possible combinations.
Examples:
n = 8 m = 10
8 2
7 3
7 2 1
6 4
6 3 1
5 4 1
5 3 2
4 3 2 1
Answer:
#include <iostream>
#include <vector>
using namespace std;
void printNumbersWithSum(int n, int m, vector<int>& numbers) {
if (m <= 0 || n <= 0)
return;
if (m == n) {
for (int number : numbers)
cout << number << " ";
cout << n << endl;
}
numbers.push_back(n);
printNumbersWithSum(n-1, m - n, numbers);
numbers.pop_back();
printNumbersWithSum(n-1, m, numbers);
}
int main() {
vector<int> numbers;
int n, m;
cin >> n >> m;
printNumbersWithSum(n, m, numbers);
return 0;
}
Set up Ghost with Mailgun on Google Conputer Engine
First please refer to :
https://docs.ghost.org/v1.0.0/docs/mail-config
As you may know, Google Cloud Platform doesn't allow outbound connection to ports 25, 465 and 587.
https://cloud.google.com/compute/docs/tutorials/sending-mail/
So you just change port of MailGun to other port such as 2525, it will work.
"mail": {
"transport": "SMTP",
"options": {
"service": "Mailgun",
"port": 2525,
"auth": {
"user": "yourname",
"pass": "yourpasswd"
}
}
},
When you have finished making changes to you config file don't forget to restart Ghost. ( ghost stop ghost start )
https://docs.ghost.org/v1.0.0/docs/mail-config
As you may know, Google Cloud Platform doesn't allow outbound connection to ports 25, 465 and 587.
https://cloud.google.com/compute/docs/tutorials/sending-mail/
So you just change port of MailGun to other port such as 2525, it will work.
"mail": {
"transport": "SMTP",
"options": {
"service": "Mailgun",
"port": 2525,
"auth": {
"user": "yourname",
"pass": "yourpasswd"
}
}
},
When you have finished making changes to you config file don't forget to restart Ghost. ( ghost stop ghost start )
Very Good, 甚好
God saw all that he had made, and it was very good. And there was
evening, and there was morning—the sixth day. (Genesis 1:31 NIV)
神看着一切所造的都甚好。有晚上,有早晨,是第六日。 (创世记 1:31 和合本)
神看着一切所造的都甚好。有晚上,有早晨,是第六日。 (创世记 1:31 和合本)
Maximal Square
Question:
Given a 2D binary matrix filled with 0's and 1's, find the largest square containing all 1's and return its area.
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <vector>
using namespace std;
int maxSquarea(vector<vector<int> >& matrix) {
int m = matrix.size();
int n = matrix[0].size();
vector<vector<int> > matrix_flag = matrix;
int r = 0;
for (int i = 0; i < m; i++)
for (int j = 0; j < n; j++)
matrix_flag[i][j] = 0;
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
if (matrix[i][j] == 0)
continue;
if (matrix_flag[i][j] == 1)
continue;
int k = 1;
while (1) {
bool all1 = true;
int ii = i + k;
int jj;
for (jj = 0; jj <= k && ii < m && j+jj < n; jj++) {
if (matrix[ii][j+jj] == 0) {
all1 = false;
break;
}
}
if (!all1 || ii >= m || ((jj <= k) && (j + jj >= n)))
break;
jj = j + k;
for (ii = 0; ii <= k && i+ii < m && jj < n; ii++) {
if (matrix[i+ii][jj] == 0) {
all1 = false;
break;
}
}
if (!all1 || ((ii <= k) && (i + ii >= m)) || jj >= n)
break;
k++;
}
if (k > 1)
cout << i << " " << j << " " << k << endl;
for (int jj = j; jj < j + k; jj++)
matrix_flag[i][jj] = 1;
if (k > r)
r = k;
}
}
return r;
}
void printMatrix(vector<vector<int> >& matrix) {
int m = matrix.size();
int n = matrix[0].size();
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
cout << matrix[i][j] << " ";
}
cout << endl;
}
}
void buildMatrix(vector<vector<int> >& matrix) {
int m = 10;
int n = 10;
srand(time(0));
for (int i = 0; i < m; i++) {
vector<int> row;
for (int j = 0; j < n; j++) {
if (rand()%2)
row.push_back(0);
else
row.push_back(1);
}
matrix.push_back(row);
}
}
int main() {
vector<vector<int> > matrix;
buildMatrix(matrix);
printMatrix(matrix);
cout << maxSquarea(matrix) << endl;
return 0;
}
Given a 2D binary matrix filled with 0's and 1's, find the largest square containing all 1's and return its area.
Example
Answer:
For example, given the following matrix:
1 0 1 0 0
1 0 1 1 1
1 1 1 1 1
1 0 0 1 0
Return 4
.#include <cstdlib>
#include <ctime>
#include <iostream>
#include <vector>
using namespace std;
int maxSquarea(vector<vector<int> >& matrix) {
int m = matrix.size();
int n = matrix[0].size();
vector<vector<int> > matrix_flag = matrix;
int r = 0;
for (int i = 0; i < m; i++)
for (int j = 0; j < n; j++)
matrix_flag[i][j] = 0;
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
if (matrix[i][j] == 0)
continue;
if (matrix_flag[i][j] == 1)
continue;
int k = 1;
while (1) {
bool all1 = true;
int ii = i + k;
int jj;
for (jj = 0; jj <= k && ii < m && j+jj < n; jj++) {
if (matrix[ii][j+jj] == 0) {
all1 = false;
break;
}
}
if (!all1 || ii >= m || ((jj <= k) && (j + jj >= n)))
break;
jj = j + k;
for (ii = 0; ii <= k && i+ii < m && jj < n; ii++) {
if (matrix[i+ii][jj] == 0) {
all1 = false;
break;
}
}
if (!all1 || ((ii <= k) && (i + ii >= m)) || jj >= n)
break;
k++;
}
if (k > 1)
cout << i << " " << j << " " << k << endl;
for (int jj = j; jj < j + k; jj++)
matrix_flag[i][jj] = 1;
if (k > r)
r = k;
}
}
return r;
}
void printMatrix(vector<vector<int> >& matrix) {
int m = matrix.size();
int n = matrix[0].size();
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
cout << matrix[i][j] << " ";
}
cout << endl;
}
}
void buildMatrix(vector<vector<int> >& matrix) {
int m = 10;
int n = 10;
srand(time(0));
for (int i = 0; i < m; i++) {
vector<int> row;
for (int j = 0; j < n; j++) {
if (rand()%2)
row.push_back(0);
else
row.push_back(1);
}
matrix.push_back(row);
}
}
int main() {
vector<vector<int> > matrix;
buildMatrix(matrix);
printMatrix(matrix);
cout << maxSquarea(matrix) << endl;
return 0;
}
Subscribe to:
Posts (Atom)
fixed: embedded-redis: Unable to run on macOS Sonoma
Issue you might see below error while trying to run embedded-redis for your testing on your macOS after you upgrade to Sonoma. java.la...
-
F:\webrowser>react-native run-android Scanning folders for symlinks in F:\webrowser\node_modules (73ms) Starting JS server... Buildin...
-
Refer: https://github.com/bazelbuild/bazel/wiki/Building-with-a-custom-toolchain https://www.tensorflow.org/tutorials/image_recognition
-
Solution react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android...