How do I refresh the hosts file on OS X?

Ever wanted to block certain hosts on your MAC and then simply clear DNS cache. It’s actually fairly easy. This brief tutorial is for OSX 10.9+.

1. Open your TERMINAL (Launchpad > Other > Terminal).

2. To edit your hosts file simply type in:

sudo vim /etc/hosts

3. Type “i” to insert or edit the hosts file.

4. Lets say we wanted to block ads from this particular domain: pubads.g.doubleclick.net. The format would go as follows:

0.0.0.0 pubads.g.doubleclick.net

You can also do this localized format as well:

127.0.0.1 pubads.g.doubleclick.net

5. Once you are happy with the changes click “esc” on your keyboard. Then :wq

That’s is, you have now edited your hosts file on your MAC.

6. We now need to flush the DNS. In your terminal type in:

sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

Hopefully, this helps someone to block porn, social network, gambling and so on. If you don’t have a list, there is a great community that grabs information from adaway.org, mvps.org, malwaredomainlist.com, someonewhocares.org, yoyo.org, and potentially others to create their lists. Have a look by clicking this > hosts file that is updated.

How do I load a sql.gz file to my database? (importing)

Many of us use phpmyadmin to utilize any sort of importing and exporting of MySQL databases. But what if there was an easier way and faster solution. You will need SSH access to your VPS or dedicated server box. Its a one liner:

zcat /path/to/file.sql.gz | mysql -u ‘root’ -p ‘password’ your_database

zcat = decompresses the data of all the input files, and writes the result on the standard output. zcat concatenates the data in the same way cat does. The names of compressed input files are expected to end in .Z, .gz, or .bz2.

path = you must know full path of your sql file

-u username = in this example we are using root as the username, however you can use a username of your particular mysql that you are importing.

-p = is the password for your username above

your_database = name of the database where you are importing your sql.gz file.

That’s it, fairly simple. If you run into any issues don’t hesitate to contact us.

Run OPTIMIZE TABLE to defragment tables for better performance

If you are noticing slugging performance wits your MySQL database, this simple tutorial is for you. This is particularly important for websites that have a large MySQL database. Please note that you must have root access and SSH access to proceed further. Log into your web hosting via SSH and follow below.

Run this command:

Code:

mysqlcheck -u root –auto-repair –optimize –all-databases

If you notice issues you can fix tables by issuing:

Code:

mysqlcheck -A -r -p

If everything has been fixed it is highly recommended to restart your MySQL server:

/etc/init.d/mysql restart

That is all, you should see increase in your MySQL queries and of course better performance.

Renewing or installing Universal SSL on Mail – Dovecot

If you are providing a universal SSL to your mail server, you will need to install an SSL and of course properly link it from your Dovecot configuration file.

This is not a guide how to achieve above but more of what to do after you have successfully installed an SSL. Your Dovecot will hang on to the old SSL certificate until your restart it. Last step people seem to forget and spend endless hours trying to figure out what went wrong in regards to installation or renewal of the SSL certificate. But really all Dovecot needs is a restart.

Service dovecot restart

That’s it!. You will notice your new SSL actually kick in and start to work again.

iOS 10.2 Jailbreakers Avoid

According to multiple sources iOS 10.2 has closed all the kernel vulnerabilities that were available. If you have any hope to jailbreak your iDevice on iOS10, simply upgrade to the last version that appears to be jailbreakable which is 10.1.1. As of right now its still signed and its possible to downgrade if you made a mistake and jumped on 10.2.

iPhone stuck in reboot loop (iOS9)

I installed BiteSMS (for iOS 7) by accident. And my iPhone got stuck in the infamous reboot loop. You will notice your phone reboot, and you will see Apple logo, and eventually after 60 seconds it will reboot again and so on. Here are suggested solutions that I have attempted:

1. Hard Reset – Holding power and home button. Result: same Apple reboot cycle.

2. ReiBoot – Excellent software that lets you Enter and Exit Recovery mode. Result: same Apple reboot cycle.

I was running out of ideas. Then I read somewhere that you can by-pass Cydia substrate by holding Volume UP until you actually see your phones lock screen. Result: SUCCESS

Once I was in, I was able to get into Cydia, and I unstainstalled BiteSMS. Then I held the power button and shutdown and rebooted thereafter. All was back to normal.

I hope this helps someone who wants to preserve their jailbreak. This was performed on iOS 9.0.2.

How to leverage browser caching

What is browser caching?

Every time a browser loads a webpage it has to download all the web files to properly display the page. This includes all the HTML, CSS, JavaScript and images.

Some pages might only consist of a few files and be small in size – maybe a couple of kilobytes. For others however there may be a lot of files, and these may add up to be several megabytes large. Twitter.com for example is 3 MB+.

The issue is two fold.

These large files take longer to load and can be especially painful if you’re on a slow internet connection (or a mobile device). Each file makes a separate request to the server. The more requests your server gets simultaneously the more work it needs to do, only further reducing your page speed.

Browser caching can help by storing some of these files locally in the user’s browser. Their first visit to your site will take the same time to load, however when that user revisits your website, refreshes the page, or even moves to a different page of your site, they already have some of the files they need locally.

This means the amount of data the user’s browser has to download is less, and fewer requests need to be made to your server. The result? Decreased page load times.

Here’s something you can add to your apache htaccess file and see if it improves loading times for you:

 

##EXPIRES CACHING
ExpiresActive On
ExpiresByType image/jpg “access 1 month”
ExpiresByType image/jpeg “access 1 month”
ExpiresByType image/gif “access 1 month”
ExpiresByType image/png “access 1 month”
ExpiresByType text/css “access 1 month”
ExpiresByType application/pdf “access 1 month”
ExpiresByType text/x-javascript “access 1 month”
ExpiresByType application/javascript “access 1 month”
ExpiresByType image/x-icon “access 1 year”
ExpiresDefault “access 1 week”
##EXPIRES CACHING

Let us know what you think?

EDIT: Its actually ##EXPIRES CACHING no need to have # after caching.

Nokia Lumia 920 Update to 8.1 Cyan (scrolling fix)

If you had updated from Black version to Cyan (8.1), you might notice a scrolling issue especially in the middle of the screen. You may observe a line across the screen (as if the pixels are getting stuck). I haven’t dug deeper into the issue, however there is an easy fix to this problem. If you do a phone reset from your “about” menu. Keep in mind that you will loose all information on your phone. BACKUP prior processing the phone reset.  When the reset is complete, download and restore all your applications, photos, etc. You will notice that the problem is gone. I’m curious what causes it though, I wish I looked into it deeper.

Deregister – Unregister – Turn Off iMessage

You must have seen different tips and tricks on how to turn-off iMessage. Believe me I have tried them all and none seem to work. Those who still had iPhones/iDevices who tried to contact me via iMessage had their messages either go through or bounce back. The system rarely diverted them to me via SMS. Therefore, I lost a lot of incoming and probably some friends along the way:)

Needless to say after many complaints Apple actually released a tool that works.

1. Go here: https://selfsolve.apple.com/deregister-imessage

2. Type in your phone number

3. Receive a 6 digit text message and type that into the browser

DONE!

Enjoy cutting the final strings from Apple 😉

PRO TIP: The link only works via browser. If you try with your handheld, it will load, but it will not send you a text message after you type in your phone number. Go figure. Use a fully functional laptop.

MacBook Pro: Bootcamp Windows 7 Ultimate – Mouse – Keyboard lock-up

I’ve been running Microsoft Windows 7 Ultimate on my MacBook Pro Late 2013 for at least 4 months. I’ve installed many applications on it, and had absolutely no issues. One day I went to boot it up and my mouse/keyboard would not function. I was stuck on the login/password (Windows 7 screen). I thought it was a fluke, I rebooted and same exact issue. I tried safe mode, and encountered same problem. I then attached a usb keyboard and mouse….still nothing. I was baffled. Nothing worked. I tried booting with PE, custom O/S’s that I have compiled, and still same issue. It didn’t make sense.

After messing around with it (on and off) for a few hours. I found a temporary solution. When you are about to boot into Windows 7 click F8. This will give you an advance boot up menu. And select the very last option “Disable Driver Signature Enforcement”.

My mouse and keyboard functioned once again. Here’s the fun Windows part, I can’t permanently disable Driver Signature Enforcement. By default it will not let you override it (at least I haven’t figured out a way to do so). OK, whats next? Well sign the drivers that need signing. However, I’m unsure what drivers are causing this as I haven’t installed any new unassigned drivers. I installed the latest version of bootcamp to see if that would fix it, however I’m back to F8.

Who is to blame? Microsoft? Apple? Or both….I’m going with both this time around.

Hope this helps someone who is stuck on a frozen Windows 7 username/password screen.