Useful Mix http://usefulmix.com Something useful every once in a while... Thu, 11 Oct 2018 07:47:17 +0000 en-US hourly 1 https://wordpress.org/?v=5.4.1 How to send a message to a Telegram channel using the HTTP bot sendMessage API http://usefulmix.com/send-message-telegram-channel-bot-http-api/ http://usefulmix.com/send-message-telegram-channel-bot-http-api/#respond Mon, 08 Oct 2018 06:58:33 +0000 http://usefulmix.com/?p=353 Continue reading "How to send a message to a Telegram channel using the HTTP bot sendMessage API"]]> Here’s a practical example how to send a message to a Telegram channel using a Telegram Bot and the HTTP bot sendMessage API.

In order to be able to do so, you will have to the following:

  1. Create a Telegram public channel (we’ll make this private later)
  2. Create a Telegram BOT via BotFather
  3. Set the bot as administrator in your channel

After you’ve completed the steps above, we can now go ahead and send a message to the channel by issuing and HTTP GET request to the Telegram BOT API at the following URL (you can do this in your browser):

https://api.telegram.org/bot[BOT_API_KEY]/sendMessage?chat_id=[CHANNEL_NAME]&text=[MESSAGE_TEXT]

where:

BOT_API_KEY is the API Key generated by BotFather when you created your bot
CHANNEL_NAME is the handle of your public channel (e.g. @channel_name)
MESSAGE_TEXT is the message you want to send (URL-encoded)

Example HTTP API call response:

{
  "ok": true,
  "result": {
    "message_id": 2,
    "chat": {
      "id": -1001363941800,
      "title": "TestChannel",
      "username": "usefulmix_channel",
      "type": "channel"
    },
    "date": 1538926255,
    "text": "Test message"
  }
}

So far, so good, but let’s consider that you’ll want this new channel to be private so that only you and the bot (and whoever you decide to invite in the channel) will see the messages.

So we need to make the channel private, however in doing so our above HTTP API call will stop working and this is what trying to prublish a message will look like:

{
  "ok": false,
  "error_code": 400,
  "description": "Bad Request: chat not found"
}

To get around this, all you need to do is look at the public HTTP API call we made initially and pick up the "id": -1001363941800 as this is the unique id of our channel which we’ll be switching to after we make our channel private from public.

So now the API call becomes:

https://api.telegram.org/bot[BOT_API_KEY]/sendMessage?chat_id=-1001363941800&text=[MESSAGE_TEXT]

And voila, you now have a private Telegram channel, where you can send messages via the HTTP bot sendMessage API. This can be very useful when you have some online services that provide you with a callback mechanism and can call you HTTP API endpoint so that you get notified of whatever in real time.

]]>
http://usefulmix.com/send-message-telegram-channel-bot-http-api/feed/ 0
WordPress Permissions Update Error – How to Fix http://usefulmix.com/wordpress-permissions-update-error-how-to-fix/ http://usefulmix.com/wordpress-permissions-update-error-how-to-fix/#respond Wed, 14 Feb 2018 18:51:04 +0000 http://usefulmix.com/?p=340 Continue reading "WordPress Permissions Update Error – How to Fix"]]> If you’re running into the WordPress core upgrade failure or plugins/themes update issues when you try to update/upgrade via the admin interface, all you need to do is reset the file permissions on the core files and the problem will most likely be fixed and you’ll be able to process with the update.

Provided you have SSH access to your server, run the following set of commands and this will likely fix your issue.

Reset all file permissions  664:

 find /path/to/site/ -type f -exec chmod 664 {} \;

Reset all directory permissions to 775:

 find /path/to/site/ -type d -exec chmod 775 {} \;

Reset the group ownership to the wordpress or www-data group (or whatever your nginx/apache group name is):

 chgrp -R wordpress /path/to/wodpress_site_directory/

After you run these commands you should be able to successfully update WordPress code, plugins and themes with no issues.

]]>
http://usefulmix.com/wordpress-permissions-update-error-how-to-fix/feed/ 0
Best looking Google Pixel 2 XL case http://usefulmix.com/best-looking-google-pixel-2-xl-case/ http://usefulmix.com/best-looking-google-pixel-2-xl-case/#respond Tue, 24 Oct 2017 16:06:11 +0000 http://usefulmix.com/?p=323 Trianium CLARIUM SERIES Case for Google Pixel 2 XL (2017)

  • Accessible buttons and cutouts around speakers, camera, and charging port.
  • Shock-absorbing TPU
  • Rigid back with protection against scratches and scrapes
  • Slim profile
  • Comfortable grip when held in the palm of your hands.
  • Transparent body

See at Amazon


 

]]>
http://usefulmix.com/best-looking-google-pixel-2-xl-case/feed/ 0
Install Archidroid v3.0.0 experimental ROM on the Galaxy S3 (GT-I9300) http://usefulmix.com/install-archidroid-v3-0-0-experimental-rom-on-the-galaxy-s3-gt-i9300/ http://usefulmix.com/install-archidroid-v3-0-0-experimental-rom-on-the-galaxy-s3-gt-i9300/#respond Mon, 24 Nov 2014 20:01:32 +0000 http://usefulmix.com/?p=316 Continue reading "Install Archidroid v3.0.0 experimental ROM on the Galaxy S3 (GT-I9300)"]]> XDA-forums original Archidroid thread for Samsung Galaxy S3 (GT-I9300): [ROM] [4.4.4] [CyanogenMod] [Linaro 4.9] [Excellent] [06/09/14] ArchiDroid V2.5.3

Currently the stable version is version 2.3.5, and I wanted to go with the 3.0.1 experimental version, and here’s how to do just that:

1. Go to the Archidroid’s github repository: i9300-cm-experimental

2. And download the repository zip: direct download zip of i9300-cm-experimental

3. After the download is finished, unzip the archive.

4. Download 7zip from here: 7zip.org

5. After you’ve extracted the i9300-cm-experimental zip archive, go into the directory, select everything (Ctrl+A shortcut) and right click and select 7zip > Add to archive… and select Compression Level: Fastest and the Compression method: Deflate and click ok.

6. After the zip archive has been created, copy it to your device.

7. Next, just reboot your GS3 into recovery console and flash the .zip archive like any other rom.

A short video available on the Archidroid thread which shows some of the steps mentioned above:

At the end, when you boot up, and go in System Settings > About Phone you should see something like:

archidroid samsung galaxy s3 (gt-i9300) cm experimental version 3.0.0
archidroid samsung galaxy s3 (gt-i9300) cm experimental version 3.0.0
]]>
http://usefulmix.com/install-archidroid-v3-0-0-experimental-rom-on-the-galaxy-s3-gt-i9300/feed/ 0
Delete a Github forked repository http://usefulmix.com/delete-a-github-forked-repository/ http://usefulmix.com/delete-a-github-forked-repository/#respond Mon, 27 Oct 2014 08:12:01 +0000 http://usefulmix.com/?p=306 Navigate to the repository you want to delete.

In the repository action bar, click Settings.

repo-actions-settings

Under Danger Zone, click Delete this repository.

repo-delete

Read the warnings.

To verify that you’re deleting the correct repository, type the name of the repository you want to delete.

repo-delete-confirmation

Click I understand the consequences, delete this repository.

]]>
http://usefulmix.com/delete-a-github-forked-repository/feed/ 0
BMI-Calories.com – a free heath and fitness calculator index http://usefulmix.com/bmi-calories-com-a-free-heath-and-fitness-calculator-index/ http://usefulmix.com/bmi-calories-com-a-free-heath-and-fitness-calculator-index/#respond Tue, 02 Sep 2014 16:01:50 +0000 http://usefulmix.com/?p=291 Continue reading "BMI-Calories.com – a free heath and fitness calculator index"]]> Global Average BMI value for both men and women
Global Average BMI value for both men and women

BMI Calories  is a small index off free health and fitness calculators mainly designed to be universally applicable for worldwide usage (each one has a metric system and a standard US measuring system).

The above picture is a screenshot of the interactive geo-chart-map, which displays the average BMI values in 177 countries for both men and women and can be found on the bmi calculator page.

Other calculators available on the site:

  • BMR calculator – for figuring out your basal metabolic rate (or resting metabolic rate, as it is sometimes referred to)
  • A Calorie intake calculator – for figuring out how many calories a day the body requires depending on the physical activity level you undergo. The nice thing about it is that it also has a section with a table of physical activities that span over ~300 or so different types of activities and their associated calorie consumption / expenditure values.
  • Body Fat percentage calculator – the name says it all, however what’s nice about it is that, aside from the actual body fat percentage value calculated, it also provides some insights into fat and lean mass,  body adiposity index (also known as BAI), and a value of the body fat extracted using the BMI – for adults and children alike.

Like with the interesting information from the global average BMI, all other calculators come with a plethora of additional information related to the actual calculation, which makes it a great resource for whenever you need to calculate these values, but also have some time to browse around.

]]>
http://usefulmix.com/bmi-calories-com-a-free-heath-and-fitness-calculator-index/feed/ 0
sleep-calculator.com – Calculates the Best Time to Go to Sleep So You Wake Up Refreshed http://usefulmix.com/sleep-calculator-com-calculates-the-best-time-to-go-to-sleep-so-you-wake-up-refreshed/ http://usefulmix.com/sleep-calculator-com-calculates-the-best-time-to-go-to-sleep-so-you-wake-up-refreshed/#respond Sun, 13 Apr 2014 09:11:28 +0000 http://usefulmix.com/?p=283 Continue reading "sleep-calculator.com – Calculates the Best Time to Go to Sleep So You Wake Up Refreshed"]]> Sleep Calculator web app

Waking up refreshed and comfortable consists of getting to bed at the right time. Sleep-calculator.com is a webapp that makes decisions based on our sleep cycles and calculates when you should fall asleep / wake up.

Punch in when you need to wake up and you’ll get 4 best times to fall asleep.

Other scenarios are available as well:

  1. Depending on your situation you might want to know when to go to sleep to wake up at a specified time (in this case go for Scenario 1)
  2. You might want to decide the best times to wake up after having gone to sleep at a specified time (in this case go for Scenario 2)
  3. You might want to simply know the best times to wake up if you were to go to sleep this instant (in this case go for Scenario 3)
  4. If plan to take a power nap it will give you the best time at which you should wake up (in this case go for Scenario 4)

Give it a try to see if you can time your sleep for the best rest.

Sleep-Calculator.com

]]>
http://usefulmix.com/sleep-calculator-com-calculates-the-best-time-to-go-to-sleep-so-you-wake-up-refreshed/feed/ 0
Nginx Error – 413 Request Entity Too Large Fix http://usefulmix.com/nginx-error-413-request-entity-too-large-fix/ http://usefulmix.com/nginx-error-413-request-entity-too-large-fix/#respond Mon, 17 Mar 2014 09:04:09 +0000 http://usefulmix.com/?p=274 Continue reading "Nginx Error – 413 Request Entity Too Large Fix"]]> If you’re getting 413 Request Entity Too Large errors trying to upload files to your webserver, you need to increase the client body size limit in your nginx.conf configuration file.

Add ‘client_max_body_size xxM’ inside the server section, where xx is the size (in MB) that you want to allow for files upload to your webserver.

The client_max_body_size directive assigns the maximum accepted body size of client request, indicated by the line Content-Length in the header of request.

To edit your nginx configuration, in your terminal type the following:

sudo nano /etc/nginx/nginx.conf
or
sudo nano /usr/local/nginx/conf/nginx.conf
and set the
# set client body size to 2M #
client_max_body_size 2M;

as per the example below:

http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;

server {
client_max_body_size 2M;
listen 80;
server_name localhost;

# Main location
location / {
proxy_pass http://127.0.0.1:8000/;
}
}
}
]]>
http://usefulmix.com/nginx-error-413-request-entity-too-large-fix/feed/ 0
WordPress theme upload error “PCLZIP_ERR_BAD_FORMAT (-10)” http://usefulmix.com/wordpress-theme-upload-error-pclzip_err_bad_format-10/ http://usefulmix.com/wordpress-theme-upload-error-pclzip_err_bad_format-10/#respond Mon, 17 Mar 2014 08:55:09 +0000 http://usefulmix.com/?p=272 Continue reading "WordPress theme upload error “PCLZIP_ERR_BAD_FORMAT (-10)”"]]> While trying to install a wordpress theme that was packaged as an .rar archive I got the following error:

The package could not be installed. PCLZIP_ERR_BAD_FORMAT (-10) : Unable to find End of Central Dir Record signature

This is because I’m trying to unpack a .rar archive and the server doesn’t have rar archive support installed, however you can get around this issue quite easily.

All you need to do is unpack the .rar archive and re-pack it as a .zip archive and re-try the upload. Everything will work as expected after that.

]]>
http://usefulmix.com/wordpress-theme-upload-error-pclzip_err_bad_format-10/feed/ 0
Git – How to delete a local branch or remote http://usefulmix.com/git-how-to-delete-a-local-branch-or-remote/ http://usefulmix.com/git-how-to-delete-a-local-branch-or-remote/#respond Thu, 13 Mar 2014 14:37:42 +0000 http://usefulmix.com/?p=266 Continue reading "Git – How to delete a local branch or remote"]]> Git – delete a local branch:

git branch -d some_example_local_branch

Git – delete/remove a remote branch:

git push origin : some_example_remote_branch

In case of error after trying to remove remote branch, run:

git fetch -p

This is what the error message would look like:

error: unable to push to unqualified destination: some_example_remote_branch
The destination refspec neither matches an existing ref on the remote nor
begins with refs/, and we are unable to guess a prefix based on the source ref.
error: failed to push some refs to 'git@repository_name'

and this is caused due to the fact that perhaps anyone else has already deleted the branch and you need to synchronize your branch list.

]]>
http://usefulmix.com/git-how-to-delete-a-local-branch-or-remote/feed/ 0