Skip to content

Instantly share code, notes, and snippets.

@nartzco
nartzco / mongodb-kill-op.md
Created July 20, 2020 22:24
menghentikan query mongodb yang sudah jalan terlalu lama

Misal mau menghentikan query yang sudah jalan diatas 20 detik.

mongo
> use dbname
> killOP = function(maxSecsRunning) {
    currOp = db.currentOp();
    for (oper in currOp.inprog) {
        op = currOp.inprog[oper-0];
 if (op.secs_running > maxSecsRunning && !op.ns.startsWith("local")) {

Socket IO not working in flutter

Tambahkan networkSecurityConfig dan edit AndroidManifest.xml

project/android/app/src/main/AndroidManifest.xml
project/android/app/src/main/res/xml/network_security_config.xml

manifest

Edit AndroidManifest.xml

Sisipkan uses-permission dan networkSecurityConfig

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter

#include <msgpack.hpp>
#include <vector>
#include <map>
#include <iostream>
#include <cstdio>
struct point_t {
float x;
float y;
float z;