Facebook block workaround (and no, it doesn’t involve DNS)

image1

The reason [Source]

It has been a bit hard to reach facebook lately. For some ISP like Viettel and FPT, a DNS change is all it takes to resolve facebook’s IP and restore access to the site. For some other, like EVN and VNPT, here’s what you got

image2

Changing DNS won’t work, which means the rats must have bitten something else. You are forced to use slower methods to overcome this, which could heavily impact your ability to play happy farm 🙁

That’s until I read that facebook still work with SSL (e.g when you replaces http in the address with https you are able to login), but it reverts to http the next time you click a link and you’ll have to do it again. This is especially annoying with games, which uses a lot of redirects to show their ads and stuff (damn, they are greedy).

And so I made something to do the hard work for me, so that I won’t miss the daily login bonuses :p. It’s utterly simple and a bit hard to use  but it does the job.

The code

Make a form that looks like this

image3

Write these to the form’s code

public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        /// <summary>
        /// Executes when a request is made, it will fix the protocol or anything in
        /// the address if the first check box is checked
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void webBrowser1_Navigating(object sender, WebBrowserNavigatingEventArgs e)
        {
            string Address = e.Url.ToString();
            // Facebook uses some complicated redirection method so we'lll have to ignore this
            if (Address.Contains("redirectiframe.html"))
                return;
            // If it's not from facebook or facebook's cache, just ignore it
            if (!Address.Contains("facebook") && !Address.Contains("fbcdn"))
                e.Cancel = true;
            else
                if (checkBox1.Checked && Address.Contains(textBox1.Text))
                {
                    e.Cancel = true;
                    webBrowser1.Navigate(Address.Replace(textBox1.Text, textBox2.Text));
                }
        }

        /// <summary>
        /// Load facebook on start
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Form1_Load(object sender, EventArgs e)
        {
            webBrowser1.Navigate("http://www.facebook.com");
        }

        /// <summary>
        /// Fixes link after the document is loaded, may break some pages
        /// and creates an endless loop on login so it's not enabled by default
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void webBrowser1_Navigated(object sender, WebBrowserNavigatedEventArgs e)
        {
            if (checkBox2.Checked)
                webBrowser1.DocumentText = webBrowser1.DocumentText.Replace(textBox3.Text, textBox4.Text);
            toolStripTextBox1.Text = webBrowser1.Url.ToString();
        }

        /// <summary>
        /// The go button
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            webBrowser1.Navigate(toolStripTextBox1.Text);
        }

        /// <summary>
        /// Show/hide options
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void toolStripButton2_Click(object sender, EventArgs e)
        {
            groupBox1.Visible = !groupBox1.Visible;
        }

        /// <summary>
        /// Update load progress
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void webBrowser1_ProgressChanged(object sender, WebBrowserProgressChangedEventArgs e)
        {
            toolStripProgressBar1.Maximum = (int)e.MaximumProgress;
            toolStripProgressBar1.Value = (int)e.CurrentProgress;
        }
    }

Usage

Open options, check the first check box and you’ll be able to login, open applications and view photos. Should something breaks, try uncheck the check box and press Go to reload the page.

Choose no when IE asks you this, as images are loaded with http

image4

The second check box corrects the links and images on the page to https, only use this when images are not loading

Alternatively, you con use this to access facebook with its ip address. Try navigate to 69.63.184.143 and have it replace http://www.63.184.143 with https://69.63.184.143 (facebook removes the leftmost part before the first . and replaces it with www when you login)

Here’s the executable

Dvorak 日本語

While most of the stuff I type everyday can be expressed using Latin characters (e.g English and Vietnamese) so I can use Dvorak for them without the need for another keyboard layout. But sometimes I just need to type in a different kind of language, like, what’s the latest くるま model from トヨタ? 😛

The most convenient way to type that in windows is to use the Japanese IME, but the funny part turning on the IME after my Dvorak conversion is I HAVE TO USE QWERTY FOR JAPANESE. It’s easy to say, but it took me 5 friggin’ minutes to figure out why all I can type is あああ 😐

It’s just what happen when you use Windows: every basic function works just fine, but when you want to take it to the next level of customization, something bad happens.

Luckily, I don’t have to abandon my newly learned layout (which I’m getting a better accuracy rate than the old). There’s three ways to do that

Remap your system’s layout

This site show you how and have a nice chart. I found this site first on my search but this have a lot a side effects: First, you have to change your layout back to qwerty and then remap, which could create confusion when you are protecting your user account with passwords (there’s no way you can tell which keyboard layout is in use at the windows logon prompt – a fatal flaw in design I say). Second, this setting is effective system wide, which means non – Dvorak users will never have the chance to share that computer with you.

Remap the IME

Open the MS-IME’s Properties and press the advanced button, you’ll see a mapping table you can edit, just type the Dvorak combination in place of the qwerty ones already there and you can type Japanese, but what happen if you want one or two Romani character in between? This won’t work 😐

image

There’s nothing a hack won’t fix

There’s a setting in the registry that will let you change the keyboard mapping file for a specific IME and it’s buried in

HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlKeyboard Layouts

There you will find a bunch of hexadecimal keys, each correspond to a specific IME: Slovak, US, Dvorak, Japanese, Korean… you name it! The code for Japanese (MS-IME 2002) is E0010411, go there and change the value of “LayoutFile” from kbdjpn.dll (actually a qwerty map) to kbddv.dll (Dvorak map) and restart your computer (This is the only way to restart the IME).

If that didn’t work (Microsoft may as well hiding some other option which will override what you have just overridden somewhere else, oh well…), you may need to go to %systemroot%system32 and copy the kbddv.dll over kbdjpn.dll itself, then restart.

Yup, that’s what I did to get what I wanted – type 日本語 with ドヴォラック :P.