How to open Sublime Text in command line with subl on Mac OS?

I have tried to setup Sublime Text 3 so I could run it on my new Mac from terminal just typing subl . but all the when I wanted to make the symlink I was getting this error: ln: /usr/local/bin/subl: No such file or directory  all the time.

The problem is that I had no bin directory on that path. So to fix that you need to do the following:

cd /usr/local
sudo mkdir bin

Now we have that bin folder on /usr/local/bin path and now we can create the link using:

Sublime Text 3

sudo ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/local/bin/subl

Sublime Text 2

sudo ln -s /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl /bin/local/bin/subl

Exit the terminal and start it again and you should be able to use subl . to open all files in current folder in sublime text for editing.

This post helped you out?
Why not buy me a coffee?


Amount
Your message for me

How to fix 0x0000007b blue screen (BSOD) ?

Are you getting that blue screen (BSOD) with error message 0x0000007b when booting your computer or trying to install a new Windows operating system (on a computer with SSD drive)?

0x0000007b blue screen BSOD

The problem is that in BIOS your SATA is set to AHCI instead of ATA. To fix this problem you’ll have to enter the BIOS and change it back and your system will function normally. This can happen if your BIOS data is lost or in some cases the BIOS batter is empty, or if you cleared bios by hand. Don’t worry none of your data is damaged in any of these cases.

Here’s how to fix this problem:

  1. Reboot your computer and keep pressing F12 to enter BIOS. On some laptops  it’s F2 or F8 (it should be shown on your screen)
  2. Go to Advanced tab and change ACHI to ATA option under SATA Operation (it might have a different name depending on your BIOS).
  3. Save the changes and reboot.

That’s it!

 

This post helped you out?
Why not buy me a coffee?


Amount
Your message for me

Download Offline Installer for Microsoft .NET Framework 4.6, 4.5, 4.0, 3.5, 2.0 and 1.0

Microsoft Windows applications developed using .NET Framework require Microsoft .NET Framework to be installed on computer that will run the application. Microsoft provides installer for .NET Framewework but by default it’s an online installer. That means that you basically download a small installer file that after it’s executed automatically connects to Microsoft servers and downloads the required components and completes the installation.

The online installers work great as long as you have internet conection. But some users don’t have an internet connection and that can be a problem. Sometimes developers require offline installer so they can ship it with the software inside software installation or on CD/DVD medium.microsoft-dot-net-new-logo

I have gathered a set of links of Microsoft .NET Framework offline installers and you can download full installation files from the following links:

.NET Framework 4.6 Setup

.NET Framework 4.5 Setup

.NET Framework 4.0 Setup

.NET Framework 3.5 Setup Service Pack 1

.NET Framework 3.5 Setup

.NET Framework 2.0 Setup

.NET Framework 1.0 Setup

.NET Framework Client Profile Offline Installer

 

This post helped you out?
Why not buy me a coffee?


Amount
Your message for me

How to get rid of Windows 10 upgrade nag screen?

If you run Windows 7, Windows 8 or Windows 8.1 you probably got an offer to upgrade to Windows 10 and you noticed that upgrade icon in task bar to your clock.

Windows 10 Free Upgrade Icon

Windows 10 Free Upgrade App GWX

If you don’t want to upgrade to Windows 10 and you want to keep your current Windows and you’d like to get rid of that GWX.exe nag screen and taskbar icon run cmd as administrator by typing in cmd in start menu search and right clicking the Command Prompt result and clicking on Run as administrator and confirming that you want to run command prompt as admin.

Run command prompt as administrator

When you get that black command prompt window just type (copy/paste) the following command and once it’s executed reboot your computer and Windows 10 upgrade will be gone. Out of many this is the only solution that actually worked for me!

reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\Gwx" /v DisableGwx /t REG_DWORD /d 00000001 /f

 

One more thing I also noticed is that even if you’re not interested in upgrade Microsoft still downloads entire Windows 10 installation and stores it in c:/$windows.~BT folder just in case you say “yes” to their upgrade offer. That folder can take from 2 to 3 GB of your disk space and it’s especially valuable if you have (a smaller) SSD as your primary hard drive. Removing the folder frees up the space but quickly (after a reboot) it starts downloading it again so it doesn’t just take your disk space but also uses your internet bandwidth. To stop it from doing that after you delete folder $windows.~BT create a new empty one with the same name and then right-click it and in folder properties make it Read Only. That way it will remain empty as Windows will not be able to download Windows 10 files and store them in it.

 

This post helped you out?
Why not buy me a coffee?


Amount
Your message for me

How to safely install git on cPanel/WHM?

GIT is popular version control system for software development and it’s really common today. Installation on servers without cPanel is pretty simple but on servers that do have cPanel can be tricky because git installs it’s own Perl libraries and that can cause many problems and conflicts and often results in unusable WHM server in the end.

So whatever you do – do not install GIT!
I repeat: DO NOT INSTALL GIT ON WHM SERVER!

Because it’s already installed 🙂
It’s just not in path and you can’t use it.

There are two ways of doing this:
1. WHM/root way that will make git available to all users on the system
2. cPanel way that will make git available only for the current account

Hot to enable it in WHM?
To make git usable to all users (with ssh access) just execute this single line of code as root:

ln -s /usr/local/cpanel/3rdparty/bin/git /usr/local/bin/git

How to enable it in cPanel?
If you are using a shared (or reseller) hosting powered by cPanel (and you don’t have WHM access) than you need to login using SSH and locate your .bashrc file. It should be in your home directory. Open that file for editing and add git to your path by adding following two lines of code at the end of your .bashrc file:

PATH=$PATH:/usr/local/cpanel/3rdparty/bin 
export PATH

To edit that file enter: nano .bashrc
After you add these two lines your .bashrc file should look like this:

bashrc-git-path

To save the changes press CTRL+X , then press Y and Enter. In order for changes to be accepted it will be necessary to re-log in to your SSH command prompt.

How to check if git now works on cPanel?
Well, that’s really simple. Just login to SSH and execute: git –version
and that should return git version (currently cPanel git is version 2.6.1)

That’s it!
Nice and simple.
Happy giting…

This post helped you out?
Why not buy me a coffee?


Amount
Your message for me

How to disable FileZilla update nag screen?

I use FileZilla a lot and I start it like ten times a day or even more. Every time it starts I get that screen that asks me to update FileZilla to latest version, but since I’m using portable version of it it’s almost impossible to do so since portable versions are often delayed etc. The same nag screen is there with the non-portable version of FileZilla and sometimes you simply don’t want to upgrade.

Disabling updates in settings simply doesn’t work and will remind you that there is an update even if this is disabled every time you start it.

FileZilla-disable-updates

To solve the problem first make sure that FileZilla is closed. Then locate it’s config file at:
..\appdata\roaming\filezilla\filezilla.xml or for portable version located at: ..\data\settings\filezilla.xml.

Open that file for editing (use some advanced editor like Notepad++ or Sublime) locate the line with value starting with: <Setting name=”Update Check New Version”>
and delete that entire line.

FileZilla-disable-updates2

Save the changes. And that’s it. Now you can use your FileZilla or FileZilla Portable without that update nag screen and you can choose whether you want to update it and when.

 

This post helped you out?
Why not buy me a coffee?


Amount
Your message for me

How to solve wp-cron.php high CPU usage?

It is known that wp-cron.php file can cause high CPU usage on high traffic WordPress sites. This can also occur on sites hosted on shared or VPS hosting when they receive more traffic than usual at short period of time (traffic spikes).

Typically, every page load calls wp-cron.php to be executed and to run any tasks that are scheduled to be executed (like posting scheduled posts, plugin or theme updates, clearing caches on various caching plugins, sending email notifications etc). This basically asks WordPress: Is it time do do anything now? And then WordPress checks for pending tasks and if there’s nothing to do typically answers with: sorry, but there’s nothing to to at this moment… Try a bit later… and this probably happens in 99% cases. So this wp-cron.php literally nags WordPress all the time with those requests. On low traffic sites, this is perfectly fine but on high traffic sites (or sites with traffic spikes) this can cause higher resource usage, make problems with your hosting (vps/server) and decrease your site performance.

Best way to prevent this wp-cron.php activity is to stop it from running the default way (on every site visit) and then just run it using cron when according your needs.

To stop WordPress from executing wp-cron.php after every page visit, simply add this single line to the end of your wp-config.php file:

define('DISABLE_WP_CRON', 'true');

That’s it! This will lower the CPU/resource usage instantly. But it’s not recommended to never execute wp-cron.php since your WordPress plugins and themes won’t be updated and your scheduled posts won’t be posted etc.

Here is the commands that you can use to run wp-cron.php using a real cron:

/usr/bin/wget -q -O - http://www.yoursite.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1

There’s no general rule as for the frequency of this cronjob since every site and setup is different. Everything from once per day to every minute is fine but it really depends on your system. If you have tasks that run every 10 or 15 minutes you should probably setup cron to run every 5 minutes. It’s still quite frequent but it won’t happen that you get several cron runs in couple of seconds.

To setup cron at cPanel hosted site login at cPanel, click on Cron Jobs icons and there add a new cronjob like this:

wp-cron-fix

This post helped you out?
Why not buy me a coffee?


Amount
Your message for me

How to enable mod_deflate on Apache 2.4?

Compressing data like html, js, css before transmitting them to the visitors can speed up your sites and save you bandwidth. Recently I have updated Apache on one server from version 2.2 to 2.4 but my mod_deflate rules won’t work any more (because of changes in the new version of Apache).

Here are my old mod_deflate rules I used on Apache 2.2:

<IfModule mod_deflate.c>
<IfModule mod_setenvif.c>
<IfModule mod_headers.c>
SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
</IfModule>
</IfModule>

<IfModule filter_module>
FilterDeclare COMPRESS
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/html
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/css
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/plain
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/xml
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/x-component
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/javascript
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/json
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/xml
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/xhtml+xml
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/rss+xml
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/atom+xml
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/vnd.ms-fontobject
FilterProvider COMPRESS DEFLATE resp=Content-Type $image/svg+xml
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/x-font-ttf
FilterProvider COMPRESS DEFLATE resp=Content-Type $font/opentype
FilterChain COMPRESS
FilterProtocol COMPRESS DEFLATE change=yes;byteranges=no
</IfModule>

<IfModule !mod_filter.c>
# Legacy versions of Apache
AddOutputFilterByType DEFLATE text/html text/plain text/css application/json
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE text/xml application/xml text/x-component
AddOutputFilterByType DEFLATE application/xhtml+xml application/rss+xml application/atom+xml
AddOutputFilterByType DEFLATE image/svg+xml application/vnd.ms-fontobject application/x-font-ttf font/opentype
</IfModule>
</IfModule>

And here’s my new Apache 2.4 code that enables mod_deflate compression:

<IfModule mod_deflate.c> 
SetOutputFilter DEFLATE 
SetEnvIfNoCase Request_URI \.(?:gif|jpg|png|ico|zip|gz|mp4|flv)$ no-gzip 
</IfModule>

Nice and easy! You can add other extensions you do not want to compress to the list above and that should be it!

cPanel/WHM users should login to WHM then go to Service Configuration -> Apache Configuration -> Include Editor then locate Pre VirtualHost Include on the page and select All Versions from the list (or current version of the Apache in my case 2.4.10).

apache-2.4-mod-deflate1

Then simply copy paste the code above into the box, save and restart the Apache service.

apache-2.4-mod-deflate2

Note: The process is same for Apache 2.2 just use the appropriate code from above.

This post helped you out?
Why not buy me a coffee?


Amount
Your message for me

MP4 streaming using Apache + WHM/cPanel

Streaming MP4 files with Apache + h264_streaming has never been easier. Setup your web server to stream MP4 files using Apache in just 3 minutes.

cd /usr/local/src
wget http://h264.code-shop.com/download/apache_mod_h264_streaming-2.2.7.tar.gz
cd mod_h264_streaming-2.2.7
./configure --with-apxs='which apxs'
make && make install

Non WHM/cPanel users
Should now add those two lines into httpd.conf:

LoadModule h264_streaming_module /usr/local/apache/modules/mod_h264_streaming.so
AddHandler h264-streaming.extensions .mp4

and simply restart Apache using:

service httpd restart

WHM/cPanel users
Should use Include Editor since any changes made to httpd.conf will be lost in case of rebuilding apache.
So login to WHM and go to Apache Configuration -> Include Editor -> Pre Main Include -> All Versions and in the box that appears copy/paste following two lines and after saving that confirm Apache restart.

LoadModule flvx_module modules/mod_flvx.so
AddHandler flv-stream .flv

Here are a few pictures for newbies so they can find their way trough more easily:

1. Apache Configuration
2. Include Editor
apache include editor whm cpanel

3. Locate PreMain Include – select All Versions
4. Copy/paste those two lines and press Update (then confirm Apache reload)
h264-streaming-module

That’s it!

FLV Streaming using Apache
To learn how to setup FLV streaming using Apache click here

This post helped you out?
Why not buy me a coffee?


Amount
Your message for me

DigitalOcean vs. Linode

I’ve seen numerous DigitalOcean vs Linode reviews but for some reason people always made these tests with the cheapest plans. For my review and my tests I’ve decided to use slightly bigger plans – with 8GB of RAM on both  – and see what comes up. Both plans are priced at $80/month (billed hourly). Before we go take a quick note on the terminology: a DigitalOcean VPS is called a “droplet” while Linode’s one is called a “linode” 🙂

Offer
DigitalOcean offers:
– 8GB or RAM
– 4 CPU cores
– 80GB of SSD disk space
– 5TB of bandwidth
– 1Gbps network connection

Linode offers:
– 8GB of RAM
6 CPU cores
192GB of SSD disk space
8TB of bandwidth
– 1Gbps network connection

So clearly Linode offers more for the same price: more than a double of disk space, 2 more CPU cores and more bandwidth. This is probably due the fact that they have released their offer after DigitalOcean so that’s some healthy competition right there.

Hardware
Before we start let’s talk a bit about hardware used by those two companies. DigitalOcean at Amsterdam NL (AMS-3) droplets use Intel Xeon E5-2630L v2 at 2.4 GHz. On the other hand a Linode at London shows Intel Xeon E5-2680 v2 at 2.80GHz. So Linode should have a slightly better processor and should get more processing power for the same amount of money. Other than processor, there isn’t a way to detect the type of memory or SSD drives used.

Note:
DigitalOcean at Netherland’s AMS-1 location “hides” their CPU model behind “QEMU Virtual CPU version 1.0” clocked at 2 GHz. So this is one more reason to choose AMS-3 over AMS-1.

Virtualization
DigitalOcean utilizes KVM virtualization while Linode uses Xen.

Control Panel
While DigitalOcean have a minimalist approach to their control panel it lacks some important functions: for example you can’t see how much bandwidth have you spent (not that they care since they do not charge if you go over the monthly limit), you can’t have more than one IP allocated to a single droplet, plan upgrades and downgrades can be really complex to do and time consuming creating a significant downtimes.
Linode is clearly more feature rich platform. They will provide you much better charts and more options. Their Control Panel is more geeky and their SSH in web console works much better and faster compared to one at DigitalOcean, you can buy and assign extra IPs to your linode, you will get an email if your linode is under high load and it can be even auto rebooted in case it hangs.

Aditional Services
DigitalOcean offers backups at the cost of +20% on the droplet monthly price. They also offer free DNS hosting and that’s about it. Linode offers backups (at the same price +20%) and free DNS hosting but beside that they also offer some interesting features like Monitoring, Load Balancing and Fully Managed Service (at $100/month per account for all liodes you have).

OS Choices
DigitalOcean offers CentOS, CoreOS, Debian, Fedora, Ubuntu as well as preinstalled applications (Ruby on Rails, WordPress, LAMP, LEMP, Django, MEAN, NodeJS, Ghost, GitLab, Docker, Drupal, Dokku, Magento, Redmine). Linode offers: Arch Linux, CentOS, Debian, Fedora, Gentoo, openSUSE, Slackware, Ubuntu but they also offer lot more settings when creating a new Linode (from partition setup to kernels).

Setup Time
DigitalOcean is clearly a winner: they will have your droplet created in 55 seconds and process is really easy. While the same thing on Linode takes few more minutes and is somewhere complicated: you first create a new linode and then deploy an OS while at DigitalOcean it’s done at once.

Geo Locations
At Linode you can deploy at United States (Dallas TX, Fremont CA, Atlanta GA and Newark NJ), United Kingdom (London) and Japan (Tokio) while Digital Ocean on the other hand offers droplets at United States (New York NY, and San Francisco CA), United Kingdom (London), Netherlands (Amsterdam) and Singapore. Linode has better offer of locations in US but they lack Netherlands as really important European location.

Uptime and Stability
I’ve been using DigitalOcean since Feb 2013 and I haven’t noticed any major downtime. In case of some works or scheduled maintenance they send on time emails and they really keep the downtime minimal. I’ve been using Linode for a few months and they also seem stable and reliable. So they are both stable and unlike many people claim that they would never host “mission critical” stuff on DigitalOcean for a reason, I’m doing exactly that since Feb 2013 without any problems. Even this site is hosted on DigitalOcean since then.

Support
In the start DigitalOcean support was really helpful bur recently the quality of their support is bit lower, but on the other hand they offer amazing amount of tutorials and really a helpful community. Linode is famous for their good support and I’ve also found really really helpful community on their IRC (almost like a unofficial live chat support).

Performance
Linode should have better performance than DigitalOcean because of the more powerful processor and more cores available. But is faster? Well, actually no! I’ve used ServerBear’s benchmarks  (one newly created CentOS 7 dorplet/linode) and here are the results I’ve got:

Linodes single core UnixBench score is 516.6 vs 1,235.7 for DigitalOcean. At a single core level a DigitalOcean is almost twice faster than Linode. This is really interesting and totally unexpected result!

But Linode has 6 cores and DigitalOcean has only 4 so it will be faster anyway, right? More cores means more power, right? WRONG!!!

Even though DigitalOcean has 50% less cores their total score is 50% better than Linode’s (2,154 compared to 3,356) meaning that every single DigitalOcean CPU core performs 100% faster than every single Linode’s core. And that’s another unexpected result! This is also very odd and might suggest that Linode is oversold or something but I’m really not sure.

If you don’t trust me take a look at the results your self:
Linode-8gb-unixbench

DigitalOcean-8GB-unixbench

What about IO performance? Who’s got faster SSDs? My results show that read performance is pretty close while write performance almost twice faster on Linode:

DigitalOcean:
Timing cached reads: 16442 MB in 2.00 seconds = 8233.03 MB/sec
Timing buffered disk reads: 1070 MB in 3.00 seconds = 356.62 MB/sec

Linode:
Timing cached reads: 18408 MB in 1.98 seconds = 9298.57 MB/sec
Timing buffered disk reads: 2142 MB in 3.00 seconds = 713.35 MB/sec

But, ServerBear tests show that Linode IO is way much faster:
DigitalOcean-IO-speed

Linode-IO-speed

Network speeds are pretty close so we can call them even.

Complete Benchmark Results
Click on a links below for complete benchmark results:
– DigitalOcean: http://serverbear.com/benchmark/2014/11/29/GCJgYYuCapGFxUfV
– Linode: http://serverbear.com/benchmark/2014/11/29/bffAscAzM9j8mZSl

Conclusion
Things aren’t always as they might seem. Even Linode has slightly better processor and twice more cores my benchmark results showed that it’s not faster than DigitalOcean. In fact it’s almost 50% slower. On the other hand Linode IO performance of is twice (or more) times better than IO performance of DigitalOcean.

My Recommendation
Even both are really good hosting providers and they give a lot for the money I couldn’t say one host is better than another. But here are some general guidelines I came up with that might help you decide:

  1. If you need simple and cheap VPS to play around – DigitalOcean
  2. If you need fast CPU or you are hosting CPU intense application – DigitalOcean
  3. If you need to deploy WordPress, Drupal, Redmine, LAMP or LEMP application – DigitalOcean
  4. If you plan on serving lots of static content – Linode
  5. If you need lots of disk space – Linode
  6. If you need lots of geeky (*nix) functions – Linode
  7. If you like minimalist (Apple) approach – DigitalOcean
  8. If you want it managed and don’t mind paying extra $100/month – Linode
  9. If you need more than one IP – Linode
  10. If you need lots of bandwidth – Linode gives more but DigitalOcean doesn’t charge for overage 😉
  11. If you need to scale up (or down) your plan easily – Linode

In the end – whichever you pick – you’ll be happy with it since they are both really good virtual hosting providers. Compared to regular (non SSD powered) VPS hosts they are both really fast.

This post helped you out?
Why not buy me a coffee?


Amount
Your message for me