Saturday, August 11, 2018

Ionic 4 Debug With Chrome Sources

Problem
In Ionic 3, it was easy to find source .ts code in Chrome's developer tools "Sources" tab for debugging. In Ionic4, it's difficult to find.

Solution:
In Chrome developer tools "Sources" tab drill into:
webpack:// > . > src > app



Ionic 4 + Capacitor Calling Local API Blocked Mixed Content Error

Problem:
Ionic 4 + Capacitor app running locally on device. NodeJS + Express + MongoDB API running local on http (not https).

Can hit local API successfully when running Ionic in browser on API url localhost or IPv4 address (e.g. 192.168.15.8).

When running on device (connected via USB) get the following error on all API calls (in Chrome developer tools network tab): (blocked-mixed-content)

Solution:
Add: "allowMixedContent": true
To: \capacitor.config.json
https://github.com/ionic-team/capacitor/issues/630

Tuesday, April 24, 2018

Windows 10 Boot Failure Error Code 0xc000000e

Problem:
Windows tries to load but fails with blue screen.

Recovery
Your PC/Device needs to be repaired
The application or operating system couldn’t be loaded because a required file is missing or contains errors.
File: \Windows\system32\winload.exe
Error Code:0xc000000e



Solution:

I was unable to recover from this error! But Peter was able to -- highly recommended -- he knows his stuff: http://www.peterspcrepair.com/

Notes based on my limited understanding of the problem:

1.
This was one of the clearest articles I could find.
https://www.lifewire.com/how-to-rebuild-the-bcd-in-windows-2624508
However, my understanding is it's not a suitable fix for a UEFI SSD system drive.

2.
This was one of the clearest articles I could find suitable for UEFI.
https://www.easeus.com/partition-manager-software/fix-uefi-boot-in-windows-10-8-7.html#part5

My results from command prompt: list vol



What tripped me up is I kept thinking the UEFI volume was the same as the system drive. I could assign a letter and see the files on my system drive (i.e. my C:\ drive with windows). But this is the wrong drive to use for bcdboot. The UEFI is apparently always FAT32. I "think" I should have been using volume 5. Volume 7 seems to be from my Windows 10 recovery disk.

So I should have been running (from command prompt) this:
diskpart
sel disk 0
list vol
sel vol 5
assign letter=G: Note: G is a unique drive letter not already in use.

3.
Restoring from a recent restore point did NOT resolve the issue. But was done before the boot repair above.

4.
BIOS boot mode changed from "Dual" to "UEFI". Unclear if this was a necessary fix. My understanding is this was NOT necessary. PC had been working with zero issues for the past 3 months.

Friday, January 19, 2018

SuperMicro Desktop Workstation Build 2018

Personal SuperMicro Desktop Workstation Build 2018


Notes

  • Happy with price/value/performance.
  • A key requirement was a motherboard with at least one Thunderbolt 3 port.
  • SuperMicro chasis made building the PC very simple and worth every cent. Not visually appealing but not ugly. Fairly quiet.
  • CPU is hitting 100% for minutes with WAMP / Magento 2. In hindsight, would choose a motherboard that supports Xeon E5 which would have allowed for a CPU with more than 4 cores.
  • Broke the first motherboard unplugging the monster GPU. Additional cost to junk/replace.
  • BIOS bootup time seems long. ~15 secs.
  • Chasis front panel plug to motherboard not keyed. Easy to plug in the wrong way. Cable is short, so harder to plugin correct way.
  • More USB ports on the back needed.


SuperMicro Support Q&A


Question: How do I install Windows 10 to the blank system SSD from USB.

Answer: OS must be installed with UEFI mode for M.2 SSD. See youtube link as a reference. 
https://www.youtube.com/watch?v=vmFhB1-X-PQ

Question: What is the correct boot order to boot of the SSD system drive.

Answer: Change “UEFI Hard Disk: Windows Boot manager” to boot order #1.

Question: BIOS boot time is slow ~15 secs. How can I improve the speed.

Answer: BIOS needs to detect all the devices inside the system before booting to OS. You can try to disable all the PCIe slots option rom inside the BIOS and disable all the unnecessary features inside the BIOS like serial port.

Question: GPU covers the SSD M.2 port and is awkward to get it in and out. Can I use another port as it would make it easier to install and I’d have direct access to the SSD (if needed).

Answer: you can use slot #2 for your GPU if you don’t have any PCIe card on slot #4. If you have PCIe cards on both slot #2 & #4, then both slots will run as x8.

Components Checklist

  • Motherboard
  • CPU
  • CPU Heatsink
  • CPU Thermal Paste (just in case)
  • RAM
  • GPU
  • Chasis
  • SSD (system)
  • HDD (data)
  • SSD (portable/external)

Components


Motherboard
Supermicro Motherboard ATX for up to Xeon E3-1200v5
SuperMicro X11SAT (-F IPMI support was out of stock)

CPU
Intel Xeon E3-1275 v6 Kaby Lake 3.8 GHz 4 x 256KB L2 Cache 8MB L3 Cache LGA 1151 73W BX80677E31275V6 Server Processor

Interesting article on why to choose Xeon:

CPU Heatsink
Supermicro 2U Active CPU Heat Sink Socket LGA1150/1155 (SNK-P0046A4)

CPU Thermal Paste
Arctic Silver 5 High-Density Polysynthetic Silver Thermal Compound AS5-3.5G
*Didn't need because heatsink came with grease. Buy just in case heatsink needs to be removed.

RAM/Memory
Supermicro 16GB 288-Pin DDR4 2400 (PC4 19200) Server Memory (MEM-DR416L-SL01-EU24)
4 x $206 = $824

GPU
Nvidia GTX 1070 Ti
*Nvidia GTX 1080 Ti (preferred but out of stock globally).

Chassis/Case
SC743TQ-1200B-SQ 
865 Watts
SUPERMICRO CSE-743TQ-865B-SQ Black Pedestal Server Case 865W 2 External 5.25" Drive Bays

Power watts/calculator:

SSD System 1TB
SAMSUNG 960 PRO M.2 1TB NVMe PCI-Express 3.0 x4 Internal Solid State Drive (SSD) MZ-V6P1T0BW
  
HDD Data
WD Black 2TB Performance Desktop Hard Disk Drive - 7200 RPM SATA 2Gb/s 64MB Cache 3.5 Inch - WD2003FZEX

HDD Backup
WD Blue 6TB Desktop Hard Disk Drive - 5400 RPM SATA 6Gb/s 64MB Cache 3.5 Inch - WD60EZRZ

External SSD
Samsung Portable SSD T5 540 MB/s
*Temporary until a good/reliable/portable Thunderbolt 3 external drive available.

Friday, July 21, 2017

Magento 2 Enable Product on Import

Problem:
How to enable (or explicitly disable) a product using Magento 2 out-of-the-box product import.

Solution:
Include column product_online in the import and set values (1=enable, 0=disable) accordingly. Note that we'd expect this column to be called status instead since this is the attribute name. But adding column status instead does not work.

Friday, May 26, 2017

Magento 2.1 SOAP API Basics

Version: Magento 2.1+

The Magento SOAP API is made up of many services. Each service contains API endpoints.

Services that return sensitive data are secure and require a security token to access e.g. salesOrderRepositoryV1GetList. Services that do not return sensitive information do not require a token and are publicly available e.g. directoryCountryInformationAcquirerV1GetCountriesInfo

List of anonymous guest services is here: /soap/default?wsdl_list=1

Magento admin > Configuration > Services > Web API Security > Allow Anonymous Guest Access = Yes will allow additional anonymous guest services to be accessible. These services may return somewhat sensitive data e.g. cmsPageRepositoryV1.

Specify the service in the WSDL url. Specify multiple services in the WSDL url as needed. e.g. /soap/default?wsdl&services=customerCustomerRepositoryV1,salesOrderRepositoryV1

A token can be obtained by creating in Magento admin > System > Integrations > Create New Integration. Use the Access Token in the header of SOAP calls. e.g. $opts = ['http' => ['header' => "Authorization: Bearer " . $token]];

A token can also be obtained by creating a Magento admin user and then requesting a token based on the username/password e.g. $token = $request->integrationAdminTokenServiceV1CreateAdminAccessToken(array("username"=>"myusername", "password"=>"mypassword"));

Calling SOAP APIs from a PHP script may cache WSDL files on the client. For example, it was not possible to call protected APIs with a token. After deleting client wsdl files in /tmp folder the issue was resolved.

Wednesday, May 24, 2017

Magento Custom Multi Select Customer Attribute

Version: Magento 1.x

Problem:
Create a simple custom multi select customer attribute programmatically via upgrade script.

Solution:

$attributeCode = 'my_attribute';
$installer->addAttribute('customer', $attributeCode, array(
    'type' => 'varchar',
    'label' => 'My Attribute',
    'input' => 'multiselect',
    'source' => 'eav/entity_attribute_source_table',
    'backend' => '',
    'visible' => false,
    'required' => false,
    'unique' => false,
    'option' => array (
        'value' => array(
            'Option1' => array('Option1'),
            'Option2' => array('Option2')
        )
    )
));

$attribute = Mage::getSingleton('eav/config')
    ->getAttribute('customer', $attributeCode);
$attribute
    ->setData('used_in_forms', array('customer_account_edit'))
    ->setData('is_used_for_customer_segment', true)
    ->setData('is_system', false)
    ->setData('is_user_defined', true)
    ->setData('is_visible', false)
    ->setData('sort_order', 100);
$attribute->save();