Fix the errors of GitHub Metadata and SSL certificate when running Jekyll serve

I decided to play with Jekyll today. It is an amazing static site generator. I ran local server by execute this command:

$> jekyll serve

I could browse my site locally then. When I had updated one of my files, Jekyll stated regenerating the output HTML file and I got this errors on the command line window.

GitHub Metadata: No GitHub API authentication could be found. Some fields may be missing or have incorrect data.

Error: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed

Error: Run jekyll build –trace for more information.

As I am not familiar with Ruby, it took me an hour to investigate and fix this problem. Actually, there are one warning and one error in the message above.

GitHub Metadata warning

GitHub Metadata is a gem required by Jekyll. We need a GitHub personal token to make it work. Follow the excellent guide on GitHub to create a token, copy it to a safe place.

Now, create new environment variable in your system named JEKYLL_GITHUB_TOKEN with the value pasted from the created token. Open a new instance of command line and make sure this command displays correct information (I use Windows machine).

$>echo %JEKYLL_GITHUB_TOKEN%

You can read more at the GitHub Metadata README file.

OpenSSL default certificate error

Please do not do these steps in a production server!

Now, down load the .pem file from https://curl.haxx.se/ca/cacert.pem. Then, create another environment variable called SSL_CERT_FILE pointing to the location of downloaded .pem file.

Open new instance of command line window and run this command, be sure that there is no error now.

$> ruby -rnet/https -e "Net::HTTP.get URI('https://github.com')"

Conclusion

With the steps above, I resolved my problems with Jekyll server command. If you try and find any trouble with them, please let me know by leaving comments at the bottom of the post.

Install nodejs 4 on 64-bit Windows machine

Yesterday, I met a problem when installing Nodejs 4 on my 64-bit Windows 7 machine at the company. The installer exited with an error message telling me that:

There is a problem with this Windows Installer package. A DLL required for this install to complete could not be run. Contact your support personnel or package vendor

I tried with both 32-bit and 64-bit versions of all Nodejs version from 4.0.0 to 4.2.1 but with no luck. I tried the `msiexec` command line to get the log file and posted to Nodejs repository to find any ideas from the community. The content of the log file is:

=== Logging started: 10/19/2015  13:44:59 ===
Action start 13:44:59: INSTALL.
Action start 13:44:59: SetInstallScope.
CustomAction SetInstallScope returned actual error code 1157 (note this may not be 100% accurate if translation happened inside sandbox)
Info 2898.For WixUI_Font_Normal textstyle, the system created a 'Tahoma' font, in 0 character set, of 13 pixels height.
Error 1723. There is a problem with this Windows Installer package. A DLL required for this install to complete could not be run. Contact your support personnel or package vendor.  Action SetInstallScope, entry: SetInstallScope, library: C:\Users\CODEFO~1\AppData\Local\Temp\MSI7073.tmp 
MSI (c) (78:E4) [13:45:04:065]: Product: Node.js -- Error 1723. There is a problem with this Windows Installer package. A DLL required for this install to complete could not be run. Contact your support personnel or package vendor.  Action SetInstallScope, entry: SetInstallScope, library: C:\Users\CODEFO~1\AppData\Local\Temp\MSI7073.tmp 

Action ended 13:45:04: SetInstallScope. Return value 3.
Action start 13:45:04: FatalError.
Info 2898.For WixUI_Font_Bigger textstyle, the system created a 'Tahoma' font, in 0 character set, of 19 pixels height.
Action ended 13:45:05: FatalError. Return value 2.
Action ended 13:45:05: INSTALL. Return value 3.
=== Logging stopped: 10/19/2015  13:45:05 ===
MSI (c) (78:E4) [13:45:05:193]: Windows Installer installed the product. Product Name: Node.js. Product Version: 4.2.1. Product Language: 1033. Manufacturer: Node.js Foundation. Installation success or error status: 1603.

Finnaly benjamingr gave me a suggestion that solved the problem. I cleared my Temp folder ignoring any busy files and reran the x64 installer (the node-v4.2.1-x64.msi file). The new version of Nodejs and NPM installed successfully:

$> node -v
v4.2.1
$> npm -v
2.14.7

My original issue on GitHub here.

Solve the Akismet problem with CloudFlare SSL

Askimet over SSL

Today, I’ve spent time on diving in the solve the problem when using Akismet anti-spam plugin over the HTTPS with the setup using CloudFlare flexible SSL.

Problems

Akismet is one of most common anti spam plugin used in WordPress. I’ve used this plugin for years and really been satisfied with it. The problem occurs when I put this blog after the CloudFlare CND services and enable its flexible SSL support.

The first thing I’ve tried is install the CloudFlare flexible SSL plugin for WordPress. After that, most of problems was resolved but one. My Firefox still gives me a notification that their are some mixed content on my site, which means some of my resources were loaded from unsecured  protocol. I opened the web console and realized that the Akismet js file is still hosted over non-SSL domain.

[blocked] The page at ‘https://www.hieule.info/’ was loaded over HTTPS, but ran insecure content from ‘http://blog-static.hieule.info/wp-content/plugins/akismet/_inc/form.js’: this content should also be loaded over HTTPS.

I tried to install many HTTPS forcing plugins from WordPress repository but nothing helps.

The reason

The reason why the CloudFlare flexible SSL plugin works for other resources but the Akismet ones is the order WordPress loads its plugins. The CMS sort active plugins by their names before saving into the database and load the plugin using that order. Therefore, the Akismet was loaded before the CloudFlare flexible SSL, and all of Akismet resources was still using the non-SSL domain.

My working solution

The most easy way is install a WordPress plugin to customize the loading order of the CMS active plugins. I can find this plugin and confirmed that it works correctly. However, I do not want to install too much plugin into my WordPress installation. I tried to change the order of active plugin right before they are saved to the database. Fortunately, WordPress support the active_plugins hook called right there. I add these lines of code into my functions.php in my theme:

function pureclean_sort_plugins() {
    $active_plugins = get_option('active_plugins');
    $this_plugin = 'cloudflare-flexible-ssl';
    $this_plugin_key = array_search($this_plugin, $active_plugins);
    if ($this_plugin_key) { // if it's 0 it's the first plugin already, no need to continue
        array_splice($active_plugins, $this_plugin_key, 1);
        array_unshift($active_plugins, $this_plugin);
        update_option('active_plugins', $active_plugins);
    }
}
add_action("activated_plugin", "pureclean_sort_plugins");

Finally, deactivate a plugin and reactive it to make these code work (don’t forget this step). The problem was resolved.

References:

PHP pthreads extension for windows x64 system

Today, I have practiced with the multithread interface of PHP with the support of this POSIX pthreads extension. However, I cannot find a version for my development environment, which is built with VC++ 9.0 compiler in 64-bit system. Therefore, I have built this extension for myself and share it here for any one need it. I have tested and used this library successful in my environment.

You can download it here: https://www.mediafire.com/?r8f5t4agde8ikvd

After download this binary, extract in a new folder and copy files to your php binary folder as normal way. Remember to add extension=php_pthreads.dll to your php.ini file to load this library.

How I fix the TF30167 Error when creating new team project in VS2010

Hello everyone! Today, I am going to tell you how I can fix the TF30167 error when creating a new team project in Visual studio 2010. There are many things can be the reason for this ugly error. The way I solved the problem may or may not successfully applied to your case. However, I think you should give it a try.

The situation

I need to create a new team project under this condition:

  • Visual Studio 2010 SP1 on Windows 8.
  • Team Foundation Server 2010 with an account belonging to the Project Collection Administrator group.
  • Using MSF for Agile Software Development v5.0 template

In fact, I cannot create the project and receive this error:

Error

TF30167: The New Team Project Wizard could not finish creating the project Testing project.

Explanation

The following unexpected error was encountered while creating the team project: TF30229: Failure retrieving user information.

User Action

Restart Visual Studio and run the New Team Project Wizard again. If the problem persists, contact your Team Foundation Server administrator

What I did?

The solution is very simple. First, read this article from MSDN carefully and be sure that you have satisfied all requirements. If the TF30167 error cannot be eliminated, try to disable your antivirus for a while when creating the team project. I have disable the Avast and everything go like a charm!

See the video below for more details

Solve the “Denied access” problem when using Wamp server 2 on Windows 8

After installing the Windows 8 Consumer Preview (I’ll post a article about its UX soon), I cannot access my localhost as well as all of my local web folders. For more specific, I met these error notice

Access denied on localhost when using Wamp server 2 on Windows 8
Access denied on localhost when using Wamp server 2 on Windows 8

Fortunately, I finally found the way to solve this problem (although I still don’t know why it happens now).

Quick fix on Apache httpd.conf and alias configuration files

First, open the httpd.conf file of your apache version by a text editor such as Notepad or Notepad++. It’s usually located at \wamp\bin\apache\<your apache version>\conf\httpd.conf or you can use the quick menu of Wamp manager to open it. Find these snippet before modify it:

# First, we configure the "default" to be a very restrictive set of 
# features.  
#
<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>

Replace the Deny from all with Allow from all and save the file.We have not finished yet. Find another snippet:

#   onlineoffline tag - don't remove
    Order Deny,Allow
    Deny from all
    Allow from 127.0.0.1

Replace Deny from all with Allow from all again. The localhost runs correctly now.After do all above thing, I believe that you can locate to localhost and your local web project with your browser. However, if you navigate to https://localhost/phpmyadmin, you will continue getting the Forbidden error. The reason is you did not modify the alias configuration file to allow access from your localhost. Let open this file by using Wamp manager or finding it in \wamp\alias\phpmyadmin.conf, find this snippet

<Directory "c:/wamp/apps/phpmyadmin3.4.10.1/">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
        Order Deny,Allow
    Deny from all
    Allow from 127.0.0.1
</Directory>

Change Allow from 127.0.0.1 to Allow from ::1 or you can do as above, change Deny from all into Allow from all. Now, that’s all.

See how I did it with a video

You can see this video on youtube to see how I solved this problems more clearly.

Fix yahoo messenger and windows 7 gadget display error

The error manifestation

After a period of using Windows 7 or Yahoo! Messenger (Y!M), you can catch an error like this:

  • Your desktop gadgets doesn’t work and they display incorrectly
  • In the conversation window of Y!M, you cannot see either your or your partner ‘s words.

In this post, I will introduce you some ways to fixed this annoying error.

Cause of the error

There are many reasons why this evil thing happen to you. The corruption of windows registry, sidebar files or some .dll files as well as the existence of a virus can be the main factor. As a general rule of thumb, you should try from the easiest fix.

First thing to check: your windows files

Begin with your sidebar files. You can copy these file from another computer running windows 7 (of course, it current runs normally ) and paste them to the appropriate location in your one. Here, I suppose that you installed you windows in the C drive.

C:\Program Files\Windows Sidebar\sidebar.exe
C:\Program Files\Windows Sidebar\wlsrvc.dll
C:\Program Files\Windows Sidebar\Gadgets\*
C:\Windows\System32\jscript.dll
C:\Windows\System32\vbscript.dll

Restart your computer and hope this help.

The windows .dll files error

This is also a common error of windows, you can re-register your windows .dll files to solve this problem. Open your Start menu, click Run… (or use the shortcut key “Windows key” + “R”). In the new “Run” dialogue, enter the command regsvr32 jscript.dll and click OK button, if another dialogue appears, click OK to ignore this message. Do them same thing with the command regsvr32 vbscript.dll before restarting your computer.

Check the windows registry problem

In the case that this error haven’t been solved yet, you have to check you windows registry. First, open the Registry Editor by entering the command regedt32 to the Run windows as the previous section. After the Registry Editor windows appears, you can see that it looks like the Windows Explorer windows.

Point to the key HKEY_LOCAL_MACHINE\SOFTWARE\CLASSES\CLSID\{f414c260-6ac0-11cf-b6d1-00aa00bbbb558}\In procServer32. Look at the right panel, if the data of (Default) values is different from C:\WINDOWS\SYSTEM32\JSCRIPT.DLL, modify it to correct value.

Next, go to another key HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\. Look at its sub keys in the left panel. If you see a strange sub key whose name is a character like the “L” letter above the 0 sub key, delete the strange sub key. Restart your computer.

The last thing I can help

If things still go wrong, you can download my pre-built bat file and run it on your computer.