Quantcast
Channel: Amigo's Technical Notes
Viewing all 122 articles
Browse latest View live

Salesforce Dupe Eliminator: My Missing Manual

$
0
0

Dupe Eliminator is provided by Salesforce Labs without official support. It may find and merge duplicate standard and custom objects.

Although it’s easy to install, I need to manually modify Visualforce page security and object permission in profile for user accounts with a custom profile.

Modify Page Security

[Setup]→[App Setup]→[Installed Packages]→[Dupe Eliminator]→[View Components] to see what has been installed with Dupe Eliminator. There are two Visualforce pages: MergeRecord and SearchMerge.

[Setup]→[App Setup]→[Develop]→[Visualforce Pages] find above two pages. Click on [Security] next to the page. Add custom profiles from Available Profiles to Enabled Profiles.

Profile Object Settings

[Setup]→[Administration Setup]→[Manage Users]→[Profiles] and click on one custom profile. [Object Settings]→[Dupe Eliminator]→[Edit] to change Tab Settings to [Default On]

Now, user may see [Dupe Eliminator] tab in [All Tabs].

Custom Merge Duplicates Button

It’s well written in P.12 of Dupe Eliminator (v1.5) – User Guide. The key is to use URL trick.

As a List Button:

/apex/dupe_eliminator__SearchMerge?find=true&object=customRelatedObject__c&field1=customParentObject__r.Id&op1=equals&value1={!customObject__c.Name}&limit=25

As a Detail Page Button:

/apex/dupe_eliminator__SearchMerge?find=true&object=customObject__c&field1=customObject__c.fieldName&op1=equals&value1={!customObject__c.fieldName}&limit=25

Detail Page Button example:

/apex/dupe_eliminator__SearchMerge?find=true&object=objAccount__c&field1=Name&op1=equals&value1={!objAccount__c.Name}&limit=25

Reference

  1. Salesforce: Dupe Eliminator
  2. Salesforce: Dupe Eliminator (v1.5) – User Guide
  3. Salesforce Labs

Filed under: How-To Tagged: Dupe Eliminator, Salesforce

Web to Any: My Missing Manual

$
0
0

I want to simplify simulating W2L on custom objects and choose Web to Any. There are many manual configurations after installation. After reading Web to Any Administrator Guide and testing, here are my shared notes.

Activate Sites

Because I already create a site, I only need to activate. On a complete new org, I need to create a new one first.

[Setup]→[App Setup]→[Develop]→[Sites]→[Edit] to activate selected site.

Modify Page Security

[Setup]→[App Setup]→[Develop]→[Sites] to show all available sites. Click on site name to see Site Detail. In Site Visualforce Pages region, click [Edit] to move WTA.WebToAnySetup from Available Visualforce Pages to Enabled Visualforce Pages.

Or

[Setup]→[App Setup]→[Develop]→[Sites] to show all available sites. Click on site name to see Site Detail. Click on [Public Access Settings] button to show site Profile Overview. Click [Visualforce Page Access] in Apps region to see Visualforce pages list. Click [Edit] to move WTA.WebToAnySetup from Available Visualforce Pages to Enabled Visualforce Pages.

Modify Apex Class Security

[Setup]→[App Setup]→[Develop]→[Sites] to show all available sites. Click on site name to see Site Detail. Click on [Public Access Settings] button to show site Profile Overview. Click [Apex Class Access] in Apps region to see Apex Class list. Click [Edit] to move WTA.WebToAnyService from Available Apex Classes to Enabled Apex Classes.

Configure Web to Any URL

[Setup]→[App Setup]→[Develop]→[Custom Settings] to show all custom settings. Click on [Manage] next to site name to see all related settings. Click [New] which is located just above Default Organization Level Value to create a Location / Site URL organization level setting. If you click on the lower [New] button, you need to assign a Profile or User in Location and is not organization level.

Generate Web Form HTML At A Glance

  1. Select Site
  2. Create a new configuration with tater object and default record creator/owner
  3. Create form for selected configuration

Reference

  1. Salesforce: Web to Any
  2. Salesforce: Web to Any Administrator Guide

Filed under: How-To Tagged: Salesforce, WebToAny

Integrated Google Form and Salesforce Through Google Sheet and WebToAny

$
0
0

To integrate Google Forms and Salesforce.com, I choose to use POST method to send data from Sheets to Web to Any and let it do the rest of everything. It provides more security than the building-in W2L by assigning a pageToken to every web form it generates. If a post doesn’t contains pageToken, it simply returns HTTP Error 400 Bad request.

Generate a WebToAny HTML Form

I have detail explain how to configure Web to Any in Web to Any: My Missing Manual. After creating a configuration in WebToAny – Setup, click on [Create Form] to generate a html form. pageToken are different every time you create a form even with the same configuration.

<!-- NOTE: Please add the following <META> element to your page <HEAD>. -->
<!-- If necessary, please modify the charset parameter to specify the -->
<!-- character set of your HTML page. -->
<!-- ---------------------------------------------------------------------- -->

<META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8">

<!-- ---------------------------------------------------------------------- -->
<!-- NOTE: Please add the following
<FORM> element to your page. -->
<!-- ---------------------------------------------------------------------- -->

<form action="https://my-developer-edition.ap5.force.com/services/apexrest/WTA/webtoany" method="POST">
<input type=hidden name="oid" value="00D90000000d54WEAQ">
<input type=hidden name="pageToken" value="wl0riE2c8K3coko+B9okb+dcfw19CtygsFp3/M540hCKGtZaxLrfeS0GTY7Yh2HH8mMP6jYdtoB00mA6ZOMmOgrlJhqnSNwTPL2fOO7/ztI7OyC0QwC/ZGyGZMrfgrYe1T19iBRoCiJGLT5Euis45omt9ZK751o1c99hFr/oQYC6jI/nuEFt/wVbfdXyeu+y">
<!-- ---------------------------------------------------------------------- -->

<label for="ExsZmzKy5hw5GXJ34B4J4oTusFPI8+DXLxVu0BIF/BE=">Name</label><input id="ExsZmzKy5hw5GXJ34B4J4oTusFPI8+DXLxVu0BIF/BE=" maxlength="40" name="ExsZmzKy5hw5GXJ34B4J4oTusFPI8+DXLxVu0BIF/BE=" size="20" type="text"/>

<input type="submit" name="submit">
</form>

We will need following information in Google Apps Script.

  1. oid value “00D90000000d54WEAQ”
  2. pageToken value “wl0riE2c8K3coko+B9okb+dcfw19CtygsFp3/M540hCKGtZaxLrfeS0GTY7Yh2HH8mMP6jYdtoB00mA6ZOMmOgrlJhqnSNwTPL2fOO7/ztI7OyC0QwC/ZGyGZMrfgrYe1T19iBRoCiJGLT5Euis45omt9ZK751o1c99hFr/oQYC6jI/nuEFt/wVbfdXyeu+y”
  3. field id “ExsZmzKy5hw5GXJ34B4J4oTusFPI8+DXLxVu0BIF/BE=”

WebToAny Form Security

When I disable the configuration which generate active html forms, POST returns HTTP Error 400 Bad request. Wondering if it is related to expiring pageToken. But I have no idea where it keeps them, I will check it when I have more understanding how it works.

Google Form to Sheets

Forms is just a mini web site while Sheets keeps the real data.

To save form data to Sheets, switch to [Response] tab and click on a green icon with cross which pop-up a balloon help “View responses in Sheets” to setup links.

I use the three-dot icon next to Sheets for future management like Unlink form.

Noted: Once re-link to the same Sheets, it will duplicate existing data to a new tab and use the new tab to append new data.

Apps Script to POST

In Sheets, click [Tools] → [Script editor…] to launch keeps the real data. Put following code in your editor and save.

function SendToSalesforceCapture() {
 var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
 var row = sheet.getLastRow();
 var Name = sheet.getRange(row, 2).getValue();
 var resp = UrlFetchApp
 .fetch(
 'https://my-developer-edition.ap5.force.com/services/apexrest/WTA/webtoany',
 {
 muteHttpExceptions : false,
 method: 'post',
 payload: {
 'oid' : '00D90000000d54WEAQ',
 'pageToken' : 'wl0riE2c8K3coko+B9okb+dcfw19CtygsFp3/M540hCKGtZaxLrfeS0GTY7Yh2HH8mMP6jYdtoB00mA6ZOMmOgrlJhqnSNwTPL2fOO7/ztI7OyC0QwC/ZGyGZMrfgrYe1T19iBRoCiJGLT5Euis45omt9ZK751o1c99hFr/oQYC6jI/nuEFt/wVbfdXyeu+y',
 'ExsZmzKy5hw5GXJ34B4J4oTusFPI8+DXLxVu0BIF/BE=' : Name,
 'external' : '1'
 }
 });
 Logger.log(resp.getContentText());
}

Difference Between WebToAny and W2L

Integrating Google Docs with Salesforce.com using Apps Script is worth reading but there are some differences:

  1. Web to Any use oid which is different from orgid generated using W2L in Salesforce.com The later is “00D90000000d54W” which lost the last 3 characters of oid.
  2. Web to Any needs pageToken to pass security check.
  3.  Web to Any use its own notion to replace API field names.

UTF-8 Encoding

I encounter UTS-8 issue with  fetch() default settings. I try to use the header generated by Web to Any  but fails:

<META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8">

After reading comments in fetch(url, params), I finally found the right way to set to UTF-8:

Because payload is a JavaScript object, it will be interpreted as form data. (No need to specify contentType; it will automatically default to either ‘application/x-www-form-urlencoded’ or ‘multipart/form-data’)

contentType: 'application/x-www-form-urlencoded;charset=UTF-8'

Therefore, the code should be re-written as below to handle UTF-8 correctly:

function SendToSalesforceCapture() {
 var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
 var row = sheet.getLastRow();
 var Name = sheet.getRange(row, 2).getValue();
 var resp = UrlFetchApp
 .fetch(
 'https://my-developer-edition.ap5.force.com/services/apexrest/WTA/webtoany',
 {
 muteHttpExceptions : false,
 method: 'post',
 contentType: 'application/x-www-form-urlencoded;charset=UTF-8',
 payload: {
 'oid' : '00D90000000d54WEAQ',
 'pageToken' : 'wl0riE2c8K3coko+B9okb+dcfw19CtygsFp3/M540hCKGtZaxLrfeS0GTY7Yh2HH8mMP6jYdtoB00mA6ZOMmOgrlJhqnSNwTPL2fOO7/ztI7OyC0QwC/ZGyGZMrfgrYe1T19iBRoCiJGLT5Euis45omt9ZK751o1c99hFr/oQYC6jI/nuEFt/wVbfdXyeu+y',
 'ExsZmzKy5hw5GXJ34B4J4oTusFPI8+DXLxVu0BIF/BE=' : Name,
 'external' : '1'
 }
 });
 Logger.log(resp.getContentText());
}

No RecordType as a Hidden Value

Unlike build-in W2L, you cannot pass RecordType within a form in Web to Any. Instead, you need to create a filed to get the RecordType value. And create a update field trigger on Salesfoce.com to change RecordType.

Assignment, and Comparison

To assign variable value, use =.

var row = sheet.getLastRow();

To compare values, use ==.

  if (Name == '') {
     Name = 'N/A';
  }

Debug Google Apps Script

I spend a lot of time figuring out why POST returns HTTP Error 400 Bad request. Google Script Editor asks me to enable muteHttpExceptions to read the detail error. After reading How can I see the full server response for this API error message in Google Scripts?, I learned and enabled but see no difference.

If you provides wrong url receiving POST, it returns HTTP Error 401 with “message”:”Session expired or invalid”,”errorCode”:”INVALID_ SESSION_ID”.

For SSL Error, usually it’s related to wrong url in Web to Any [Custom Settings].

Trigger to Automate POST

To automatically POST to Salesforce.com once a new row has been added in Sheets, I need to use the clock-like icon in tool bar or [Edit] → [Current project’s triggers] in Google Script Editor to add a new trigger. It needs to run SendToSalesforceCapture when an event From spreadsheet On form submit.

Reference

  1. CheckUpDown: HTTP Error 400 Bad request
  2. CheckUpDown: HTTP Error 401 Unauthorized
  3. Google Apps Script
  4. Google Apps Script: Class Sheet
  5. Google Apps Script: Class UrlFetchApp
  6. Google Forms
  7. Google Sheets
  8. Google Sheets: Add-ons: G-Connector for Salesforce
  9. Google: G Suite Developers Blog: Integrating Google Docs with Salesforce.com using Apps Script
  10. Salesforce: Web to Any
  11. StackOverflow: How can I see the full server response for this API error message in Google Scripts?
  12. w3schools.com: HTTP Methods: GET vs. POST
  13. Web to Any: My Missing Manual

Filed under: How-To Tagged: Google Apps Script, Google Form, Google Sheets, Salesforce, WebToAny

Salesforce Custom Buttons, Links, and Actions Tips

$
0
0

Here are some tips I experience while customize Buttons, Links, and Actions on Salesforce.com. I will put related tips/notes here.

Use a Button to Launch a Windows Program

To simplify integration Salesforce.com with Windows applications, I use protocol links in URL. For example, when I try to browser a Lotus Notes bookmark notes://lotuesnotes/12345, Lotus Notes Desktop Client will be launch and display the document.

If I want to create a button open a Lotus Notes bookmark in Lotus Notes Bookmark field on Task object, I have to configure a custom button:

  1. Click New Button or Link to create a new button
  2. Select Detail Page Button in Display Type
  3. Select Execute JavaScrip in Behavior
  4. Select OnClick JavaScript in Content Source
  5. Put following JavaScript in code/function area:


window.open("{!Task.LotusNotesBookmark__c}");

Remember to put this new button on your detail page.

Reference

  1. Microsoft: Registering an Application to a URI Scheme
  2. ShotGun Support: Launching applications using custom browser protocols
  3. Salesforce: Open pdf static resource with button press in new window
  4. StackOverflow: How to launch an application from a browser?

Filed under: How-To Tagged: Salesforce

Linux Becomes Slow After Resume / Suspend

$
0
0

Recently, I built a new computer with ASRock J3455-ITX which has a Apollo Lake processor build-in to run Force.com IDE and VisualStudio Code. I have to use OpenSuSE Tumbleweed to replace my favorite Leap because it requires the latest kernel to support Apollo Lake.

Everything seems fine but it becomes very slow after resume / suspend. I have tested many power-related settings in UEFI (Unified Extensible Firmware Interface) and none of them help. If I logout GNOME and login again, I regain my normal speed.

I try to google “linux slow after resume” and found some useful information. It seems related to

Doug Smythies and jat255 provide detail explain and a solution to restore CPU frequency as a service in Slowdown after resume from suspend on ArchLinux.

Compare CPU Frequency

First, you need to compare CPU frequency before and after suspend to validate if this is the case. You may compare CPU frequency before and after suspend.


sudo cpupower frequency-info

Rewrite MSR If  Not Zero

First to run modprobe to add a loadable kernel module (LKM) msr-tools to the Linux kernel. You need to run it every reboot.

MSR Tools project provides utilities to access the processor MSRs and CPU ID directly.

This project is composed of three different user space console applications.

rdmsr – read MSR from any CPU or all CPUs
wrmsr – write values to MSR on any CPU or all CPUs
cpuid – show identification and feature information of any CPU


#sudo modprobe msr

Run the utility to read MSR information.


#sudo rdmsr -a 0x19a

If the returned value is not 0, then write 0 into MSR.


sudo cpupower frequency-info
sudo wrmsr -a 0x19a 0x0

CPU clock slower after each resume from sleep on AskUbuntu reported it doesn't work because his case is not clock modulation (register 0x19A) related.

Reference

  1. ArchLinux: Slowdown after resume from suspend
  2. AskUbuntu: CPU clock slower after each resume from sleep
  3. AskUbuntu: Slow CPU after resume
  4. AskUbuntu: Ubuntu 16.04 LTS too slow after suspend and resume
  5. ASRock J3455-ITX
  6. GNOME
  7. Intel 01.org: msr-tools
  8. Intel: Intel Atom® Processor E3900 Series, Intel® Celeron® Processor N3350, and Intel® Pentium® Processor N4200, Formerly Apollo Lake
  9. OpenSuSE
  10. OpenSuSE Leap
  11. OpenSuSE Tumbleweed
  12. Salesforce Developers: Force.com IDE
  13. VisualStudio Code
  14. Wiki: modprobe
  15. Wiki: Unified Extensible Firmware Interface

Use SeaTools to Double Check Your Seagate HDD Again If your NAS Report Any Issues

$
0
0

While setting up a new QNAP TAS-268 with my old Seagate Laptop SSHD, it displays a warning message. Open the S.M.A.R.T. information tab, there seems to be something wrong in End-to-End_Error item. It seems the hard drive is not reliable. But there is another story on What does end-to-end disk error mean?, it continuous working in the next 15 months.

After reading more stories about End-to-End error, I decide to use SeaTools which is a diagnostic tool from the original hard drive vendor. I believe it may read and analyze S.M.A.R.T. in Laptop SSHD more accurately than third-party tools.

SeaTools Download and Launch

I plan to use a notebook to check, therefore, I download SeaTools Bootable to create a bootable flash. A clean environment is usually a better choice than a dirty Windows.

SeaTools launches automatically after it loads a Linux kernel. You need to scroll down to the end or you cannot click on the “Accept” button to test.

Non-Destructive Test

I run following non-destructive test and all reports “100% Test PASS”. Therefore, I believe my Laptop SSHD is in healthy condition. It might be TAS-268 cannot interrupt or read its S.M.A.R.T. correctly.

  1. The S.M.A.R.T. Check
  2. Short Generic Test.
  3. Long Generic Test

My TAS-268 information:

  1. Firmware: 4.3.3.0628 (2018/07/25)

Unfortunately, I cannot disable the warning on TAS-268. I need to back up more regularly without the help of S.M.A.R.T..

Backup on TAS-268

To prevent data loss, I use an external hard drive to keep another copy. I cannot find Hybrid Backup Sync in the App Center on TAS-268 which is available in myTS-119PII.

But there is a Backup Station build-in, it’s very similar to Hybrid Backup Sync. I may use it to create a job to copy from TAS-268 to an external hard drive. I plug my USB 3 external hard drive to the only USB 3 port on the front panel.

To sync bi-direction, enable both “Delete extra files”  and “Overwrite the file if the source file is newer or the file size is different” in the [Policy] tab of the job or only the new files are sent to the destination folder without removing files which are deleted on the source.

Copying a single huge file from external to TAS-268 is about 60MB/s while from TAS-268 to external is 80MB/s.

Reference

  1. Acronis: 9119: S.M.A.R.T. Attribute: End-to-End error
  2. AskUbuntu: What does end-to-end disk error mean?
  3. CNET: QNAP TS-119PII Spec
  4. QNAP: Backup Station Manual
  5. QNAP: Hybrid Backup Sync
  6. QNAP TAS-268
  7. Seagate Laptop SSHD Datasheet
  8. Seagate: SeaTools
  9. Seagate: SeaTools Bootable
  10. Seagate: SeaTools Bootable User Manual
  11. Wiki: S.M.A.R.T.

Delete Your Salesforce Developer Org

$
0
0

I have applied a Salesforce Developer org to learn and test. But there is no easy way to reset to default configurations, it seems to delete the current and apply a new one is the easiest solution.

To delete your developer org, go to administration [Setup] to search for “Company Information”. There is a [Deactivate Org] button in this configuration page.

The permanent delete takes 60 days. You may reactivate within 30 days and contact support after 30 days but within 60 days.

I have click on deactivate on 2018/9/1. I will update information on 2018/10/31.

Reference

  1. Salesforce Developers

ePub, Chinese Text, and Chinese Fonts in Kobo eReaders

$
0
0

I bought a Kobo Glo to read EPUB from Packt, saved articles on Pocket, and Chinese text files. Here are some quick notes of my experiment.

Kobo Works Better with Kepub Then epub

First, I try to open an ebook in epub format from Packt. I may open but encounter several crashes. The cover page is missing but the “Table of Contents” displays properly.

To convert epub into Kepub, Calibre is recommended but too complex for me. I choose kepubify instead.

kepubify for OSX is a command line tool. Change the file attribute to executable using “chmod +x” after download. Move it to the folder with all files need to be converted. Run with correct parameters and it would create a folder “kobo_converted” with converted files.

Chens-Mac-mini:kobo amigo$ ./kepubify-darwin-64bit ./
Kepubify v2.3.1: Converting 3 books
Output folder: /Users/amigo/Downloads/kobo
[1/3] Converting '/Users/amigo/Downloads/kobo/Learn C# in 7 days.epub'
[2/3] Converting '/Users/amigo/Downloads/kobo/Learning Python.epub'
[3/3] Converting '/Users/amigo/Downloads/kobo/Python 3 Web Development Beginner's Guide.epub'

3 total, 3 converted, 0 skipped, 0 errored
Chens-Mac-mini:kobo amigo$

Now, I open the converted Kepub. Faster, no crashes, the missing cover page is back, links with preview, select-and-search-dictionary, and reading statistics.

The only issue is the “Table of Contents” is displayed as just a list of files. I need to manually open the toc.html to navigate.

I think it is worth the extra effort to convert.

Chinese Text File Needs Unicode Explicitly

For Windows, choose Unicode, UTF-8, or UTF-8 with BOM while saving a Chinese text file in Notepad or Notepad++. It would be displayed properly by choosing the Chinese font in Kobo’s eReaders.

For Mac, even I choose the Unicode encoding in TextEdit, it is interpreted as an English text file in Kobo’s eReaders. I have to use Windows to help.

Add Chinese Fonts

Kobo’s eReaders need a Chinese TrueType font to display Chinese correctly.

First, create a “Fonts” folder in the drive “KOBOeReader” once the reader is connected to a computer. It doesn’t work if this folder is in the expansion card.

For Mac user, use transfonter to split the “Songti.ttc” which could be found in “Library > Fonts” into 8 TTF files.

Or you may download TTF files from GitHub: Pal3love/Source-Han-TrueType. They are the converted files from the joint-project by Google and Adobe at GitHub: adobe-fonts/source-han-sans.

I have tried many font convert service but none of them works for Noto CJKThis saves my time.

Last, copy these TTF files to the “Fonts” folder mentioned earlier.

Now, I may choose Chinese TTF fonts in Kobo. No more missing Chinese. Changing text and font options on your eReader has detail steps.

Reference

  1. Calibre
  2. GitHub: adobe-fonts/source-han-sans
  3. GitHub: Pal3love/Source-Han-TrueType
  4. Google: Noto CJK
  5. kepubify
  6. Kobo: Changing text and font options on your eReader
  7. Kobo: eReaders
  8. MobileRead: Kepub
  9. NOBOMORE: 如何在Kobo Aura上顯示中文
  10. Notepad++
  11. Packt Publishing Limited
  12. Pocket
  13. The eBook Reader Blog: Kepubify Can Easily Convert ePub eBooks to Kobo ePubs
  14. transfonter
  15. Wiki: EPUB
  16. Wiki: Kobo Glo
  17. Wiki: TrueType
  18. [開箱]Kobo Aura One(Limited edition)使用實錄
  19. 洪晧彰醫師個人部落格:Kobo aura one 32GB (日版)電子閱讀器 – 中文顯示問題

Remove Sites in Google Search Result

$
0
0

To remove fake posts and content, I use Personal Blocklist to prevent them displayed in the google search result. But it doesn’t function properly recently, websites in my block list are still being displayed. I follow the instruction in How to block a specific site from my search result to customize my search parameters to remove them.

Customize Search Engine

  1. In Chrome settings, search for “Manage search engines”.
  2. Add a new search engine in “Other search engines” section.
    1. “Search engine” is the displayed name in “Manage search engines” page.
    2. “Keyword” is the accelerator used when you want to use this customized search in Chrome’s Address Bar.
    3. “URL with %s in place of query” is the query string which will be added automatically while using this “Search engine”. Use “-” before the URL keyword. Use “+” to join parameters.
  3. After being saved, use the “Make default” to promote to “Default search engines” section. It would be applied on right mouse search or URL automatically.

Here is my customized search engine:


Usage

I may use “mg” at the beginning in Chrome’s Address Bar to specify the search engine. Because I have set mine as the default, “My Google” would be used automatically without specifying “mg”.

Here is an example:

Reference

  1. Google Search Help Forum: How to block a specific site from my search result
  2. Personal Blocklist (by Google)

Install Chromium OS on ThinkPad X131

$
0
0

My ThinkPad X131e boots slowly on openSUSE and Ubuntu but fast once login. Because it is also marketed as a Chromebook and my happy experience with ASUS Chromebox CN60, I decide to give Chromium OS a try.

Create a Bootable Chromium OS USB Stick for ThinkPad X131e

I follow the instruction on How to Run Google Chrome OS From a USB Drive to create one. Here is my experience:

  1. The regular builds on ArnoldTheBats don’t work for ThinkPad X131e. Fail to boot.
  2. Special Builds may boot from a USB stick successfully.
  3. Use Etcher to create a bootable USB stick

Clear Partitions

To clean up the USB stick or SSD, it’s better to run following command. Many partitions are created during creations and installation. sdX is the physical drive name.

# sudo dd if=/dev/zero of=/dev/sdX bs=16M status=progress

Neither the Windows Storage Management Tool nor GParted may remove everything on my USB stick.

Install on SSD from USB Stick

Once successfully boot by the USB stick, use [Ctrl] + [Alt] + [F2] to switch to the command prompt and login as user “chronos”. Run following command to install. Make sure the hard drive is clean. Detailed explained in

  1. How to Install Chromium OS
  2. Manual Installation of OS
  3. Chrome Story: How to Install Chromium OS on Your Netbook’s Hard Drive
  4. ArnoldTheBats: Chromium OS

or SSD, it’s better to run following command. Many partitions are created during creations and installation. sdX is the physical drive name.

# /usr/sbin/chromeos-install --dst /dev/sda

 

Although there are many error messages “Secondary GPT Header is invalid”, the installation is okay. I have read the following threads but none of them may stop this error.

  1. CloudReady: How do I format a HDD prior to install?
  2. CloudReady: WARNING: Primary GPT Header is invalid – CloudReady won’t install

Login Dialog Unavailable After Installing onto SSD

While booting Chromium OS from SSD on ThinkPad X131e, I didn’t see the login prompt no matter how long I wait. Here is a tip to make it appear:

  1. When the Chromium OS logo appear, use [Ctrl] + [Alt] + [F2] to switch to the command prompt.
  2. Use [Ctrl] + [Alt] + [F1] to switch to the graphical environment.
  3. Continue until the login dialog is available.

I have read the following threads but none of them helps.

  1. Google Groups: [cros-reviews] Add variables to grub2 for Chrome OS bringup workarounds. (issue2113004)
  2. Ubuntu Forum: Chromium OS won’t boot
  3. Linux Questions: missing operating system” when trying to boot Chromium OS from USB
  4. CloudReady: booting problem

Final Words

Although it runs fast, I didn’t keep Chromium OS on ThinkPad X131e. There is no good solution for Chinese input method.

If I need to input Chinese in Google Word, Sheets, and Slides, I may use Google Input Tools. Unfortunately, it’s not available on others. JsCIN 中文輸入法 is available in the whole Chromium OS environment but not good enough to me.

Reference

  1. Amazon: Lenovo ThinkPad X131e Chromebook 11.6″ LED Intel Celeron Dual Core 1.50GHz Model 628323U
  2. ArnoldTheBats World of Whimsy
  3. ArnoldTheBats: Chromium OS
  4. ArnoldTheBats: Chromium OS Builds
  5. ArnoldTheBats: Chromium OS Special Builds
  6. ASUS Chromebox CN60
  7. balena: Etcher
  8. Chrome Store: Google Input Tools
  9. Chrome Store: JsCIN 中文輸入法
  10. Chrome Story: How to Install Chromium OS on Your Netbook’s Hard Drive
  11. Chromium OS
  12. CloudReady: booting problem
  13. CloudReady: How do I format a HDD prior to install?
  14. CloudReady: Manual Installation of OS
  15. CloudReady: WARNING: Primary GPT Header is invalid – CloudReady won’t install
  16. GNOME Partition Editor
  17. Google Groups: [cros-reviews] Add variables to grub2 for Chrome OS bringup workarounds. (issue2113004)
  18. Linux Questions: missing operating system” when trying to boot Chromium OS from USB
  19. MakeUseOf: How to Run Google Chrome OS From a USB Drive
  20. openSUSE
  21. Ubuntu
  22. Ubuntu Forum: Chromium OS won’t boot
  23. wikiHow: How to Install Chromium OS

Fix Slow Boot with Linux

$
0
0

After upgrading to a new release, my ThinkPad x131e becomes considerable slower while booting into Linux. Because everything works normally after login, I didn’t pay too much attention. Now I found the reason is related to waiting for resume.

Computers

ThinkPad x131e

ThinkPad T410i

Both are installed with Ubuntu 18.10.

What’s wrong?

x131e takes about 61 seconds from power-on to the login screen while T410i is 24.

x131e takes about 9 seconds from login to the desktop while T410i is 7.

Considering T410i is 21.1% ((913-720)/913) faster with single thread and 35.3% ((2040-1319)/2040) with multi-thread than x131e on PassMark score for, the reasonable time is 29 (24x(1+21.1%)) to 32 (24x(1+35.3%)) seconds from power-on to login screen if I ignore all other difference.

On the other hand, the time x131e takes from login to the desktop is more reasonable. Using the same formula, it should be between 8.5 (7x(1+21.1%)) to 9.5 (7x(1+35.3%)) seconds.

How to Fix?

I follow It takes long to boot to run systemd-analyze blame to find out which process takes the most time. Then I read Slow boot, long kernel load time, due to wrong resume device and Xubuntu 18.04 kernel takes long to boot to solve my problem.

After manually edit the resume file which is located in /etc/initramfs-tools/conf.d/ and apply the change with update-initramfs -uk all, x131e takes about 29 seconds from power-on to the login screen. I can confirm this is why both Linux (OpenSuSE and Ubuntu) bootup considerably slower than the previous version.

#sudo vi /etc/initramfs-tools/conf.d/resume

Use none to replace if you found the file and there are assigned value to RESUME already.

RESUME=none
#RESUME=UUID=fe5f5874-ac3e-<wbr />4702-22e3-c452fdde0f359

Then apply the change.

#sudo update-initramfs -uk all

More Thoughts

BTW, the resume file is not available on my TP410i. I think that’s why it doesn’t slow down.

I think there might be some conflict between my SSD and ThinkPad. The wrong resume content is the key. Just remove it or assign a none value instead.

Reference

  1. AskUbuntu: It takes long to boot
  2. AskUbuntu: Slow boot, long kernel load time, due to wrong resume device
  3. AskUbuntu: Xubuntu 18.04 kernel takes long to boot
  4. Passmark: Intel Celeron 887 @ 1.50GHz
  5. Passmark: Intel Core i3-370M @ 2.40GHz

 

Android Repeating Keys with an External Bluetooth Keyboard

$
0
0

To increase mobility, I try to use an external keyboard with a tablet. It’s easy to connect but difficult to make it work correctly. There are always lost Bluetooth connections and repeating keys.

At first, I thought it was a software issue. Eventually, it is an incompatibility issue between the Bluetooth keyboard and tablet.

Bluetooth Keyboards and Tablets

Lexking Windows Bluetooth Keyboard

  • Model: BT-7128
  • Layout: Windows
  • Bluetooth 3.0

Libra Bluetooth Keyboard

  • Product: LBR-BTK1
  • Model: BCM20730
  • Layout: iOS/OSX
  • Bluetooth 3.0

Lenovo Tab 3 730X

  • Android 6.0
  • Bluetooth 4.0

Samsung Galaxy Tab J (7.0″, 4G)

  • Model: SM-T285YZWDBRI
  • Android 5.1
  • Bluetooth 4.0

What’s Wrong?

While pairing Lexking with Tab 3 730X via Bluetooth, unexpected lost connection and repeating keys happen frequently. Repeating keys looks like a key is continuously pressed. Therefore, you will see something like rrrrrrrrrrrrrr. Even wore, the backspace continuously deleting my writing. Mendy shares her similar experience in Tom’s Guide: my keyboard keeps typing the same letter.

It won’t stop until you switch to another app or check the message center on top. Breaking the Bluetooth connection won’t stop this crazy behavior.

I have checked the keyboard and confirmed every key work perfectly.

How to Fix?

It could be a software or compatibility issue.

How to prevent characters from repeating when entering text with a Bluetooth keyboard? suggest to use External Keyboard Helper Pro and enable the “No key repeating” option.

On the other hand, I try a different pairing.

Everything is fine while paring Libra with Tab 3 730X.  Both Lexking and Libra work fine with Tab J. Therefore, I think it is an incompatible issue.

More Thoughts

Libra has a different layout. The “Esc” key is missing and the “Del” key needs to use “Fn” + “Del”.

Also, I need to follow the instruction in Samsung Soft Keyboard Keeps Popping Up when Bluetooth Keyboard in Use on Galaxy Note 10.1 with Android 4.1.2 to disable the pop virtual keyboard on screen in Tab J. By disabling “Use on-screen keyboard” in “Default Samsung keyboard” under “Keyboards and input methods” section

Reference

  1. Android Enthusiasts: How to prevent characters from repeating when entering text with a Bluetooth keyboard?
  2. Android Enthusiasts: Samsung Soft Keyboard Keeps Popping Up when Bluetooth Keyboard in Use on Galaxy Note 10.1 with Android 4.1.2
  3. Google Play: External Keyboard Helper Pro
  4. Lenovo Tab 3 730X
  5. Lexking Windows Bluetooth Keyboard
  6. Libra Bluetooth Keyboard
  7. Samsung Galaxy Tab J (7.0″, 4G)
  8. Tom’s Guide: my keyboard keeps typing the same letter

Share USB Tethering to WiFi and Ethernet Devices

$
0
0

I have an Android with 4G Internet access. I connect it to Ubuntu via a USB cable and enable the USB Tethering in Android. The Ubuntu identify it in “Ethernet Connected” → “Wired connection 2” immediately.

My next step is to share internet from Ubuntu notebook through its built-in Ethernet and WiFi. Here is how.

Share Through Ethernet

I found Sharing Connection to other PCs (Via Wired Ethernet) [duplicate]  is very useful but some dialogs have changed in 18.04. cannot share wired network connection in 18.04 has the correct information for 18.04.

  1. Open a terminal and run nm-connection-editor
  2. In the “Network Connections” dialog, edit the wired connection.
  3. In the edit dialog, switch to the “IPV4 Settings” tab.
  4. Choose “Shared to other computers” in Method.
  5. Click the “Save” button to apply.

Clicking on the Ethernet or Wifi icon which is located on the upper right corner and “Ethernet Connected” → “Wired Settings” brings up the “Settings” → “Network” tab. There is no “Shared to other computers” option while editing IPV4.

The “Network Connection” dialog is different from the”Settings” → “Network” tab.

Share Through WiFi

How To Create A Wi-Fi Hotspot In Ubuntu 18.04 / Gnome (And Edit Its Settings) has detail explanation.

First, turn on Wi-Fi.

Then click on the Ethernet or Wifi icon which is located on the upper right corner and “Wi-Fi Not Connected” → “Wi-Fi Settings”. It would bring up the “Settings” → “Wi-Fi” tab. Click on the “Command” icon which looks like three horizontal line stacks together on the dialog border and select “Tuen On Wi-Fi Hotspot”. One more dialog will popup and click on the “Tune on” to confirm.

To configure, launch the “Network Connections” dialog by running nm-connection-editor. Edit the “Hotspot” profile in Wi-Fi. Change SSID in the “Wi-Fi” tab and WPA in the “Wi-Fi Security” tab.

Reference

  1. AskUbuntu: cannot share wired network connection in 18.04
  2. AskUbuntu: Sharing Connection to other PCs (Via Wired Ethernet) [duplicate] 
  3. Linux Uprising: How To Create A Wi-Fi Hotspot In Ubuntu 18.04 / Gnome (And Edit Its Settings)
  4. Matt’s Blog: Sharing WiFi Connection over Ethernet on Ubuntu 18.04

Migrate Windows Virtual Machine from VirtualBox to QEMU/QNAP Virtualization Station

$
0
0

I want to move my Windows XP VM (Virtual Machine) which runs on VirtualBox on OSX to QNAP Virtualization Station running on QNAP TS-251A. The latter is a variant of QEMU. With the new architecture, I may use Windows XP from Chromebox. There is no need to have a dedicated Windows machine.

Virtualizer

Following are the most important difference between the two virtualizers:

VirtualBox

  • Intel 82371 AB/EB PCI Bus Master IDE Controller
  • Intel 82801 AA AC’97 Audio Controller
  • Intel PRO/1000 T Server Adapter
  • Standard OpenHCD USB Host Controller

Virtualization Station

  • Intel 82371 SB PCI Bus Master IDE Controller
  • Legacy Audio Drivers
  • Realtek RTL8139 Family PCI Fast Ethernet NIC
  • Intel Core i7 (Nehalem Class Core i7)
  • Standard Enhanced PCI to USB Host Controller
  • Standard Universal PCI to USB Host Controller

What’s Wrong?

When I launch the Windows XP VM which is imported from a VirtualBox OVA (Open Virtualization Format) file, it is always BSoD (Blue Screen of Death).

How to Fix?

atlaswu: Parallels Desktop 虛擬機轉移到 QNAP 發生藍屏 helps me to looks for incompatibility issue and 0x0badc0de: Converting a Windows Virtual Machine from VirtualBox to QEMU and KVM using libguestfs tools specify the ide and processor drivers are the key.

Here is what I got after several experiments. Five key points:

  1. Change the IDE ATA/ATAPI Controller from Intel 82371 AB/EB PCI Bus Master IDE Controller to Intel 82371 SB PCI Bus Master IDE Controller in VirtualBox.
  2. Disable the Intel Processor in Virtualization Station.
  3. Configure to emulate Realtek RTL8139 Family PCI Fast Ethernet NIC and Intel Core i7 (Nehalem Class Core i7) in Virtualization Station [Settings].
  4. Assign Legacy Audio Drivers to replace Audio Device on High Definition Bus in Windows XP on Virtualization Station.
  5. Install the Virtio Drivers and QNAP Guest Agent in QNAP Guest Tools Installer.

Detail steps:

Create an OVA with Standard Dual Channel PCI IDE Controller

  1. Launch the Device Manager In Windows XP in VirtualBox.
  2. Change the Intel 82371 AB/EB PCI Bus Master IDE Controller to Standard Dual Channel PCI IDE Controller by manually assigning the specified driver.
  3. Turn off Windows XP completely.
  4. In VirtualBox, use [File] → [Export Appliance…] to create an “Open Virtualization Format 1.0 OVA” file.

Import to Virtualization Station and VM Settings

  1. Import above OVA file into Virtualization Station.
  2. Create a snapshot of the new VM before everything.
  3. In [Settings]→[General], set following items:
    1. [CPU] as “Intel Core i7 (Nehalem Class Core i7)”
    2. [OS Type] as “Windows”
    3. [Version] as “Windows XP”
  4. In [Settings]→[Network], set following items:
    1. Adapter 1 [Model] as “Realtek Fast Ethernet”.
  5. In [Settings]→[CD/DVD], set following items:
    1. Add a CD/DVD ROM device on “IDE”.
  6. In [Settings]→[Video], set following items:
    1. [Type] as “Cirrus”

Disable the Intel Processor

The Windows mouse pointer is difficult to use at first boot. It’s related to the USB driver. If reboot before disabling the newly found Intel Processor, it would bring up BSoD while launching Windows XP. Restore to the previous snapshot and try again.

While launching “Device Manager”, “Found New Hardware Wizard” will be launched automatically and the following devices are identified automatically and correctly.

  • Intel 82371 SB PCI Bus Master IDE Controller
  • Realtek RTL8139 Family PCI Fast Ethernet NIC
  • Standard Enhanced PCI to USB Host Controller
  • Standard Universal PCI to USB Host Controller

The following devices are identified automatically but incorrectly.

  • Audio Device on High Definition Bus
  • Intel Processor

Just stop Intel Processor and reboot. If two cores are assigned for the VM, there will be two to stop.

During the first reboot, BSoD shows up once but never in the next loading.

Install QNAP Guest Tools

Once the “HID-Compliance Mouse” is installed, the mouse pointer would work as normal. Sometimes it is identified on the 2nd reboot.

When Windows XP is login successfully, click on [Insert Guest Tool CD] next to the [Information]→[CD/DVD] in Virtualization Station. The “QNAP Guest Tools Installer” should be launched automatically. Install the “Virtio Drivers” and “QNAP Guest Agent” both.

The “QNAP Guest Tools Installer” will become not responding. Use “Windows Task Manager” to terminate. Then reboot Windows.

Now let the “Found New Hardware Wizard” search online and install drivers.

Configure Audio Driver Manually

Open “Device Manager” and assign Legacy Audio Drivers to replace Audio Device on High Definition Bus. Change to preferred screen resolution and reboot.

What’s Missing

Even I have installed the Virtio Drivers, there are two error drivers in “Device Manager”.

  • VirtIO Baloon Driver
  • VirtIO-Serial Driver

Reference

  1. 0x0badc0de: Converting a Windows Virtual Machine from VirtualBox to QEMU and KVM using libguestfs tools
  2. atlaswu: Parallels Desktop 虛擬機轉移到 QNAP 發生藍屏
  3. oVirt: Spice
  4. QEMU
  5. QNAP: How to use Virtualization Station 3?
  6. QNAP TS-251A
  7. QNAP Virtualization Station
  8. VirtualBox
  9. Wiki: Blue Screen of Death

Using VisualStudio Code to Sync Files in Turnkey Linux VM

$
0
0

To keep my working environment clean, I choose to use the ready-to-use Turnkey Linux Yii Framework VM in VirtualBox instead of creating everything from scratch in OSX. I plan to edit codes locally using Visual Studio Code and sync changes with VM by SFTP Protocol. Here is how I do.

Create a New Workspace

The local working folder needs to be added to the workspace. Create the folder in local drive and add it to the workspace in the [EXPLORER] panel. [File] → [Save Workspace As…] to name.

Install and Configure SFTP

Search for “sftp” in the [EXTENSIONS: MARKETPLACE] panel. Install the one developed by “liximomo”. Need to restart Visual Studio Code to activate it.

Open the [EXPLORER] panel and run [sftp:config] in the command line which could be launched using [Command] + [Shift] + [P]. It would create “sftp.jason” in the hidden folder “.vscode”. Refresh the [EXPLORER] panel and to show.

Update the “host”, “username”, and “remotePath” values in “sftp:jason” to match the VM. The default web pages path in VM is “/var/www/yiiframework”. Save the configuration file.

Sync from Remote to Local

Move to the folder name which needs to keep codes in the [EXPLORER] panel. Right-click and choose “Sync Remote -> Local”. It would prompt for the password in the command line. Then run “Sync Remote -> Local” again to begin to sync everything from VM to local.

Sync from Local to Remote

Open and edit the file /frontend/views/site/index.php. Make some change and save. Move to any folder in the [EXPLORER] panel. Right-click and choose “Sync Local -> Remote” to upload changes.

Reference

  1. GregYang Blog: VS Code (Use SFTP)開發模式環境同步
  2. Oracle VirtualBox
  3. Turnkey Linux: Yii Framework
  4. Visual Studio Code
  5. Visual Studio Marketplace: sftp sync extension for VS Code
  6. Wiki: SSH File Transfer Protocol
  7. Yii Framework

A More Flexible Roll-Up Summary Practice Using Flows and Process in Salesforce.com

$
0
0

Use Flow Builder to Create a Roll Up Summary Field shares how to calculated related records without using the “Roll Up Summary” field type. It’s useful especially when the two objects don’t have a parent-child relationship.

But this video doesn’t work for deleted records, the process will be triggered only when a child record is created or edited. You need to change the counting criteria, business process, and object permission.

What’s in the Video

In a quick glance:

  1. Create a flow to calculate the sum of project records with a given account ID.
  2. The flow also updates the field “project_count_total__c” in the account record.
  3. Create a process which will be triggered when a project record is created or edited.

What’s the Issue

It works perfectly when a new project record has been created or updated.

When you delete a project record, no process will be triggered. The “project_count_total__c” field won’t be updated.

What’s in the Real-World Business Process

For any sensitive records, I will let the user add a mark for deletion. Usually is to change the status to “Delete”. I won’t let them delete on their own. It prevents data loss and accident.

Only the system admin and/or certain users will have the capability to delete these records.

Besides, each project has a status. When users ask for the summary field, they mean projects in a certain status. They call it a sense of business and won’t explain explicitly. It’s better to define and explain in the balloon help of the field.

How to Implement in Salesforce.com

The key is to use the mark for deletion to replace delete permission. Every record needs to add a mark for deletion before delete.

Mark for Deletion

I will add “Delete” as a new picklist value in the status-or-like field. Or create a new checkbox field. The later will need to change the existing layout and is not suggested.

Count Criteria

Change the criteria when you get the records to exclude those mark for deletion.

In this video, I will add it in the “Filter Project Records” while creating a “New Get Records” at 1:42.

Remove Object Delete Permission in User Profile

Remove the “Delete” permission on the object in all user profiles. Sometimes there are superusers to have the delete permission.

Delete Records with Mark for Deletion

The Salesforce Admin and/or the superusers will need to clean up records which have the mark for deletion regularly. It could be done by deleting manually or running an Apex script.

It’s a good idea to schedule an Apex to run automatically.

Reference

  1. Salesforce.com: Use Flow Builder to Create a Roll Up Summary Field

Remote Access VM on VirtualBox from Google Chrome

$
0
0

I need to run a Windows desktop application to keep track of my expanse. Because CodeWeavers needs Android and Asus ChromeBox CN60 doesn’t have Android support yet according to the list, the only solution is remote access.

My experiment with QNAP Virtualization Station is good but it loses keyboard input sometimes. I have to refresh the page to get it back again. Therefore, I give phpVirtualBox a shot.

Eventually, I realize the lack of RDP-compatible client on ChromeOS makes it impossible to access VirtualBox from CN60.

Table of Contents

Install VirtualBox and Related Packages

Install VirtualBox and Extension Pack
Install Apache, PHP, and UFW
Install phpVirtualBox

Manage phpVirtualBox

Change Password
Manage Users
Enable Remote Display

Connect to VirtualBox

Linux: GNOME Remote Desktop Viewer
Mac: CoRD
Android: Remoter RDP Client
Android: Microsoft Remote Desktop

Tips

Find Who is Running vboxwebsrv
Check IP Address for the Host
Disable phpvirtualbox Authentication
Check the OS Detail
Manage a .deb Package

Reference

Install VirtualBox and Related Packages

First, to access VM remotely, it needs to be launched by VirtualBox on Ubuntu first.

Next, I need the Oracle VM VirtualBox Extension Pack on communication. It implements the VirtualBox Remote Display Protocol (VRDP) based on the VirtualBox Remote Desktop Extension (VRDE) interface. There are also other third-party solutions. With this package, the display can be sent to the remote client while the mouse and keyboard signal from the remote client can be sent back to the VM. Chapter 7. Remote Virtual Machines explains in detail on the topic.

Last, to manage from a web browser, phpVirtualBox simplifies the job.

Install VirtualBox and Extension Pack

Download both from here. They need to be the same version number. For example, if VirtualBox 6.0.4 is installed, get the VirtualBox 6.0.4 Oracle VM VirtualBox Extension Pack.

The one in “Ubuntu Software” is an older version on 2019/4/11. It doesn’t work on Ubuntu 18.10. I install both and get into troubles. Finally, I use dpkg to remove the older version and reinstall the official, it works. Also, there is no extension pack in “Ubuntu Software”. Use the latest version on the official web site is the best source.

In Ubuntu, the vboxwebsrv won’t be launched automatically after installation because it uses systemd service file. Here is why and the solution is here.

Because this is just a quick test, I launch manually binding localhost 127.0.0.1:

$sudo vboxwebsrv -H 127.0.0.1

Back to Table of Contents.

Install Apache, PHP, and UFW

To launch phpVirtualBox, Apache and PHP must run first. Uncomplicated Firewall (UFW) is suggested to manage firewall rules easier. More usage detail is here. Run these commands to install necessary packages, run Apache with PHP support, and allow Apache to pass through the firewall:

$sudo apt-get update
$sudo apt-get install apache2
$sudo apt-get install php libapache2-mod-php php-soap php-xml
$sudo apache2 -k restart
$sudo apt-get install ufw
$sudo ufw enable
$sudo ufw allow "Apache"

To check what has been added to the firewall rules:

$sudo ufw status

Create a “/var/www/index.php” as below. Load “http://localhost/index.php&#8221; to see if Apache and PHP work properly.

<?php phpinfo(); ?>

Back to Table of Contents.

Install phpVirtualBox

Download from the master branch on GitHub and unzip. If the master branch doesn’t support current VirtualBox, try the developer branch. Unzip and rename the downloaded file into the folder “phpvirtualbox”. Copy to “/var/www” where $USER is the user name used to login to Ubuntu:

$sudo cp -r /home/$USER/Downloads/phpvirtualbox /var/www/html

Next, prepare the basic configuration. Create one from copying the example file:

$sudo cp /var/www/html/phpvirtualbox/config.php-example /var/www/html/virtualbox/config.php

For better security, it’s a good idea to create a new user account in Ubuntu to launch vboxwebsrv. Provide the user name and password running vboxwebsrv in “config.php” to replace ‘vbox’ and ‘pass’ as below. It’s detail explained in Cannot login to vboxwebsrv #89 by 3PO commented on Jan 26, 2018.

var $username = 'vbox';
var $password = 'pass';

Please also read this because the vboxwebsrv won’t be launched automatically in Ubuntu due to systemd.

For a quick test, ignore the security settings and launch manually binding localhost 127.0.0.1:

$sudo vboxwebsrv -H 127.0.0.1

A more detailed explanation is here.

Back to Table of Contents.

Manage phpVirtualBox

If Apache, PHP, and phpVirtualBox are installed and the vboxwebsrv is launched, a login dialog appears loading “http://localhost/phpvirtualbox&#8221;. The default user name and password for phpVirtualBox are both “admin”.

It’s a good habit to change the default password immediately.

After importing VM and enable remote display, the server side is ready for test.

Change Password

The default user name and password for phpVirtualBox are both “admin”. Change the login user’s password from [File] → [Change Password].

Back to Table of Contents.

Manage Users

To manage users, open the “Preferences” dialog by [File] → [Preferences]. Switch to [Users] section to create, remove, promote to administers, and change password.

Back to Table of Contents.

Enable Remote Display

Open the “Settings” dialog of the VM which needs to be connected remotely. Switch to [Display] section. In the [Remote Display] tab, tick the [Enable Server] and assign the port number for this VM in [Server Port].

Last, allow this port number to pass through the firewall. If the port number is 3390, run this command to allow:

$sudo ufw allow 3390

For higher security specifying both allow port and IP address range from 192.168.1.0 to 192.168.1.255, use IP Calculator to get the netmask 24 and run this command instead:

$sudo ufw allow from 192.168.1.0/24 to any port 3390

Ubuntu Documentation explains UFW in detail. Here are my firewall rules. :

$sudo ufw status
Status: active

To                         Action      From
--                         ------      ----
Apache                     ALLOW       Anywhere                  
3390                       ALLOW       192.168.1.0/24          
Apache (v6)                ALLOW       Anywhere (v6)

Back to Table of Contents.

Connect to VirtualBox

The built-in console in phpVirtualBox needs the Adobe Flash Player. Since Google decides to remove Flash completely by the end of 2012, I look for other solutions.

Because VRDP is backward-compatible to Microsoft’s Remote Desktop Protocol (RDP), any RDP client should be able to remote control the VM. Here is a list of my test results.

If more than one client needs to connect to the same VM at the same time, tick the [Allow Multiple Connections] in the [Remote Display] tab. Both clients have control of the VM at the same time.

Strangely, phpVirtualBox has problems saving settings in [Authentication Method] and [Allow Multiple Connections]. Sometimes it works. VirtualBox desktop application doesn’t have this issue.

Linux: GNOME Remote Desktop Viewer

It’s default installed in Ubuntu 18.10. Select [Protocol] “RDP” and assign [Host] as [IP Adress]:[Port Number] of the VM.

For example, if the IP address of VirtualBox is 192.168.1.50 and the VM is assigned with 3390 as the [Server Port] for remote display, the [Host] is “192.168.1.50:3390”.

Use the [Bookmarks] menu to manage hosts.

If the VM is already connected by others and doesn’t allow for multiple connections, GNOME Remote Desktop crashes immediately.

Back to Table of Contents.

Mac: CoRD

Like GNOME Remote Desktop Viewer, it works perfectly. But CoRD is unstable, I have several crashes during testing.

Use the [Servers] button to manage hosts.

Back to Table of Contents.

Android: Remoter RDP Client

Although Remoter runs on Android, there are no missing features. It uses [Address] as the [Host] in GNOME Remote Desktop Viewer. The format is the same.

To launch the keyboard within the remote client, touch the screen with three fingers or use the red circle on the upper right corner to select the [Windows Keyboard]. The Android keyboard has no use to control remote server.

Use the [+NEW CONNECTION] button to create hosts and long press on a connection to edit or delete.

Back to Table of Contents.

Android: Microsoft Remote Desktop

Microsoft Remote Desktop doesn’t work.

It displays “… the PC can’t be found…” using the port 3389 connecting to the VM. The error code is 0x104.

The warning message “Identity of remote PC cannot be verified” using other ports. There seems to be a protocol error. The error code is 0xd06.

Eventually, I give it up.

Back to Table of Contents.

Tips

Find Who is Running vboxwebsrv

To verify if the user running vboxwebsrv is the same to config.php, run to identify:

$ps aux | grep vboxwebsrv

Back to Table of Contents.

Check IP Address for the Host

My favorite ifconfig is not a built-in command in Ubuntu 18.10. It needs to install net-tools to use. Therefore, I use hostname instead:

$hostname -I

Back to Table of Contents.

Disable phpVirtualBox Authentication

Uncomment the following line in config.php to disable authentication when login to phpVirtualBox:

#var $noAuth = true;

Back to Table of Contents.

Check the OS Detail

The Ubuntu version and code name are detailed in “/etc/os-release”. Useful when VirtualBox won’t start after an update. Sometimes the kernel has changed, and VirtualBox needs an update, too.

$cat /etc/os-release

Back to Table of Contents.

Manage a .deb Package

dpkg is the tool to manage packages. Here is a list of frequently used parameters:

  • -i + package file name: install a package file
  • -r + package name: remove a package
  • -P + package name: remove a package and its configuration files
  • -l | less: list all installed packages by page

dpkg-reconfigure is to reconfigure and repair an installed package. Therefore, it needs the package name.

Here are some examples:

$sudo dpkg -i virtualbox-6.0_6.0.4-128413~Ubuntu~bionic_amd64.deb
#sudo dpkg-reconfigure virtualbox-6.0

Back to Table of Contents.

Reference

  1. AskUbuntu: How can I get vboxweb to start properly at boot
  2. AskUbuntu: How do I find my internal ip address?
  3. AskUbuntu: How do I install a .deb file via the command line?
  4. Asus ChromeBox
  5. Ciiag: Poor Mans Virtualized Server
  6. CodeWeavers: How to install CrossOver Chrome OS
  7. Digital Ocean: How To Install the Apache Web Server on Ubuntu 18.04
  8. GitHub: phpvirtualbox
  9. GitHub: phpvirtualbox: Issues: Cannot login to vboxwebsrv #89
  10. GitHub: phpvirtualbox: Wiki: Common phpVirtualBox Errors and Issues
  11. GitHub: phpvirtualbox: Wiki: Getting started
  12. GitHub: phpvirtualbox: Wiki: vboxweb service Configuration in Linux
  13. GitHub: phpvirtualbox: Wiki: Web server and PHP installation
  14. Google Play: Microsoft Remote Desktop
  15. Google Play: Remoter RDP Client
  16. IP Calculator
  17. Linuxize: How to Install PHP on Ubuntu 18.04
  18. Migrate Windows Virtual Machine from VirtualBox to QEMU/QNAP Virtualization Station
  19. nixCraft: How to check os version in Linux command line
  20. SourceForge: CoRD
  21. SourceForge: Wiki: phpVirtualBox: Home
  22. SourceForge: Wiki: phpVirtualBox: vboxweb-service Configuration in Linux
  23. Step to Install: Step to install .deb file using command line terminal in Ubuntu
  24. The Chromium Projects: Chrome OS Systems Supporting Android Apps
  25. TurnKey Linux: Forums: Turnkey PHPVirtualBox Tutorial
  26. Ubuntu Documentation: UFW
  27. Ubuntu Wiki: Releases
  28. VirtualBox: User Manual: Chapter 7. Remote Virtual Machines
  29. VirtualBox: Download VirtualBox
  30. Website for Students: Manage Headless VirtualBox Host On Ubuntu 16.04 LTS With PhpVirtualBox, Apache2 And PHP 7.1

Chrome OS: My Missing Manual

$
0
0

Here is a list of accelerators and how-to related to Chrome OS. It will be maintained and updated regularly.

Accelerators

Screen Capture

Whole Screen [Ctrl] + [F5]
Select Window to File [Ctrl] + [Shift] + [F5]

System

Lock Screen [Ctrl] + [L]
There is no way to suspend. Just lock the screen and it would suspend later.
Show All Accelerators [Ctrl] + [Alt] + [/]

Mini How-To

N/A

Reference

  1. Google: Chromebook Help: Chromebook keyboard shortcuts
  2. Wiki: Chrome OS

Turnkey Linux: My Missing Manual

$
0
0

Here is a list of files and directories, mini how-to, and etc. related to TurnKey Linux[1]. It will be maintained and updated regularly.

Files and Directories

Configuration files, executables, directories, and etc. are maintained in this post[2].

Mini How-To

Create Customized TurnkeyLinux App Images

For creating a self-contained, no-default-password, no-default-IP image, use TKLDev[3]. This doc[4] explains from creating the first image, make changes, and etc.

Default Username for MySQL/Maria DB Adminer on V15.0

The default username is “adminer” according to a post in the forum[5]. Detail comparison of Adminer and phpMyAdmin can be found in the section “Adminer and phpMyAdmin Comparision” and “More Points to Compare” of “Adminer vs PHPMyAdmin”[6].

Footnotes

  1. TurnKey Linux
  2. TurnKey Linux Configuration and Executable Files
  3. TurnKey Linux: TKLDev
  4. GitHub: turnkeylinux-apps/tkldev/docs
  5. TurnKey Linux: Home/Forums/Support/Default username for Adminer?
  6. WPOven Blog: Adminer vs PHPMyAdmin

Hyper-V on Windows 10 Pro: My Missing Manual

$
0
0

Here is a list of accelerators and mini how-to related to Hyper-V in Windows 10 Pro[1] which is different from the Hyper-V on Windows Server[2]. It will be maintained and updated regularly.

Accelerators

System

Release Mouse[3] [Ctrl] + [Alt] + [←]
Full Screen Mode [Ctrl] + [Alt] + [Break]

Mini How-To

How to Share Files Between Guest and Host?

When Hyper-V is enabled, both the host and guest run on top of the Hyper-V virtualization layer. Only the host OS has direct access to all the hardware. I need to release the hardware in the host or it won’t be available in the guest.

Unfortunately, I try to follow the steps[4] but there is no “Offline” options on USB flash drive which has been identified as “Removable” instead of “Basic” in “Disk Management” in the host. A USB flash drive doesn’t work as a shared media because offline is not supported on removable drives.

There is a video[5] using USB drive on Hyper-V on Windows. But there are no “Local Resources” options as displayed at 1:37, the Windows 10 Pro’s build-in “Hyper-V Manager” doesn’t have this feature.

Finally, I created a virtual hard disk and mount it as a hard drive in the virtual machine in the “Settings” dialog in “Hyper-V Manager”.

To create and use a virtual hard disk:

  1. Launch “Computer Management” and switch to “Disk Management”.
  2. On the right “Actions” panel, use “Disk Management” → “More Actions” → “Create VHD”.
  3. Create a virtual hard disk in the “Create and Attach Virtual Hard Disk” dialog.
  4. It’s mounted as a new hard disk in “Disk Management” automatically.
  5. Click on the disk and select “Initial Disk” to create a partition.
  6. Click on the partition and select “New Simple Volume…” to assign its drive letter, file system, and volume name.
  7. Once finished, it would be opened by “File Explorer” automatically. Use it as a normal disk.

When I make it offline in the host, I may start the VM and see it in the guest. It won’t be visible by the host while being mounted in the guest. I have to shut down the guest to mount in the host. It could be accessed exclusively.

To use a virtual hard disk in the guest:

  1. Make sure the virtual hard disk has been detached in “Disk Management”. It cannot be used by any process or the guest will fail to launch.
  2. Open the “Settings…” dialog for the guest.
  3. “IDE Controller 0” → Add a new “Hard Drive” → assign the virtual hard disk → “OK” or “Apply” to confirm.
  4. If I use “Add hardware” → “SCSI Controller” → “Hard Drive” → assign the virtual hard disk → “OK” or “Apply” to confirm, the new disk won’t be visible in the guest. Also, the “Shared Drive” is not supported by the local storage in Windows 10 Pro: “The storage where the virtual hard disk is located does not support virtual hard disk sharing.”

Why there are so many virtual hard disk files with similar names?

Every time I create a checkpoint, it generates a new snapshot file with the extension “.avhdx” (my virtual hard disk has the extension “.vhdx”.) and the virtual machine setting will point to this new file automatically.

But the “Disk Management” on the host may only access the virtual hard disk, it cannot handle the snapshot. What I have done after the checkpoint in the guest won’t be accessed in the host.

Follow the steps[6] to merge the original virtual hard disk and its snapshots. I may access the latest version of the virtual hard disk in the host now. But the guest lost these snapshots of this virtual hard disk, they have been merged together.

Remember to update the “Virtual hard disk” in the vm setting or it will fail to launch.

Footnotes

  1. Microsoft: Virtualization / Hyper-V on Windows 10 / Introduction to Hyper-V on Windows 10
  2. Microsoft: Hyper-V on Windows Server
  3. serverfault: How to Release Mouse Capture in Windows 2008 Server Hyper-V Virtual Machine?
  4. StorageCraft: How To: Access a USB Hard Drive from a Hyper-V Virtual Machine
  5. YouTube: AssistanZ: Mount USB Drive into a VM in Hyper-V
  6. UseIT | Roman Levchenko: How to manually merge snapshots in Hyper-V
Viewing all 122 articles
Browse latest View live