Monday, November 30, 2015

Cannot Start VirtualBox Virtual Machine after an Upgrade

Having upgraded Oracle Virtualbox on a Windows host, I found that I could not start any Virtual Machine instances. VirtualBox displays a dialogue window with the error message shown below,



Examining the virtual machine log file, i.e., Logs\VBoxHardening.log in the Virtual Machine instance directory, I found the following error message near the end of the log file,

1660.6c38: supR3HardenedVmProcessInit: Opening vboxdrv stub...
1660.6c38: Error opening VBoxDrvStub:  STATUS_OBJECT_NAME_NOT_FOUND
1660.6c38: supR3HardenedWinReadErrorInfoDevice: NtCreateFile -> 0xc0000034
1660.6c38: Error -101 in supR3HardenedWinReSpawn! (enmWhat=3)
1660.6c38: NtCreateFile(\Device\VBoxDrvStub) failed: 0xc0000034 STATUS_OBJECT_NAME_NOT_FOUND (0 retries)

Driver is probably stuck stopping/starting. Try 'sc.exe query vboxdrv' to get more information about its state. Rebooting may actually help.

The message indicates that Windows service vboxdrv, i.e., the Virtual Box Driver has some problem. Following the advice in the log, I issue sc.exe query vboxdrv in a Windows Command Prompt window,

C:\>sc start vboxdrv
[SC] StartService: OpenService FAILED 1060:

The specified service does not exist as an installed service.
C:\>

which indicates that Windows service vboxdrv does not exist. To fix the issue, I reinstalled the driver vboxdrv from the directory C:\Program Files\Oracle\VirtualBox\drivers\vboxdrv. From the Windows GUI, you can right click the VBoxDrv.inf and choose "install".
If the installation is successful and you query the driver status again, you should see something similar below,

C:\>sc query vboxdrv

SERVICE_NAME: vboxdrv
        TYPE               : 1  KERNEL_DRIVER
        STATE              : 4  RUNNING
                                (STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)
        WIN32_EXIT_CODE    : 0  (0x0)
        SERVICE_EXIT_CODE  : 0  (0x0)
        CHECKPOINT         : 0x0
        WAIT_HINT          : 0x0
C:\>

Now I can launch the virtual machine instances.

Friday, October 2, 2015

HTTPS Everywhere Arrives at Blogger!

A couple of weeks ago I wrote a blog post on how we may preserve privacy while browsing the Web. One particular technology that we can rely on is HTTPS, for which, I mentioned The Electronic Frontier Foundation's HTTPS Everywhere browser plugin. See the blog post for more discussion.

Today, I am happy to learn that Google has rolled out the HTTPS support to Blogspot based their blog post released on September 30, 2015.

This is fantastic!

Let us push HTTPS Everywhere!

As indicated in the Google's blog post,

"
Blogspot authors should be aware that if they choose to encrypt at this time, some of the current functionality of their blog may not work over HTTPS. This can be a result of template, gadgets, and blog post content, and is often caused by mixed content errors, some of which may be fixable by the author themselves.
"

If you blog site rely on your own web services that are availed via the HTTP protocol, you may have to make it available via the HTTPS protocol. You actually can obtain free SSL certificates for your web services, at least from two providers at the time this post is written.

Well, having stated the above, although I enabled HTTPS on this blog site, I have not be able to tested all the posts and functionality. Readers, if you happen to spot a "mixed content" error on this blog site, please let me know. I am most appreciative for that.






Thursday, September 17, 2015

Improving Windows Desktop Search for PDF and Other Binary Files

Windows Search, formerly Windows Desktop Search, may not index content and metadata of binary files, such as, those of PDF files without assistance of some additional software although it does index the files based on their names.

To enable Windows Search to index content and metadata of binary files, we need to install some additional software to help the Windows Search. Windows Search supports iFilter. With the matching iFilter add-in installed, Windows Search can index content and metadta of binary files of certain types. The iFilter.org site lists a number of iFilter add-ins for a few types of binary files, e.g., ZIP, CAB, CHM, DjVu, and PDF files.

Below we show how we can enable indexing content and metadata of  PDF files.

First, we can check whether PDF iFilter exists. The following steps are carried out on a Windows 10 host.
  1. Open "Windows Control Panel"
  2. Search and open "Indexing Options"
  3. Open "Advanced" from "Indexing Options" 
  4. Choose "File Types"
  5. Locate the "pdf" file type.



    Above figure shows that "Registered iFILTER is not found", which means that iFilter add-in is not installed and Windows Search do not index content and metadata of PDF files.
To enable indexing content and metadata of PDF files, we can choose and install Adobe PDF iFilter. If the PDF iFilter is installed, repeating the above step, Windows will indicate that the iFilter is intalled as illustrated in the figure below.



 To force Windows Search to index content and metadata of PDF files immediately upon the  installation of the PDF iFilter, we can check and uncheck PDF file types from the "File Types" tab of the "Advanced Options" of the "Indexing Options" as follows,
  1. Open "Control Panel", "Indexing Option", then "Advanced Option", and finally, the "File Types" tab
  2. Locate the "pdf" file type
  3. Uncheck the "pdf" file type
  4. Click "OK"
  5. Window pops up a dialogue window stating "Rebuilding the index might take a long time to complete. Some views and search results might be incomplete until rebuilding is finished." Click "Cancel" on this dialogue window.
  6. Windows will return to "Indexing Option". Now click on "Advanced" again to open the "Advanced Options"
  7. On the Advanced Options, choose "File Types"
  8. Locate the "pdf" file type again
  9. Check the "pdf" file type
  10. Click on "OK" to confirm
  11. Window now pops up again the dialogue window stating "Rebuilding the index might take a long time to complete. Some views and search results might be incomplete until rebuilding is finished." Click "OK" on this dialogue window to confirm. Windows starts rebuilding the index. Depending on the amount files on the disk, it may take a long time to rebuild the index. 
  12. You can safely close the "Indexing Option". Windows index continues to rebuild the index in background.


Thursday, September 10, 2015

Problem with Firefox's Always Openning Web Page Unintended When Creating New Tab

I somehow had a problem described in this post, that is, when I open a new tab in Firefox and the new tab always opens a Yahoo Search page regardless the "When Firefox Starts" and "Home Page" settings in the "Options" menu. I blame myself for not careful when installing software and browsing the web. I am looking for a fix.

Followed the post cited above, I did not find any hidden add-ons. The solution did not work for me although it worked for some according to the comments left on the post.

I eventually have a fix for this problem.

When I open "about:config" and search the word "Yahoo", I find that the setting "browser.tab.newurl" is pointing to a Yahoo search page. After I set the value of the setting as blank, the problem goes away.

By the way, the Firefox discussion forum have some good discussion on related issues.

Where to Buy "Strange" Food Ingredient?

Sometimes when we want to try a new recipe, some food items are nowhere to find in our local grocery stores.  We can always fire up our web browsers and search them on the web. However, next time when we want to reorder the items, the web stores you had good business with somehow become a little difficult to find on the web. This post is a note for those food items. Now when I need them, I just come here.


Purple Sweet Potatoes
Soybeans
Coagulants for Making Tofu
Coagulants for Making Cheese
Sausage Casing
For Baking

GnuCash Encountered System Error while Retrieving Price Quotes

While I was installing GnuCash 2.6.7 on a Windows 10 computer, I encountered a "System Error" while retrieving the price quotes. To be exact, when I opened the "Price Editor" from GnuCash, and attempted to "Get Quotes", GnuCash popped up a dialogue window with the error message "There was a system error while retrieving the price quotes"

By resolving this problem, I have the following observations,
  • GnuCash may still fail to retrieve price quotes even if GnuCash's gnc-fq-check program reports no problem.
  • GnuCash's gnc-fq-update program is designed to install the Finance::Quote Perl module; however, it may not install all dependencies that the GnuCash's Price Editor functionality requires.
  • GnuCash's gnc-fq-helper program can provide additional diagnostic information, such as, missing dependent Perl modules.
Below is a detailed description on what happened and how the problem was resolved.

  1. To install the Finance::Quote Perl module, we run GnuCash's gnc-fq-update program as the System Administrator, e.g.,
    
    C:\Program Files (x86)\gnucash\bin>perl gnc-fq-update
    

  2. To verify that the Finance:Quote Perl module is successfully installed and we can retrieve price quotes online, we run GnuCash's gnc-fq-check, e.g.,

    
    C:\Program Files (x86)\gnucash\bin>perl gnc-fq-check
    ("1.38" "tdefunds" "adig" "bet" "sixshares" "nz" "unionfunds" "romania" "cominvest" "dwsfunds" "asegr" "tiaacref" "seb_funds" "cse" "nasdaq" "goldmoney" "bamosz" "tsp" "yahoo_json" "hungary" "fidelityfixed" "bourso" "yahoo_nz" "usfedbonds" "yahoo_europe" "ftportfolios_direct" "platinum" "hustock" "bse" "bsero" "ukfunds" "aex" "vanguard" "dutch" "tdwaterhouse" "yahoo_brasil" "maninv" "trustnet" "uk_unit_trusts" "yahoo_australia" "morningstarjp" "brasil" "known_currencies" "canadamutual" "deka" "finanzpartner" "fool" "bmonesbittburns" "ftfunds" "yahoo_yql" "finland" "europe" "za_unittrusts" "nzx" "morningstar" "fidelity_direct" "asx" "za" "troweprice_direct" "greece" "lerevenu" "hu" "tsx" "sixfunds" "fetch_live_currencies" "troweprice" "indiamutual" "hufund" "yahoo" "australia" "asia" "usa" "aiahk" "stockhousecanada_fund" "fidelity" "ftportfolios" "vwd" "france" "mstaruk" "canada" "financecanada" "fundlibrary" "tnetuk" "nyse" "yahoo_asia" "citywire" "hex" "amfiindia")
    
    
    

Since gnc-fq-check does not complain that there might be a problem, we would assume that the GnuCash's Price Eiditor functionality should work. In particular, the GnuCash's Online Quotes wiki page does not appear to suggest anything else may have to be performed. However, I encountered the error that "There was a system error while retrieving the price quotes".

Following the GnuCash's Tracefile wiki page, I initially attempted to observe what may have been wrong by examining GnuCash trace files. However, the trace files did not appear to reveal anything useful to me. Finally, a web search yielded a clue that we might be able to find out more using GnuCash's gnc-fq-helper program. Below is what I found out by attempting to retrieve the ticket CSCO's price quote from Yahoo,


C:\Program Files (x86)\gnucash\bin>echo (yahoo "CSCO") | perl gnc-fq-helper
Can't locate Date/Manip.pm in @INC (you may need to install the Date::Manip module) (@INC contains: C:/Strawberry/perl/site/lib C:/Strawberry/perl/vendor/lib C:/Strawberry/perl/lib .) at gnc-fq-helper line 33.
BEGIN failed--compilation aborted at gnc-fq-helper line 33.

that clearly indicated that the Date::Manip Perl module was missing. Then the fix is to install the Perl module, e.g., invoking Perl shell as the System Administrator as follows,

C:\Program Files (x86)\gnucash\bin>perl -MCPAN -e shell
cpan> install Date::Manip

Now let us run the gnc-fq-helper and attempt to retrieve the ticket CSCO's price quote from Yahoo again. The gnc-fq-helper stopped complaining and successfully retrieved the price quote.

C:\Program Files (x86)\gnucash\bin>echo (yahoo "CSCO") | perl gnc-fq-helper
WARNING: the TZ Date::Manip config variable is deprecated
         and will be removed in March 2016.  Please use
         the SetDate or ForceDate config variables instead.
(("CSCO" (symbol . "CSCO") (gnc:time-no-zone . "2015-09-09 16:00:00") (last . 25.94) (currency . "USD")))

This experience is actually another time that the gnc-fq-helper program saves the day. In the past, I encountered a similar problem, but with a different error message.

Tuesday, September 8, 2015

Collection of Software Tools for Protecting Privacy on the Web

This is a collection of software that we can use to protect privacy and maintain anonymity when browsing the Web.

  • Tor browser. Stated on its web page, "it prevents somebody watching your Internet connection from learning what sites you visit, it prevents the sites you visit from learning your physical location, and it lets you access sites which are blocked." However, the web may appear to be much slower if Tor relays serving you are slow.
  • The Electronic Frontier Foundation's HTTPS Everywhere. A web browser add-on that rewrites HTTP requests from your web browser to HTTPS requests. Stated on its web page, "On supported parts of supported sites, HTTPS Everywhere enables the sites' HTTPS protection which can protect you against eavesdropping and tampering with the contents of the site or with the information you send to the site. Ideally, this provides some protection against an attacker learning the content of the information flowing in each direction — for instance, the text of e-mail messages you send or receive through a webmail site, the products you browse or purchase on an e-commerce site, or the particular articles you read on a reference site.
  •  HTTP Cookie removers.  There are a number of web browser add-on's to remove HTTP cookies, e.g., Ghostery.
  • Flash Cookie removers. There are a number of web browser add-on's to remove Flash cookies, e.g., Better Privacy.
  • Web browsers in private or incognito mode. Modern browsers support "private browsing", e.g., Firefox, Chrome, Opera, Internet Browser, and Microsoft Edge.

Note that the level of privacy and anonymity provided by the above are different. Tor browser perhaps provides the best level of privacy and anonymity, albeit at the cost of higher latency and lower throughput. HTTP and Flash Cookies removers makes trackers, such as, online advertisers' job of tracking an individual web visitor more difficult; however, both operators of the web sites you visit and you internet service providers (ISPs) can still track you, i.e., they know which IP address the traffic is originated, and they both know which pages you are visiting if the traffic is a HTTP session, and the site operators know which page you visiting even if the traffic is a HTTPS session. For the part of web sites supporting HTTPS, HTTPS Everywhere prevents your ISPs' from eavesdropping on which pages you are visiting on a site; however, the web site operators can still know which IP address the page visits are originated and which pages you are visiting.

If you have anything that you want to add, please share with me.

Monday, September 7, 2015

Free SSL Certificate for Securing Email and Websites

I have been looking for free SSL certificates for enabling HTTPS on a few web servers. HTTPS has been promoted by many organizations and individuals because it provides privacy and anonymity to eavesdroppers besides other benefits. The performance penalty of running a HTTPS web server than HTTP counterpart appears to be small.

Finally, I found these two free certificate providers,
Since SSL certificates are for authenticating domains and encrypting network traffic, those who are acquiring the certificates must go through a validation process. The Wikipedia article on Public key certificate has an discussion on it. Based on the rigor of the vetting process during the validation, the validation process are categorized as "Domain Validation", "Organization Validation", and "Extended Validation".

The above free certificates only require "Domain Validation", which is probably the reason that the vendors could provide them for free since the "Domain Validation" can be automated via electronic means, i.e., via emails sent to domain registrants listed in the WhoIs database, or via HTML documents uploaded to websites to be secured.

Modern web browsers typically turn the address bar green if the certificate of a visited website passed Extended Validation.

StartSSL describes the free certificates well on their site as follows,


"
Because the checks are performed mostly by electronic means, they require only minimal human intervention from our side. The validations are here to make sure, that the subscriber is the owner of the domain name, resp. email account. You may find additional information on this subject in our CA policy.

The StartSSL™ Free certificates are intended for web sites which require protection of privacy and prevent eavesdropping. However information presented within these certificates, except the domain name and email address, are not verified. Should you need higher validated certification, please check out our StartSSL™ Verified (Class 2) certificates.
"

I tried the WoSign Free Certificates because WoSign provides certificates of 3-year period while StartSSL only provides 1-year period. As lazy as I am, a 3-year period certificate does save me a few key strokes to renew and install the certificates on the websites.

The process is simple.
  1. Sign up an account on the WoSign's Free SSL Certificate web page.
  2. Go back the WoSign's web page with the account information
  3. Request certificates, for which, I chose to generate a Certificate Signing Request (CSR) myself. In my case, I use OpenSSL as follows,
    
    openssl req -new -newkey rsa:2048 -nodes -keyout mywebsite.key -out mywebsite.csr
    

    Then, copy and paste the content of the CSR to the WoSign's page in which the certificate is being requested.

    Note that the key length must be 2048-bit long. Save mywebsite.key for a late use (in step 5).

  4. Validate the website owner ship by uploading a HTML document provided by WoSign to the website under the website's web root directory
  5. Upon completing the validation install the certificate. I am running an Apache web server. It requires me to uncomment or update these three lines in the configuration file (that is, in my case, /etc/httpd/conf.d/ssl.conf)
    
    SSLCertificateFile     /etc/pki/tls/certs/2_mywebsite.crt
    SSLCertificateKeyFile  /etc/pki/tls/private/mywebsite.key
    SSLCACertificateFile   /etc/pki/tls/certs/1_root_bundle.crt
    

    Note that in the above 2_mywebsite.crt and 1_root_bundle.crt are from WoSign and mywebsite.key is the secrete key generated in step 3.
  6. Restart the Apache web server, in my case,
    
    systemctl restart httpd.service
    

  7. Final step is to test the website is up and the certificate is installed properly. To verify that the website is up, grab a computer and point a web browser to the website's URL using the HTTPS protocol. To verify the certificate is installed propertly, simply click on the "lock" icon next to the website address in the address bar of the web browser. The browser will show the certificate information.

If you have spotted and tested free SSL certificates from other vendors, please share with me via commenting on this post.

Friday, September 4, 2015

VMWare Tools Installer Complaining About Ethernet Driver on Linux Guests

When installing the VMWare Tools on Linux Guests, we sometimes see that the installer of the VMWare Tools complains about Ethernet drivers,

The vmxnet driver is no longer supported on kernels 3.3 and greater. Please
upgrade to a newer virtual NIC. (e.g., vmxnet3 or e1000e)

which does not necessarily mean that the Ethernet drivers are not vmxnet3 or e1000e. My experience indicates that it sometimes complains about the Ethernet driver's not being vmxnet3 or e1000e even if the driver is one of the two.

First, we can determine what Ethernet driver is loaded by using lspci command on the Linux virtual machine as follows,

lspci |  grep "Ethernet controller"

As the example below, if the output indicates that the Ethernet driver is vmxnet3 or e1000e, we can safely ignore the complain.

$ lspci |  grep "Ethernet controller"
03:00.0 Ethernet controller: VMware VMXNET3 Ethernet Controller (rev 01)

However, if the Ethernet driver is not one of the two, it is better to change the virtual Ethernet driver to be one of the two. VMWare has a Knowledge Base article on how to manually configure Ethernet adapter for a virtual machine. Following the article, we can configure the Ethernet driver in the steps below,

  1. Power off the virtual machine
  2. Locate and open the virtual machine configuration file (.vmx) for editing on the host
  3. Look for Ethernet configuration, by searching "ethernet" in the configuration file
  4. If you find a configuration entry as follows,
    
          ethernet0.virtualDev = "vmxnet"
          
    or
    
          ethernet0.virtualDev = "e1000"
          
    you should replace "vmxnet" or "e1000" by "vmxnet3" or "e1000e".

    Be aware that the above shows an example for the first Ethernet adapter, i.e., "ethernet0". If you have multiple Ethernet adapters, you should repeat the above steps for all Ethernet adapters.

    If you do not find a configuration entry as such, you need to add the entry to the configuration file, i.e.,
    
          ethernet0.virtualDev = "vmxnet3"
          
    or
    
          ethernet0.virtualDev = "e1000e"
          
    Repeat the step all Ethernet adapters.
  5. Save the configuration file and reboot the Linux guest
  6. Use lspci on the Linux guest to confirm that desired Ethernet driver is loaded.

You may wonder among "vmxnet3" or "e1000e", which one you should choose. According to this article, it appears that the better choice is "vmxnet3".

Thursday, August 27, 2015

Microsoft Message Analyzer and FiddlerCore

Microsoft Message Analyzer comes with a favorite scenario called "Pre-Encryption for HTTPS" scenario. The scenario relies on the FiddlerCore library. Due to a license issue, Microsoft does not ship the library with the analyzer. So when you try to use the scenario, you would encounter an error with the message below,

The Message Analyzer WebProxy provider depends on the FiddlerCore
library. The FiddlerCore library belongs to Telerik, Inc. and must be
installed separately. Please visit
http://www.telerik.com/fiddler/fiddlercore to download the
FiddlerCore installer and library from Telerik. A restart of Message
Analyzer is not necessary. 

Below is a screen capture.


To solve the issue, we simply download and install the FiddlerCore library, at present, from this URL.  The remaining issue is to determine where to install the FiddlerCore library. By default, FiddlerCore installer installs the library under the directory where the installer is. The directory would be a wrong directory for Microsoft Message Analayzer. To work with FiddlerCore, Microsoft Message Analyzer requires the FiddlerCore library to be installed under the directory of Microsoft Message Analyzer. If you install Microsoft Message Analyzer using its default installation directory, the FiddlerCore library's installation directory should be,

C:\Program Files\Microsoft Message Analyzer\FiddlerCoreAPI
If you are running 32-bit Windows or you installed 32-bit Microsoft Message Analyzer on its default installation directory, the directory to install the FiddlerCore library should be,

C:\Program Files (x86)\Microsoft Message Analyzer\FiddlerCoreAPI

Below is a captured FiddlerCore library installer screen shot that shows the correct installation directory is entered,


To configure and run a Pre-Encryption for HTTPS trace, see Microsoft Technet article Using the Network Tracing Features.

Friday, August 7, 2015

Configuring VMWare Player Virtual Networks

When we use VMWare Player to run guest operating systems, we sometimes want to automatically configure guest operating systems, such as, to assign fixed IP addresses to guest operating systems based on guest systems' network interfaces' MAC addresses.

This post discusses two items,
  1. to assign fixed IP address to interfaces of guest systems via VMWare's DHCP server
  2. and to change virtual subnet setting for virtual Ethernet segments using the vmnetcfg tool

Assigning Fixed IP Address


VMWare Player comes with a DHCP server that allows the guest systems to automatically configure their IP network settings. By configuring the DHCP server, we can achieve the auto-configuration purpose.

On Windows hosts, the configuration file of the DHCP server is located at directory %ProgramData%\VMWare. As an example, I show the value of  %ProgramData%\VMWare below,



C:>echo %ProgramData%\VMWare
C:\ProgramData\VMWare



In the directory is the configuration file, i.e., vmnetdhcp.conf. We can add host entries to the configuration file to assign fixed IP addresses to guest operating systems. Below is an example that assigns IP address 192.168.101.127 to MAC address 00:0c:29:22:12:4c in the virtual Ethernet segment 8.



# Virtual ethernet segment 8
# Added at 08/06/15 10:57:08
subnet 192.168.101.0 netmask 255.255.255.0 {
range 192.168.101.128 192.168.101.254;            # default allows up to 125 VM's
option broadcast-address 192.168.101.255;
option domain-name-servers 192.168.101.2;
option domain-name "localdomain";
option netbios-name-servers 192.168.101.2;
option routers 192.168.101.2;
default-lease-time 1800;
max-lease-time 7200;
}
host VMnet8 {
    hardware ethernet 00:50:56:10:00:01;
    fixed-address 192.168.101.1;
    option domain-name-servers 0.0.0.0;
    option domain-name "";
    option routers 0.0.0.0;
}

host Ubuntu {
    hardware ethernet 00:0c:29:22:12:4c;
    fixed-address 192.168.101.127;
    option domain-name-servers 192.168.101.2;
    option domain-name "";
    option routers 192.168.101.2;
} 


Changing Virtual Subnet Setting

One particular problem I often encounter is that the IP subnet setting is always changed when I upgrade or reinstall VMWare Player. For instance, in the above IP assignment example, the virtual Ethernet segment 8 is assigned a subnet of 192.168.101.0 with net mask 255.255.255.0 (i.e., 192.168.101.0/24); however, when I reinstall VMWare Player, the Ethernet segment 8's subnet assignment may become 192.168.157.0 with net mask 255.255.255.0 or some other value.

A simple method to change the Ethernet segment's subnet assignment back to the original value or any other valid value is to use the vmnetcfg tool.

The vmnetcfg tool is a part of VMWare Workstation; however, it does not come with VMWare Player. Since we can download VMWare Workstation trial version from VMWare's website, we can extract the tool from the installation package and use it with VMWare Player.

Two excellent posts that helped me and detail how one may extract the vmnetcfg tool from VMWare Workstation installation package and how one may use the tool to reassign a subnet to a virtual Ethernet segment are,

  1. Download vmnetcfg.exe & vmnetcfglib.dll for VMware Player 6.x & 7.x
  2. VMWare Interfaces Tutorial
For the impatient, the user interface of the vmnetcfg tool looks as follows,



It is obvious that one can change the subnet assignment to a selected virtual Ethernet segment.

Monday, July 6, 2015

Honey Bees

Honey bees have always fascinated me. This post is dedicated to the magnificent insects of honey bees.

If you want to have a case of honey bees buzzing in your back yard, perhaps, you can learn it by watching Professor Keith S. Delaplane's "Honey Bees and Bee Keeping" videos.



However, honey bees colonies are collapsing. Can we live in a world without these magnificent insects?

Thursday, May 28, 2015

Firefox Encountering "Secure Connection Failed" Error

I restarted Firefox (version 38.01) to visit a few secure sites, at present including live.com, and encountered an error  as follows,

Secure Connection Failed

The connection to the server was reset while the page was loading.
  • The page you are trying to view cannot be shown because the authenticity of the received data could not be verified.
  • Please contact the website owners to inform them of this problem.

A screen shot is captured as follows,

This is actually a known problem, although it  took me a while to find out why it occurred and what a solution might be.

Apparently, the sites were still using older version TLS (i.e., TLS 1.0) that Firefox 37.0 or newer do not consider them as secure any more. See these two discussions.

To create a workaround for those web sites,  we will use Firefox's about:config page.
  1.  In Firefox address bar, enter about:config and hit the Enter key to open the about:config page.
  2. Search insecure_fallback_hosts and locate the setting for the attribute security.tls.insecure_fallback_hosts
  3. Double-click on the attribute to update its value. The value should be the host names of the sites you encountered the "Secure Connection Failed" error. The value can contain multiple host names, separated by a comma (","). For instance, if you encounter the error for sites secure.foo1.com and www.foo2.net, the value would be secure.foo1.com,www.foo2.net.

This workaround works for me for a few sites. Be aware that Firefox has a discussion on addressing a similar problem; however, the solutions therein (e.g., rename or remove cert8.db) do not work for this particular error, i.e., the sites use older version of TLS (TLS 1.0).

Wednesday, May 20, 2015

Pinning Eclipse to Windows Taskbar

Typically, one may pin an application to the Windows taskbar (i.e. Windows 7 or Windows 8 Taskbar), by right-click the application's icon on the taskbar and choosing "Pin this program to taskbar". However, this method appears not to work for recent version of Eclipse.  This threat at superuser.com provides a few solution to it. The method I follow and that works for me is.,

  1. Locate the Eclipse executable, i.e., eclipse.exe
  2. Right-click on eclipse.exe and choose "Create shortcut" to create a shortcut for eclipse.exe.
  3. The shortcut will be named as "eclipse - Shortcut". Rename it as "eclipse"
  4. Right-click on the shortcut and choose "Properties"
  5. Add a command line argument to "Target" for the shortcut resembling
    
    -vm "C:\Program Files\Java\jdk1.7.0_55\jre\bin\server\jvm.dll"
    

    Note that you must change "jdk1.7.0_55" to match version of your JDK.

  6. In Windows 8.1, search "system environment variables" and choose "Edit system environment variables". Add your JDK's bin path to the PATH environment variable, e.g.,
    
    C:\Program Files\Java\jdk1.7.0_55\bin
    

    Note in the above, change "jdk1.7.0_55" to match version of your JDK.

  7. Launch Eclipse by double-clicking on the shortcut
  8. Once Eclipse pass the choosing Workspace stage and fully loaded, right-click the eclipse icon on the taskbar, choose "Pin this program to taskbar"
Although the thread at superuser.com provides a few solutions to pin Eclipse to the taskbar, many point out that once Eclipse fully loaded, two Eclipse icons will appear on the taskbar. The solution allows me to pin Eclipse on the taskbar and leads to only a single Eclipse icon on the taskbar once Eclipse is fully loaded.

The above solution is hinted in a post of the threat. The post also points to a relevant Eclipse bug report and the report also helps me to come out the solution.

By the way, pinning a program results a shortcut is created in the directory of

%USERPROFILE%\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar
 
 


Thursday, April 30, 2015

Node Package Manager (npm) Complaining "Unknown Error" from Linux Guest on Windows Host

I ran a npm install on a Linux guest running inside a Windows host and received an "Unknown Error". The error message looks like the following,


npm http 200 https://registry.npmjs.org/mime-db/-/mime-db-1.8.0.tgz
npm ERR! Error: ENOENT, lstat '/foo/node_modules/sauce-tunnel/vendor/linux/bin/sc'
......
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
......
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /usr/lib/nodejs/fstream/lib/writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     /foo/node_modules/something/npm-debug.log
npm ERR! not ok code 0


The solution is to run the following,

npm cache clean
npm install --no-bin-links
The cause of these type of errors, apparently is that when we install a node package to a shared Windows directory on a Linux guest and the underlining Windows filesystem does not know how to handle the Linux/Unix links, according to the post here.

Friday, April 24, 2015

Restoring Corrupted Windows Components Detected When Performing SFC, DSIM, and System Update

Using the System File Checker tool (SFC) and the Deployment Image Servicing and Management tool (DISM), we may fix a corrupted Windows system or a corrupted Windows component store. However, there are some cases the tools would fail to fix the problems. In addition, when performing a Windows update, we may also experience some problem. This post documents how we may locate a problem and manually fix the problem. This post is complementary to other two posts.

When we use SFC to repair missing or corrupted system files, SFC may report that it could not fix some corrupted files. Below is an example,

  C:\WINDOWS\system32>sfc /scannow

  Beginning system scan.  This process will take some time.

  Beginning verification phase of system scan.
  Verification 100% complete.

  Windows Resource Protection found corrupt files but was unable to fix some
  of them. Details are included in the CBS.Log windir\Logs\CBS\CBS.log. For
  example C:\Windows\Logs\CBS\CBS.log. Note that logging is currently not
  supported in offline servicing scenarios.

  C:\WINDOWS\system32>
In the above, the output of the SFC command contains,

  Windows Resource Protection found corrupt files but was unable to fix 
  some of them.
which indicates obviously that some files are corrupted and unfortunately SFC cannot fix them for you. The first and an easy attempt to fix the issue, in my opinion, would be to run a DISM command, for instance,

  C:\WINDOWS\system32>dism.exe /Online /Cleanup-Image /RestoreHealth

  Deployment Image Servicing and Management tool
  Version: 6.3.9600.17031

  Image Version: 6.3.9600.17031

  [==========================100.0%==========================]
  The restore operation completed successfully. The component store corruption was
  repaired.
  The operation completed successfully.

  C:\WINDOWS\system32>


Then, run SFC again. With good fortune, SFC may report that it can now fix the corrupted files, as demonstrated below,

  C:\WINDOWS\system32>sfc /scannow

  Beginning system scan.  This process will take some time.

  Beginning verification phase of system scan.
  Verification 100% complete.

  Windows Resource Protection found corrupt files and successfully repaired
  them. Details are included in the CBS.Log windir\Logs\CBS\CBS.log. For
  example C:\Windows\Logs\CBS\CBS.log. Note that logging is currently not
  supported in offline servicing scenarios.

  C:\WINDOWS\system32>


However, when we use DISM to recover from a corrupted Windows component store, DISM may also report that it could not fix some corrupted component store.

Even if the above two yield no error, a Windows Update may still fail. For instance, when I attempt to apply the KB3000850 update to my Windows 8.1 system, I encountered an error -- the update appears to be applied correctly; however, when the system reboots, it complains that the update failed to be applied successfully and the system rolled back and undid the change.

There are three logs that we typically examine for clues to identify corrupted component or component store.
The procedure that we can use to locate and fix the problem is outlined in this post.

The procedure is a manual one. In this post, let us examine two example problems and the methods to fix them. The first example is to examine CBS.log to obtain clues and fixing strategies. The second example is to examine setupapi.dev.log for clues to fix the problem.

  1. Example 1. After the DISM command fails to the /RestoreHealth operation, we examine %WinDir%\Logs\CBS\CBS.log. By searching "Total Detected Corruption" in the log file, we would find the following logging message,
    
    Checking System Update Readiness.
    
    (p) CSI Payload Corrupt   amd64_microsoft-windows-lddmcore_31bf3856ad364e35_6.3.9600.16438_none_9cc10b53b757a2be\dxgkrnl.sys
    Repair failed: Missing replacement payload.
    (p) CSI Payload Corrupt   amd64_microsoft-windows-lddmcore_31bf3856ad364e35_6.3.9600.16408_none_9ce17b17b73f4eeb\dxgkrnl.sys
    Repair failed: Missing replacement payload.
    
    Summary:
    Operation: Detect and Repair 
    Operation result: 0x0
    Last Successful Step: Entire operation completes.
    Total Detected Corruption: 2
       


    The message indicates that two files are corrupted. Both of the files happen to be two versions of dxgkrnl.sys. In this example, we demonstrate that we obtain a copy of the file from a Windows update manually. The CBS.log cites many Windows updates. It is infeasible to download all of them and see if the update contains a copy of the file. The method I used to locate the appropriate Windows update is to search the Windows version number. In this case, according to the message, the Windows version number is 6.3.9600.16438 in the first CSI Payload Corrupt message. We search "6.3.9600.16438 dxgkrnl.sys" using Google, as below,
    
       https://www.google.com/search?q=6.3.9600.16438+dxgkrnl.sys
       
    From the search result, it appears that Windows Update KB2887595. We then locate the stand-alone update package of the Windows Update from the Windows Download Center. The search string I used to locate the Windows Update is "KB2887595 x64" since my Windows system is a 64-bit version of Windows 8.1. Having downloaded the stand-alone update package of the Windows Update, we will obtain the copy of the version of dxgkrnl.sys and replace the corrupted copy with the downloaded one using the steps as follows, assuming that the Window Update Windows8.1-KB2887595-v2-x64.msu is in directory C:\Temp,
    
    C:\Windows\System32>cd C:\Temp
    
    C:\Temp>mkdir KB2887595
    
    C:\Temp>expand -f:* Windows8.1-KB2887595-v2-x64.msu KB2887595 > nul
    
    C:\Temp>cd KB2887595
    
    C:\Temp\KB2887595>mkdir KB2887595CAB
    
    C:\Temp\KB2887595>expand -f:* Windows8.1-KB2887595-v2-x64.cab KB2887595CAB > nul
    
    
    C:\Temp\KB2887595>dir KB2887595CAB\amd64_microsoft-windows-lddmcore_31bf3856ad364e35_6.3.9600.16438_none_9cc10b53b757a2be
     Volume in drive C is Windows8_OS
     Volume Serial Number is 282A-6B47
    
     Directory of C:\Temp\KB2887595\KB2887595CAB\amd64_microsoft-windows-lddmcore_31bf3856ad364e35_6.3.9600.16438_none_9cc10b53b757a2be
    
    04/25/2015  04:39 PM    <DIR>          .
    04/25/2015  04:39 PM    <DIR>          ..
    08/22/2013  08:36 AM           212,992 cdd.dll
    10/19/2013  05:13 AM         1,530,200 dxgkrnl.sys
    10/03/2013  10:07 AM           382,808 dxgmms1.sys
    08/22/2013  02:44 AM             2,465 lddmcore.ptxml
                   4 File(s)      2,128,465 bytes
                   2 Dir(s)  127,155,011,584 bytes free
    
    C:\Temp\KB2887595>
       


    Clearly, we have successfully obtained a good copy of the corrupted file. Now we simply to copy the file to its component store under %WinDir%\WinSxS as demonstrated below,
    
    C:\Temp>takeown /f "%windir%\winsxs" /a
    C:\Temp>icacls "%windir%\winsxs" /grant:r *S-1-5-32-544:(OI)(CI)(F) /q
    C:\Temp\KB2887595>copy KB2887595CAB\amd64_microsoft-windows-lddmcore_31bf3856ad364e35_6.3.9600.16438_none_9cc10b53b757a2be\dxgkrnl.sys %WinDir%\WinSxS\amd64_microsoft-windows-lddmcore_31bf3856ad364e35_6.3.9600.16438_none_9cc10b53b757a2be
    Overwrite C:\WINDOWS\WinSxS\amd64_microsoft-windows-lddmcore_31bf3856ad364e35_6.3.9600.16438_none_9cc10b53b757a2be\dxgkrnl.sys? (Yes/No/All): a
    
            1 file(s) copied.
    
    C:\Temp\KB2887595>
       


    Similarly, we can conduct a web search for the second corrupted file via Google as follows,
    
       https://www.google.com/search?q=6.3.9600.16408+dxgkrnl.sys
       

    From the search we learn that we could locate the file in the Windows Update KB2883200. Following the same procedure, we can replace the corrupted file with a good copy.
  2. Example 2. The second example is to resolve the update failure problem when I tried to apply the KB300850 update. Examining %WinDir%\Inf\setupapi.dev.log, I found the following messages,
    
         sto: {Publish Driver Package: C:\WINDOWS\System32\DriverStore\FileRepository\wiaek002.inf_amd64_5b5a15ef9a58384c\wiaek002.inf} 07:54:15.316
         sto:      Driver Package = wiaek002.inf_amd64_5b5a15ef9a58384c
         idb:      {Publish Driver Package: C:\WINDOWS\System32\DriverStore\FileRepository\wiaek002.inf_amd64_5b5a15ef9a58384c\wiaek002.inf} 07:54:15.316
         idb:           Changing active driver package from 'wiaek002.inf_amd64_57f9361b96ceea4b' to 'wiaek002.inf_amd64_5b5a15ef9a58384c'.
         cpy:           Unpublished 'wiaek002.inf'.
    !    inf:           Unable to load INF: 'C:\WINDOWS\System32\DriverStore\FileRepository\wiaek002.inf_amd64_57f9361b96ceea4b\wiaek002.inf'(00000003)
    !    inf:           Error 3: The system cannot find the path specified.
    !!!  inf:           Failed to open INF file "C:\WINDOWS\System32\DriverStore\FileRepository\wiaek002.inf_amd64_57f9361b96ceea4b\wiaek002.inf". Error = 0x00000003, Line = 0
    !!!  sto:           Failed to get driver package file list. Error = 0x00000003, Filename = C:\WINDOWS\System32\DriverStore\FileRepository\wiaek002.inf_amd64_57f9361b96ceea4b\wiaek002.inf
    !!!  idb:           Failed to update driver package files for 'wiaek002.inf_amd64_57f9361b96ceea4b'. Error = 0x00000003
    !!!  idb:           Failed to publish 'C:\WINDOWS\System32\DriverStore\FileRepository\wiaek002.inf_amd64_5b5a15ef9a58384c\wiaek002.inf'. Error = 0x00000003
         idb:      {Publish Driver Package: exit(0x00000003)} 07:54:15.316
    !!!  sto:      Failed to publish driver package. Error = 0x00000003
         sto: {Publish Driver Package: exit(0x00000003)} 07:54:15.316  
      
    From the messages, we can learn that the wiaek002.inf file failed to be published in directory C:\WINDOWS\System32\DriverStore\FileRepository\wiaek002.inf_amd64_5b5a15ef9a58384c\wiaek002.inf

    Following the observation, we manually "publish" the driver.
    
          mkdir C:\WINDOWS\System32\DriverStore\FileRepository\wiaek002.inf_amd64_5b5a15ef9a58384c
          copy C:\WINDOWS\Inf\wiaek002.inf C:\WINDOWS\System32\DriverStore\FileRepository\wiaek002.inf_amd64_5b5a15ef9a58384c\wiaek002.inf
        

    Then we reapply the KB300850 update again. In my case, it is a success.

Fixing Windows Update Error for KB3000850

Microsoft issued KB3000850, a 700MB patch. Microsoft labeled it as an optional update in November 2014 and has elevated it to . Microsoft has elevated it to an important update. This update creates problems for many, myself include because the update failed to install on one of my Windows 8.1 system.

Examining the search results from Google, it appears that the installation failures were generally the results of two.
  • Some components of Windows are corrupted
  • Some components of 3rd party software, e.g, hardware drivers are either corrupted or with bugs in installation procedures

With some efforts, I managed to install the update successfully on the Windows systems with problem. The procedure is as follows,
  • Use the System File Checker tool (SFC) to repair missing or corrupted system files. Typically, we follow the procedure below.
    1. Open a Windows Command Prompt with elevated permission, i.e., run the Windows Command Prompt as administrator.
    2. Issue the following command using the System File Checker tool SFC.
      
                  sfc /scannow
              
      The above command scans integrity of all protected system files and repairs files with problems when possible.
  • Use the Deployment Image Servicing and Management (DISM) tool to clear up Windows system image and recover the corrupted system image. Typically, we follow the procedure below.
    1. Open a Windows Command Prompt with elevated permission, i.e., run the Windows Command Prompt as administrator.
    2. Issue the following command using the Deployment Image Servicing and Management (DISM) tool.
      
                  Dism.exe /Online /Cleanup-Image /RestoreHealth
              
      In the above command, the /Online option indicates that the command is working on the currently running Windows, i.e., the system is currently "Online". Nevertheless, the above command scans the current running Windows for component store corruption, and then perform repair operations automatically. See the post for more examples using dism
  • Fix issues with 3rd party drivers. This step is typically a manual operation. In my case, I have a Kodak printer and installed the driver to the Kodak printer. It appears that the Kodak driver installation procedure has some issues and prevented the KB3000850 update from being installed successfully.
    In my case, the steps I took to fix the problem were as follows,
    
      mkdir %WinDir%\System32\DriverStore\FileRepository\wiaek002.inf_amd64_5b5a15ef9a58384c
      copy %WinDir%\Inf\wiaek002.inf %WinDir%\System32\DriverStore\FileRepository\wiaek002.inf_amd64_5b5a15ef9a58384c
          

    The clue of this solution comes from the log file %WinDir%\Inf\setupapi.dev.log and two references that helped a great deal are these two posts. However, the steps would be different from case to case.
    A more detailed discussion is in another post.

Wednesday, April 22, 2015

Checking and Restoring Windows Images

Deployment Image Servicing and Management tool (DSIM) is a command-line tool used to install, uninstall, configure, and update Windows features, packages, drivers, and international settings primarily on Windows images offline before deployment. Some DISM servicing commands are also available for running operating systems. The basic syntax for dism is (in a single line),

DISM.exe {/Image:<path_to_image> | /Online} [dism_options] 
                         {servicing_command} [<servicing_argument>]

That is to day, for servicing a Windows image offline, the syntax is,

DISM.exe /Image:<path_to_image> {servicing_command} [<servicing_argument>]
and for servicing a running Windows operating system, the syntax is,

DISM.exe /Online [dism_options] {servicing_command} [<servicing_argument>]
For instance, to service a running Windows, we can use /Cleanup-Image servicing command to perform cleanup and recovery operations on the image, which are commonly called for to deal with corrupted windows system.
  • Use servicing argument /CheckHealth to check whether the image has been flagged as corrupted by a failed process and whether the corruption can be repaired.
  • Use servicing argument /ScanHealth to scan the image for component store corruption.
  • Use servicing argument /RestoreHealth to scan the image for component store corruption, and then perform repair operations automatically.
More concretely, we can run the following commands from Windows Command Prompt with elevated permission,

Dism.exe /Online /Cleanup-Image /ScanHealth

Dism.exe /Online /Cleanup-Image /CheckHealth

Dism.exe /Online /Cleanup-Image /RestoreHealth

Alternatively, from Windows Powershell, run,

Repair-WindowsImage -Online -CheckHealth

Repair-WindowsImage -Online -ScanHealth

Repair-WindowsImage -Online -RestoreHealth

Tuesday, April 21, 2015

Google Mobile Friendly Seaches

Google made the following announcement,
Starting April 21, we will be expanding our use of mobile-friendliness as a ranking signal. This change will affect mobile searches in all languages worldwide and will have a significant impact in our search results. Consequently, users will find it easier to get relevant, high quality search results that are optimized for their devices.

For future web development and existing web site optimization, we want to know if a site is "mobile-friendly", for which it is perhaps a good practice to check out Google's blog post entitled Finding more mobile-friendly search results.
Google provides two tools,
These tools are excellent. However, it does not appear that they could be used before deployment. Perhaps, a good starting point is to examine the Google's Mobile-Friendly Web Development Guide.

Monday, April 13, 2015

Cost of Higher Education: New York Times and Slate Editions

Recently, New York Times published an op-ed opinion piece entitled "The Real Reason College Tuition Costs So Much" (the piece). The piece assigns a single factor to the cause of the rising college tuition, that is, the bloating university and college administration. The piece is interesting to me. I would like to drop a note on the piece.

The piece definitely won many praises -- who does not hate rising college tuition cost? I would like to say that the piece is an excellent piece simple because the piece certainly garnered many serious discussions. A few readers wrote to the New York Times expressed their opinions toward the piece. Among the opinions, some counters the argument made in the piece by arguing some university administration has become more efficient, and some argues that the bloating administrative cost is partially a result of the complexity of the higher education business, such as, the increased complexity of regulatory compliance. The Inside Higher ED has a blog post on this piece as well. The blog post refutes the center thesis expressed in the piece.

The discussions on the piece that I enjoy reading and listening the most are an article in Slate.com and a podcast from Slate.com. The article and the podcast point to a few important questions.

  1. Is the cost of college education really rising? If it is rising, how much rising is it?
  2. What are the factors driving the rising college education cost?

To answer the first question, we have to come out some metrics. There are at least two metrics.

  • Total higher education expenditure (or cost), including tuition & fees paid by students and government expenditure and subsidy
  • Higher education expenditure per Full-Time-Equivalent student (FTE)

It appears that we can have the following observations.

  • The Slate.com article and podcast suggest that the total higher education expenditure indeed increases over time. However, so does the number of students enrolled. Then, although the higher education expenditure per FTE is rising, it does not rise much.
  • Indeed, the university & college administrations have gotten bloated. It is a contributing factor of the rising cost of higher education. However, the bloat is partially a result that universities and colleges must deal with increased complexity of regulatory compliance.

One may ask the question, whether we can make higher education more efficient by reducing the cost per FTE.

  • We do not seem to have a solution to reduce the cost amid recent technological advancement in delivering education content and service. Some cites the so-called Baumol Effect to explain why we cannot be more efficient. Nn article in Forbes has a discussion on the Baumol Effect.
  • It is questionable that universities and colleges have any real incentive to reduce the cost per FTE. Some points out the prestige and ranking of a college is positively correlates to the tuition -- the more expensive a college is, the higher rank or reputation the college may enjoy, which is important to recruit more and better students.
  • Some blames the Federal Financial Aid program, such as an Wall Street Journal article and the Forbes article just mentioned above.

Wednesday, April 8, 2015

Configuring SELinux to Allow HTTPD Scripts and Modules to Establish TCP Connections

In a PHP script that establishes database connection to a PostgreSQL database via TCP socket, I encountered a SELinux denial. The message in the error log is,


SELinux is preventing /usr/sbin/httpd from name_connect access on the tcp_socket.


A quick fix is to allow HTTPD scripts and modules to connect to the network using TCP, i.e., run the following,


sudo setsebool -P httpd_can_network_connect 1

By the way, the relevant system information is as follows,

  • Operating System (output of uname -sr): Linux 3.12.9-201.fc19.x86_64
  • SELinux Policy Module: selinux-policy.noarch, version 3.12.1-74.17.fc19

Tuesday, March 31, 2015

Birds in China

I have been enjoying and fascinated by the photos of birds Craig Brelsford took in China. If you are interested in watching birds, check out his blog, the Photographic Web site of Craig Brelsford

Thursday, March 12, 2015

Converting PDF to EPS Figure for LaTeX

Sometimes we want to convert a figure in PDF format to EPS format and use the figure in a LaTex file. One important item we must take care is the bounding box of the figure. If the bounding box is not generated correctly, we would have a large area of wide space around the figure in final document.

In a Linux system, we have a set of free tools that can help us produce an appropriate bounding box and convert PDF format to EPS format.
On Ubuntu, you may install them using apt-get as follows,

sudo apt-get install \
     pdftk gv texlive-extra-utils \
     poppler-utils ghostscript ps2eps


Assume that PDF file foo.pdf contains an interesting figure in page 2 and we want to extract the figure for inserting it in a LaTex document. We would follow the steps below,
  1. Extract the page from the PDF file that contains the figure we would like to extract

    pdftk foo.pdf cat 2 output page2.pdf
    

    where foo.pdf is the input PDF file, page2.pdf  is the output PDF file, and 2 is the page number in the input PDF file.

  2. Measure roughtly the position and the dimension of a box that contains the figure using gv.
    
    gv page2.pdf
    

    We read the coordinates of the bottom left corner and the top right corner of the box from gv. Assume the readings are (61, 82) and (321, 161), respectivley.

  3. Crop the PDF file based on the box obtained in the above.
    
    pdfcrop --bbox "61 82 321 161" page2.pdf
    

    The output of this step is page2-crop.pdf.

  4. Crop the resulting PDF file from previous step to reduce white space around the figure.
    
    pdfcrop page2-crop.pdf
    

    The result is page2-crop-crop.pdf.

  5. Convert the PDF file to an EPS file.
    
    pdftops -eps page2-crop-crop.pdf page2.eps
    

    We could complete the last step using pdf2ps in Ghostscript instead of pdftops by the Poppler developers as the following two steps approach.
    
    pdf2ps page2-crop-crop.pdf 
    ps2eps page2-crop-crop.ps page2.eps
    

    However, we do not recommend pdf2ps, convinced by the argument made by Stefaan Lippens.

    As indicated by Stefaan Lippens, pdf2ps converts fonts in PDF files to bitmap fonts in resulting PS files. Some may consider this an advantage because the fonts used in the figure will always be "present" in the PDF files generated form the corresponding LaTeX files. However, as we discussed previously, it is not difficult to embedd all fonts in a PDF file.

Wednesday, February 25, 2015

Getting File Basebase without Extension in GNU Makefile

Sometimes we would like to write a generic rule in GNU makefiles.

For instance, we would like to write a rule to process a LaTex file and then process BibTex entries for any LaTeX files. We can write the rule as follows,


%.dvi: %.tex
    latex $<
    bibtex $(basename $<)
    latex $<
    latex $<

In the example, if we issue a command make example.tex, the value of $< is example.tex while $(basename $<) yields the basename without the extension. The basename without the extension is required for bibtex to work in this example.

This solution is provided by the discussion here.

Tuesday, February 24, 2015

Installing lineno.sty in Ubuntu and Fedora Linux

When we prepare a document using LaTeX, sometimes we want to include line numbers in an article. In many peer reviewed journals, it is a requirement to include line numbers in the output.

For instance, Elsevier LaTeX instructions has a LaTeX template whose LaTeX template file starts with

\documentclass[review]{elsarticle}

\usepackage{lineno,hyperref}

You system has not had the lineno package installed, if you encounter the following error when you compile your LaTex file that uses package lineno,

! LaTeX Error: File `lineno.sty' not found.

Type X to quit or  to proceed,
or enter new name. (Default extension: sty)

Enter file name:

Although you can download and install it from CTAN, you may be better off by installing the appropriate package provided by your system and let your system manage it. For instance, on Ubuntu Linux, we can install the textlive-humanities package,

sudo apt-get install texlive-humanities

For instance, on Fedora Linux, we can install the texlive-collection-humanities package,

sudo yum install texlive-collection-humanities 

The solution comes from the posts at here and here.

Creating Small Footprint Linux Virtual Machine - Revisited

Although many virtual machine appliances exist today and are conveniently to download, such as the VMWare Virtual Appliance Marketplace and the TurnKey Linux Virtual Appliance Library, it may be necessary to create a virtual machine image of your own and distribute it among the others. The issue is that a virtual machine image can easily become a monster and can be difficult to host, upload, download, and distribute such a large image. Previously, I attempted to create Linux virtual machine images with small footprint using the approach of installing the system and removing unnecessary packages. That approach leads to virtual machine images compressible to around 1GB archives.

Lately, I have opted to a second approach in which we install a bare bone Linux system and then install necessary packages. This approach, I found, often leads to smaller footprint than the previous approach.

The only caveat is that this approach may not work well with certain Linux distributions if the Linux distribution does not provide a means to install bare bone systems. If a Linux distribution does not provide a means to install the bare bone systems, it is likely to be a desktop edition, for instance, Ubuntu Linux's Desktop Edition has no option for a user to install a bare bone system during its installation process. A workaround is to create the system image using its corresponding server edition distribution, for instance, Ubuntu Linux's Server Edition allows you to install a bare bone system.

At present, I have a 64-bit Ubuntu Linux Server Edition image with PostGreSQL, Apache Web Server, and PHP but without GUI and the image is compressed to about 350MB archive.


Monday, January 26, 2015

Windows Software Licensing Management Tool (slmgr.vbs)

It has many functionality. A particular one that I am interested today is to figure out how a copy of Windows is licensed and activiated.

slmgr.vbs /dlv