Solution:
In order to use await, the function directly enclosing it needs to be async.
example codes:
async tryGetUserName() { let session = await Auth.currentSession(); ...... }
async
should be there, otherwise you will get the error.
Solution:
In order to use await, the function directly enclosing it needs to be async.
example codes:
async tryGetUserName() { let session = await Auth.currentSession(); ...... }
async
should be there, otherwise you will get the error.
<!-- init facebook js sdk via your appid --> <script> window.fbAsyncInit = function() { FB.init({ appId : 'yourappid', autoLogAppEvents : true, xfbml : true, version : 'v3.1' }); }; (function(d, s, id){ var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) {return;} js = d.createElement(s); js.id = id; js.src = "https://connect.facebook.net/en_US/sdk.js"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk')); </script> <script> function share() { // use FB.ui() to share content to facebook FB.ui( { method: 'share', href: 'urlyouwanttoshare', }, // callback function(response) { if (response && !response.error_message) { alert('Posting completed.'); } else { alert('Error while posting.'); } } ); } </script> <button onclick="share()">share</button>
App Domains
is not working for web site share to facebook.
template<typename T>
class MaxHeap {
public:
MaxHeap() {
size_ = 0;
capacity_ = 2;
heap_ = new T[capacity_];
}
MaxHeap(int capacity) {
if (capacity >= 2) {
heap_ = new T[capacity];
capacity_ = capacity;
size_ = 0;
}
else {
size_ = 0;
capacity_ = 2;
heap_ = new T[capacity_];
}
}
~MaxHeap() {
if (heap_)
delete[] heap_;
}
public:
int size() { return size_; }
void insert(const T& t) {
if ((size_+1) >= capacity_) {
capacity_ *= 2;
T* tmp = new T[capacity_];
for (int i = 0; i <= size_; i++)
tmp[i] = heap_[i];
delete[] heap_;
heap_ = tmp;
}
size_++;
heap_[size_] = t;
int i = size_;
int tmp = heap_[i];
while (i > 1 && tmp > heap_[i / 2]) {
heap_[i] = heap_[i / 2];
heap_[i / 2] = tmp;
tmp = heap_[i / 2];
i /= 2;
}
heap_[i] = tmp;
}
T max() {
return heap_[1];
}
int index(const T& t) {
return index(1, t);
}
void removeByIndex(int i) {
if (i < 1)
return;
if (heap_[size_] == heap_[i]) {
heap_[i] = heap_[size_];
size_--;
return;
}
if (heap_[size_] < heap_[i]) {
heap_[i] = heap_[size_];
size_--;
maxDown(i);
return;
}
heap_[i] = heap_[size_];
size_--;
maxUp(i);
}
void remove(const T& t) {
return removeByIndex(index(t));
}
private:
inline int index(int i, const T& t) {
if (heap_[i] < t)
return -1;
if (heap_[i] == t)
return i;
int r = index(2 * i, t);
if (r != -1)
return r;
return index(2 * i + 1, t);
}
inline void maxDown(int i) {
if (i * 2 > size_ && (i * 2 + 1) > size_)
return;
int l = i * 2;
int r = l + 1;
int m = l;
if (r <= size_ && heap_[r] > heap_[l])
m = r;
if (heap_[m] <= heap_[i])
return;
T tmp = heap_[i];
heap_[i] = heap_[m];
heap_[m] = tmp;
maxDown(m);
}
inline void maxUp(int i) {
if (i <= 1)
return;
int p = i / 2;
if (heap_[p] >= heap_[i])
return;
T tmp = heap_[i];
heap_[i] = heap_[p];
heap_[p] = tmp;
maxUp(p);
}
private:
T* heap_;
int capacity_;
int size_;
};
static MaxHeap<int>* all[101] = { 0, };
static int mt = 0;
void Init()
{
for (int i = 1; i < mt; i++)
if (all[i]) {
delete all[i];
all[i] = 0;
}
mt = 0;
}
void insertID(int ProductType, int ProductID)
{
if (!all[ProductType])
all[ProductType] = new MaxHeap <int>(50001) ;
all[ProductType]->insert(ProductID);
if ((ProductType + 1) > mt)
mt = ProductType + 1;
}
int highestID(int ProductType)
{
if (!all[ProductType] || all[ProductType]->size() <= 0)
return -1;
return all[ProductType]->max();
}
int findhighestID(int type)
{
int maxType = -1;
int maxId = -1;
for (int i = 1; i < mt; i++)
if (all[i] && all[i]->size() > 0) {
int max = all[i]->max();
if (max > maxId) {
maxId = max;
maxType = i;
}
}
if (type == 0)
return maxType;
return maxId;
}
void demarket(int ProductID)
{
for (int i = 1; i < mt; i++)
if (all[i]) {
int index = all[i]->index(ProductID);
if (index >= 1) {
all[i]->removeByIndex(index);
break;
}
}
}
ember g route index
ember g route rentals/index
Router.map(function() {
this.route('about');
this.route('contact');
this.route('rentals', function() {
// implied code
// this.route('index', { path: '/'});
});
});
Command execute without errors, but blank page showed with "http://localhost".ember g route index/index installing route create app/routes/index/index.js create app/templates/index/index.hbs updating router add route index/index installing route-test create tests/unit/routes/index/index-test.js
this.route('index', { path: '/'});
However, you can add the index route if you want to customize it. For example, you can modify the index route's path by specifying this.route('index', { path: '/custom-path'}).
this.route('rentals', {path:'/'});
ember d route index
git diff app/router.js
diff --git a/app/router.js b/app/router.js
index 254d53d..9f14d85 100644
--- a/app/router.js
+++ b/app/router.js
@@ -9,7 +9,7 @@ const Router = EmberRouter.extend({
Router.map(function() {
this.route('about');
this.route('contact');
- this.route('rentals', function() {
+ this.route('rentals', {path:'/'}, function() {
this.route('show', { path: '/:rental_id' });
});
});
Modify templates, all link to "index" replaced with "rentals".
- {{#link-to 'index' class="button"}}
+ {{#link-to 'rentals' class="button"}}
ember serve
sudo apt-get install gitweb
/etc/gitweb.conf is Gitweb (Git web interface) configuration fileserver {
listen 80;
listen [::]:80;
server_name git.errong.win;
auth_basic "Restricted";
auth_basic_user_file /home/errong_leng/.gitpasswd;
location ~ ^.*\.git/(HEAD|info/refs|objects/info/.*|git-(upload|receive)-pack)$ {
root /home/errong_leng/www/git;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
fastcgi_param SCRIPT_FILENAME /usr/lib/git-core/git-http-backend;
fastcgi_param PATH_INFO $uri;
fastcgi_param GIT_PROJECT_ROOT /home/errong_leng/www/git;
fastcgi_param GIT_HTTP_EXPORT_ALL "";
fastcgi_param REMOTE_USER $remote_user;
include fastcgi_params;
}
location /index.cgi {
root /usr/share/gitweb;
include fastcgi_params;
gzip off;
fastcgi_param SCRIPT_NAME $uri;
fastcgi_param GITWEB_CONFIG /etc/gitweb.conf;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
}
location / {
root /usr/share/gitweb;
index index.cgi;
}
}
cat /etc/nginx/sites-enabled/git.errong.win-ssl.confserver {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name git.errong.win;
ssl_certificate /etc/letsencrypt/git.errong.win/fullchain.cer;
ssl_certificate_key /etc/letsencrypt/git.errong.win/git.errong.win.key;
auth_basic "Restricted";
auth_basic_user_file /home/errong_leng/.gitpasswd;
location ~ ^.*\.git/(HEAD|info/refs|objects/info/.*|git-(upload|receive)-pack)$ {
root /home/errong_leng/www/git;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
fastcgi_param SCRIPT_FILENAME /usr/lib/git-core/git-http-backend;
fastcgi_param PATH_INFO $uri;
fastcgi_param GIT_PROJECT_ROOT /home/errong_leng/www/git;
fastcgi_param GIT_HTTP_EXPORT_ALL "";
fastcgi_param REMOTE_USER $remote_user;
include fastcgi_params;
}
location /index.cgi {
root /usr/share/gitweb;
include fastcgi_params;
gzip off;
fastcgi_param SCRIPT_NAME $uri;
fastcgi_param GITWEB_CONFIG /etc/gitweb.conf;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
}
location / {
root /usr/share/gitweb;
index index.cgi;
}
}
Restart nginx server.cat /var/log/nginx/error.log
2018/06/13 04:35:36 [error] 28827#28827: *6986 FastCGI sent in stderr: "Can't locate CGI.pm in @INC (you may nee d to install the CGI module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.22.1 /usr/local/sh are/perl/5.22.1 /usr/lib/x86_64-linux-gnu/perl5/5.22 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.22 /usr/s hare/perl/5.22 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base .) at /usr/share/gitweb/index.cgi li ne 13. BEGIN failed--compilation aborted at /usr/share/gitweb/index.cgi line 13" while reading response header from ups tream, client: 58.213.161.114, server: git.errong.win, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var /run/fcgiwrap.socket:", host: "git.errong.win" 2018/06/13 04:35:36 [error] 28827#28827: *6986 upstream prematurely closed FastCGI stdout while reading response header from upstream, client: 58.213.161.114, server: git.errong.win, request: "GET / HTTP/1.1", upstream: "fas tcgi://unix:/var/run/fcgiwrap.socket:", host: "git.errong.win" 2018/06/13 04:58:03 [error] 28827#28827: *7008 FastCGI sent in stderr: "[Wed Jun 13 04:58:03 2018] index.cgi: Ca n't locate HTML/Entities.pm in @INC (you may need to install the HTML::Entities module) (@INC contains: /etc/per l /usr/local/lib/x86_64-linux-gnu/perl/5.22.1 /usr/local/share/perl/5.22.1 /usr/lib/x86_64-linux-gnu/perl5/5.22 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.22 /usr/share/perl/5.22 /usr/local/lib/site_perl /usr/lib/x86_ 64-linux-gnu/perl-base .) at /usr/local/share/perl/5.22.1/CGI.pm line 2219" while reading response header from u pstream, client: 58.213.161.114, server: git.errong.win, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/v ar/run/fcgiwrap.socket:", host: "git.errong.win" 2018/06/13 04:58:30 [error] 28827#28827: *7010 FastCGI sent in stderr: "[Wed Jun 13 04:58:30 2018] index.cgi: Ca n't locate HTML/Entities.pm in @INC (you may need to install the HTML::Entities module) (@INC contains: /etc/per l /usr/local/lib/x86_64-linux-gnu/perl/5.22.1 /usr/local/share/perl/5.22.1 /usr/lib/x86_64-linux-gnu/perl5/5.22 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.22 /usr/share/perl/5.22 /usr/local/lib/site_perl /usr/lib/x86_ 64-linux-gnu/perl-base .) at /usr/local/share/perl/5.22.1/CGI.pm line 2219" while reading response header from u pstream, client: 210.94.41.89, server: git.errong.win, request: "GET / HTTP/2.0", upstream: "fastcgi://unix:/var /run/fcgiwrap.socket:", host: "git.errong.win"
cpan -i foo
foo
with the module name you want to install. tar -xvf HTML-Parser-3.72.tar.gz
cd HTML-Parser-3.72/
perl Makefile.PL
make
sudo make install
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...