Skip to main content

Posts

Apple MacBook macOS Critical Battery Warning at 5% or less

Coming from Windows where there's an entire set of configuration options to set Low Battery Warnings, Critical Battery Warnings and Actions, etc. I'm dismayed that macOS doesn't have any configuration at all, and only has a permanently fixed Low Battery notification at 10% and nothing else. I have made a script ( available on GitHub Gist ) that will show a warning alert like this:  You can save the first file as  /usr/local/bin/battcritical (without the .sh ) and if you only want it in current session, just run it with: nohup /usr/local/bin/battcritical & To have it start warning you at another percentage (and below), change the number after -le on line 11 to your desired percentage. In order to have it automatically run every time you boot up your Mac, also save the second file as  /usr/local/bin/login-scripts (without the .sh ), then drag and drop the login-scripts file into the Login Items list in your System Settings. Remember to give both files the execut...

How to force redirect HTTP to HTTPS in Amazon Elastic Beanstalk

After picking up bits and pieces over the Internet, here I have the complete guide for my particular setup. My Amazon AWS Elastic Beanstalk (ELB or EBS) is as follows: 64bit Amazon Linux 2016.03 v2.1.1 running Tomcat 8 Java 8 Java/JSP application on Apache Tomcat Maven Build How to get it done: First, configure your EBS instance: Go to Configuration and click the gear on Load Balancing. Under Load Balancer, set the following options: Listener port: 80 Protocol: HTTP Secure listener port: 443 Protocol: HTTPS SSL certificate ID: Choose the cert ID that goes with your server. If you don't have one, you can use Certificate Manager to create one. Apply and save this configuration. Let the server health be OK. Test it by accessing your application web page through both HTTP and HTTPS: HTTP should load the page unsecurely. HTTPS should load the page securely. No port number should be added after the domain name in either case. Then, add a configuration file ...

Make Google Chrome fast again

TL;DR: Get Native Lazy Tabs  or Tiny Suspender  (You need to enable "native discard" experimental feature in its options). Pro Tip: Press Shift-Esc in Chrome to view its task manager. Sort the memory column and you'll get an idea of which tabs or extensions are using the most of it. When Google Chrome browser first came out, the pitch was a no-frills super fast browser that is very light on memory. This was amazing at the time when competing browsers like Firefox were heavy on RAM, drinking up copious amounts of it, slowing computers down. But as time went by, browsers like Firefox have leaned down in response, but the memory footprint of Chrome seems to only have been going up, especially if you're a heavy user of web apps. However, Chrome is still a favorite to many including me for its simplicity, clean interface, and maintenance-free upgrades. (In fact, I had briefly switched to Firefox when Chrome killed custom extensions, but shortly after I went back...

Convert the Atom Editor into a PHP IDE using PHP Integrator

Atom Editor is basically a text editor on steroids. It is not an IDE for any language by default. Through the power of plugins, you can convert Atom into almost anything you wish, except a toaster. Here I am documenting what I did in order to convert Atom Editor to a nice PHP IDE. You can do the same too using PHP Integrator and make it much easier to maintain your PHP projects in Atom. Note: Throughout the guide, I'll indicate version numbers at the time of writing in brackets. This is only for reference, and you must always install the latest version of the software, not the version indicated here. Upgrade to the latest version of Atom (1.21.1). Install the package php-integrator-base (3.1.0). (File > Settings > Install) Atom will ask you to install dependencies. Say Yes. The dependencies are (at the moment): atom-ide-ui  (0.5.3) (previous versions used linter , but you should disable/remove that now as it will conflict with Diagnostics) intentions (1.1.5) ...

Make Atom Editor load faster

The default installation of Atom editor comes with a bunch of core packages that you may not need. I have found that you can actually speed up the load time of Atom by disabling a lot of these core packages. The good thing about Atom is anytime I need a package I can just enable it and it's instantly active (for most packages). Please note that what you disable would depend on your own needs. For example, if you develop Java, you would want to keep 'language-java' enabled. I proceeded to  disable  the following packages as I did not see the need for them at the moment. about - if disabled, nothing will happen if you click Help > About Atom. You can still check for updates using Help > Check for Update. archive-view autocomplete-atom-api autoflow autosave - Atom will still save your edit buffer. This package is not necessary to save buffer. background-tips - The tips shown when you don't have any tab open. bookmarks command-palette dalek deprecation...

Google Drive service unaffected, app being shut down

About a week ago, Google made a confusing announcement in their G Suite Updates Blog. It resulted in shocking many Google Drive users that their favorite service is being killed off by the search giant Google. Even tech blogs kept trumpeting the false information without taking care to verify the rumors that were spreading about. But thankfully, there are those who saw through the folly and are trying their best to clear the confusion. Here's what's actually happening: The name ‘Google Drive’ refers to two different things: Google Drive online service to create Docs, Sheets, Slides and other collaborative documents, as well as backup your files. Google Drive app (a.k.a. computer program) that runs on your Mac or PC, which gives you access to those documents and files, and also syncs the files with the service. Here’s what Google said (read it with a big bag of salt): With this launch, Google Drive for Mac/PC is officially deprecated. It will no longer be supported...

How to SHRINK an Amazon AWS EBS volume safely with no data loss

Note: This guide assumes your volume is based on a Linux file system such as ext4. If you're using a different file system, you may still be able to shrink the volume but your mileage may vary. To get to the guide, scroll down and skip the prologue. Prologue Once my 1 year free trial with Amazaon AWS was over, I found that I'm paying for 30 GB of storage space while I'm actually using only about 5 GB. Hence I decided to shrink it down to about 7 GB or so. My plan is to just monitor the usage and see if I can reduce the usage or expand the volume later as needed. Searching for guides on Google, the top hit was this blog post . But I found that the instructions are actually terrible. Here are the problems with it: The guide tells you to FORMAT the volume with your existing data. YES! That's ridiculous, but it's true. It's this command: sudo mkfs -t ext4 /dev/xvdf . I did it and destroyed my data , but lucky for me, I had made a snapshot. No problem, jus...

How do I rename a label for my Facebook Page's messages?

If you have a Facebook Page and you're receiving messages in it, you may have noticed that you can organize chats with labels. A conversation can even have multiple labels applied on it. This should be very useful for you and your fellow page admins to filter and track their categorization as well as their status. While this is an excellent feature which allows you to create new labels, delete labels that you no longer need, apply colors to labels, filter by labels and even combine two labels into one, Facebook has totally missed out on a very important yet very basic functionality: renaming a label. Until such time that Facebook realizes what they have missed out and fixes the problem by giving us a one-click rename option for the label management, here's a trick how you can rename an existing label. This trick uses the functionality of combining two labels to create an empty label and combine it with the existing label that you want to rename. Here's how it works: O...

How to change default and internal currency in self-hosted Odoo or OpenERP

If you wish to use Odoo in a single-currency environment, you will find issues changing the currency in the Odoo interface itself. If you have a self-hosted solution of Odoo or OpenERP, you already have unprecedented control over the system, unlike the cloud-based solution from Odoo. This means that you can very easily fix the issue by hacking the database that Odoo is relying on. Even in a multi-currency environment, you can use the same trick to change the global default currency - the fix is very clean for any environment - there is just an extra step to update the currency rate settings. Even in the latest version of Odoo, we still face the ridiculous bug that Odoo internally ALWAYS uses EUR (Euro) as the internal currency. This has created many problems for many users wanting to use a different currency. Despite being set to a different currency from the Odoo interface, the eCommerce site, reports, accounting, etc are still shown using EUR and the Euro symbol, creating confusio...

Amazon EC2 instance with LAMP and Git and multiple Git collaborators

Brace yourself, this is going to be --long. I'm not going to explain a lot. I basically followed what was here , but procedures are outdated and can be confusing if you don't know what you're doing. I'm just going to give an overview of what's different from that page now:  When you launch a new EC2 instance, the wizard is now different. You will no longer have a choice between "Classic Wizard", "Quick Launch Wizard" etc. Select Ubuntu server 14.04 64-bit with HVM (not PV). Remember to add an EBS volume or expand the root volume. I don't recommend expanding root volume, but rather to use another volume to store your data. That way you can wipe you root volume and start over again without data loss. (I almost did, coz I stupidly sudo rm * in an important directory - but I managed to recover.) You won't be creating key pairs in the wizard itself. You will be asked to do so after you click on Launch to start up the instance. The proce...

Is the OnePlus 2 really the 2016 Flagship Killer?

Making a recording of the VR launch, watching it several times, watching many review videos and articles about the NEW OnePlus 2 has left me thinking and wanting to post my own two cents. First, watch the VR launch (non-VR version) if you haven't: Is the OnePlus 2 really the 2016 Flagship Killer? The answer is both Yes AND No . Yes, because it has some of the top hardware you can get. No, because it doesn't live up to the hype.

Install a flat file blog in a subfolder in an existing Google App Engine website

 NOTICE:  This post is not very useful as a guide. It is documenting the failures I encountered trying to set up a flat file blog in a subfolder in GAE. Read for your pleasure, but don't try to follow it. Google App Engine (GAE) allows you to set up a simple PHP website easily and for free with generous quotas - more than enough for a low traffic site. There are several guides on how to get one working . However, GAE works differently from traditional web hosting. Access is tightly controlled through app.yaml file; the static files and application files are separate from each other; and the application file system is not writable. As WordPress requires a MySQL database (chargeable under Google Cloud SQL), I looked for a flat file blogging alternative . Dropplets looks too simple and feature-poor. It doesn't have a comment system integration out-of-the-box, but Disqus can be added later. There is no rich text editor - plain text editing required in Markdown syntax....

Disable auto save in JetBrains IDE software (IntelliJ IDEA, PyCharm, PhpStorm)

JetBrains provides the following IDE software: IntelliJ IDEA PhpStorm PyCharm RubyMine WebStorm AppCode CLion Google also provides Android Studio which is powered by the IntelliJ platform. If you come from a different IDE such as Eclipse, you will be unpleasantly surprised to find that JetBrains-branded IDEs automatically save everything the moment you look away. The proponents argue that as you work on your project, you should not have to worry about saving files. But to others, this auto-save behavior which is enabled by default is a curse that catches them by surprise, and a shocking departure from the workflow they are very much used to. You can change the behavior by altering some settings.

WhatsApp voice call feature bans regular mobile network calls

With the recent introduction of WhatsApp voice call feature for their Android users (without requiring an invite from one of your friends who have the feature), the WhatsApp client has outright banned the use of regular mobile network to make calls through the app's interface. The WhatsApp developer team (now under Facebook) has decided to make it simply impossible to do what you used to be able to do in their Android client. Many users have found it very handy to place regular calls to their WhatsApp friends through the app's interface, but with this change, they are forced to take the longer route of going to their home screen, opening the phonebook/contacts list, finding the contact and making a regular call. Or perhaps the slightly better (provided you know about it) but still longer route of opening the "Contact info" screen in WhatsApp, choosing "View in address book" in the menu and making a regular call. Before the free calls were introduced, Wha...

How to clean up your Blogger Reading list

How to clean up your Blogger Reading list and stop following old blogs you no longer want to follow: If you tried to stop following blogs using the gear icon next to the Reading list in your Blogger home page, you will now get this error: We are unable to load your FriendConnect data at this time. We apologize for the inconvenience. Please try again shortly. There is no need to try again shortly, because FriendConnect was partially shut down in 2011 and this broke its integration with the Reading List feature of Blogger. Fortunately, there is another way to clean up your reading list and remove those antique blogs you no longer care about: Go to Google Friend Connect http://www.google.com/friendconnect/user/overview Click on one of the Settings links next to the blogs. A pop-up will appear. If it asks to sign-in, sign in with your Google account. If you had to sign in, the pop-up will close. Click on the Settings link again to re-open the pop-up. On the left side, click on ...

Setting up a local Oracle XE database and importing DMP file

The experience of setting up a local Oracle Express Edition database is not a straight-forward as it should be. The following is supposed to outline what could go wrong and how to go about it the right way. It also includes importing a DMP file (a dump) from another system. First of all, download the installer from Oracle website . You will need to sign-in to download - the account creation is free. Be sure to choose the correct bit as per your computer (x64 or x86). Extract the download and install XE by running DISK1\setup.exe (and feel nostalgic of the floppy disk era) . During installation, you will need to choose a new password. There will also be some details displayed after you enter the new password, such as folders and ports. Be sure to save both password and details in a text file for future reference. I saved it as C:\oraclexe\details.txt . Save password only if it's generic and you are likely to forget. The installation will take a while, but usually, no rest...

WhatsApp Web is on Firefox... still nothing for iOS

WhatsApp Web has expanded to Mozilla Firefox, and possibly other browsers too. iPhone and iPad users are still out of luck, as Apple's technical restrictions made it difficult for the Web client to work with iOS version of WhatsApp. When WhatsApp Web was launched, it was only available for Google Chrome. WhatsApp Web took advantage of Chrome's push notification system, citing it as ideal for the product (ref) . However, it is now available on Firefox as well, a browser that still remains popular among many, despite all the recent flak it received. Many Chrome users had switched back to their old favorite Firefox after Chrome unveiled a new "security update" that essentially destroyed their ability to have custom add-ons - Chrome was now locked to work only with add-ons approved on the Chrome Web Store. A lot of such users will be happy to finally get rid of Chrome altogether, if they had still been running Chrome to use WhatsApp Web. That being said, I found tha...

Install Windows 10 Tech Preview when setup says media driver missing

Skip to the end for instructions. I had been trying to install Windows 10 Pro Technical Preview onto a VHD, as I have Windows 7 Ultimate and can run an operating system from VHD (this feature is apparently limited to Enterprise and Ultimate editions). While I had successfully managed to install it on a virtual machine in Oracle VirtualBox, I was dissatisfied with the sluggish performance of a VM. At the same time, I also did not want to dedicate a real hard disk partition for the sole purpose of installing Windows 10 TP. Hence the decision to install into a VHD, which is a very neat solution that lets me keep Windows 10 TP separate from my real hard disk partitions and still enjoy the full native speeds of my real hardware. I had previously installed Windows 8 RC successfully into a VHD so I knew what I was up against. Or so I thought. As soon as I booted up the setup disk (the ISO I had downloaded) and clicked on Install Now, I received this very unhelpful error asking for de...

Samsung S3 LTE Power button jammed

The power button on my phone (GT-I9305) was jammed, and my phone entered a constant state of boot loops. It keeps trying to turn on, but keeps restarting because the phone thinks the power button is held down. I was able to follow the instructions in the following video, although I used a clear aftershave splash from Gillette instead of 90% pure alcohol cleaning solution. The splash is also alcohol (percentage unknown) and it was the closest alternative within my arm's reach. It fixed the problem temporarily, and I was determined not to touch the power button. But the next day I pressed the power button out of habit to turn the screen off (oh, don't we all love it when habits work against your willpower). Sure enough, the button jammed again and the phone went in to boot loops. I was able to shake and hammer the phone on my hand to unstuck the power button again (if that doesn't work, try the above video again; but I was at work and didn't have access to the to...

Why a PDF Printer should be your default printer

The convenience of 'Quick Print' comes at a great cost (both to yourself and the environment). If you ever accidentally hit that shortcut, the document is immediately sent to the default printer. If your default printer happens to be a physical printer that's connected to your network or your computer directly, there goes valuable paper and ink churning out pages and pages of a document you never wanted to print, and you probably will trash or shred anyway. Indeed, I had once been working on a Java source code file in Eclipse and I accidentally clicked the Print button in the toolbar. (Why a source code editor would even need a Print button is beyond me.) The entire 1596 lines of source code got sent to the printer and I couldn't even stop it from printing half way. That ended up on 33 pages, and consequently 33 sheets of paper. Now I have this stack of paper on my desk with one particular version of the source code, all printed and 'set in stone'. Since i...