Friday, May 31, 2019

Encoding PHP array to JSON, how to encode square brackets [] and deep nested JSON

Deeply nested and squared brackets in JSON

To make square brackets in JSON, which is basically array in JSON you need to use the  array operator twice, nested. So make it look like this. write some PHP
array(array('something'....
$data = json_encode(array(
    'list'=>array(array('commerce_price_aud' => array (....
Here's another example of deeply nested JSON with square brackets.

   $options = array(
     'name' => 'MySystem',
     'state' => 'INVENTORY',
     'lifeCycleState' => 'INVENTORY',
     'type' => 'My system Type',
     'gateway'  => array('serialNumber' => '1234', 'creationDate' => '12345678' ),
     'subscription'  => array('identifier' => '1234', 'operator' => '12345678' ),
     'labels' => array('labege'),
     'applications' => array(array('uid' => '171b9f022cd14c9b8e92d9ba6764db81')),
     'metadata'  => array('name1' => 'vale1', 'name2' => 'vale2' ),
     'communication' => array('msci' => array('host' => null, 'user' => null, 'password' => null),
         'm3da' => array('registrationPassword' => null, 'password' => null),
         'rest' => array('password' => null))
   );

   $out = json_encode($options);
...
looks like this
{
   "name": "MyFirstSystem",
   "state": "INVENTORY",
   "lifeCycleState": "INVENTORY",
   "type" : "my system type",
   "gateway":    {
      "serialNumber": "88545687",
      "creationDate": "1337948436603"
   },
   "subscription" : {
        "identifier" : "4569874563254156984",
        "operator": "OPERATOR_NAME"
    },
   "labels": ["labege"],
   "applications": [   {
      "uid": "171b9f022cd14c9b8e000000000000"
   }],
   "metadata": {
      "name1": "value1",
      "name2": "value2"
   },
   "communication" :   {
      "msci" :    {
          "host" : null,
          "user" : null,
          "password" : null
      },
      "m3da" :    {
          "registrationPassword" : null,
          "password" : null
      },
      "rest" :    {
          "password" : null
      }
   }
}
or could look like this in var_dump:
string(522) "{
     "name":"SIM 89332401000000000000",
     "state":"INVENTORY",
     "lifeCycleState":"INVENTORY",
     "type":"My system Type",
      "gateway":{
             "serialNumber":"1234",
             "creationDate":"1559339446"},
     "subscription":{
           "identifier":"899721912000000000000",
           "operator":"Sierra Wireless"},
     "labels":["labege"],
         "applications":[{
            "uid":"10592ab7d15342200000000000000"
      }],
     "metadata": {
        "name1":"vale1",
        "name2":"vale2"},
     "communication":{
        "msci":{"host":null,"user":null,"password":null},
     "m3da":{"registrationPassword":null,"password":null},
     "rest":{"password":null}}}"

Sunday, May 26, 2019

Can You Disable Caching on CSS style Sheets? A True Hack to Stop Caching.

Can We Prevent CSS Caching? Can we disable Caching of CSS pages? Can we Force a browser to re-read the CSS everytime?

Those Are The Questions that broke the internet, combined with the death of Grumpy Cat, whom we could never save, not with the best in veterinary medicine. Nothing can bring her back, not even cloning or cryogenic treatments. As for CSS, we could never prevent caching. If you are a web developer, you need to refresh you pages a lot. Unfortunately, your styles sheets will never change, because your stupid browser, whether it be Chrome, Firefox, internet explorer or Edge will happily save a copy of your old CSS and keep it, and use it to render your pages.   The other unfortunate effect is that the public, i.e. your viewers and customers browsers will hang onto an old version of stylesheet.   

Can we solve this? Is there some way to prevent CSS caching? Is there some magical tag that you can add to your HTML to prevent caching? The answer is NO, Grumpy Cat would also say NO, NO, NO, if she were still with us.  No HTML tag can stop this. The makers of web browsers don't think you need this feature. So no, its impossible.

However, there is a "work-around". Everyone in management hates workarounds. Time stamp your CSS links.

Here is a trick that comes from the world of JavaScript programmers. To prevent the caching of their css files, they add a timestamp to the end of the src attribute. We can do the same by turning .
We did a quick test to see if this trickery would even work. Here is how I included the stylesheet link in my index.php
<link rel="stylesheet" type="text/css" href="/style.css?<?php echo date('U'); ?>" />
Which results in this:
<link rel="stylesheet" type="text/css" href="/style.css?1558914597" />
Alter that date format as needed. We recommend using the "U" option to just show the number of seconds since January 1, 1970.

Brought to You By

This Tech Tidbit was brought to you by your Web Design Pros at Eleven Dimensions Computer Technologies. See the new 11D website at:

Many Thanks to Our Partner companies


Thursday, May 23, 2019

Ellie Mae Encompass - You have files that need to be attached

Encompass pop up dialog says "You have files that need to be attached"

You have files that need to be attached

Ellie Mae Encompass, Amurika's greatest home loan automation application.

Symptoms for this case include logging into Encompass and getting messages that there are Documents that need to be attached, or the Background Attaching dialog box is backed up and there are consecutive failed conversions. It does not matter how many times you try to attach them to the efolder, they will never get uploaded. It will not help to restart your computer or to clear out the UAC cache. 

How to fix:  Select No, and they will be deleted permanently.  Or clear out the files manually, as we describe below...

Why does this happen? Because your PDF's are scaled too big. They may exceeed the 11x17 page size limit.  They may have been poorman scanned from an IOS device such as iPhone, where your borrower just took a picture of the document, and then converted it to a PDF and then sent it to you. The resulting PDF would be scaled according to the focal distance. Best way to find out is to see the document properties from Adobe Acrobat and check the Page Size.

How to fix: You cannot force the attachments, instead you must remove them, scale them down using the Encompass virtual printer, and then reattach them. Here's how. Open Encompass, then open your loan, then click on eFolder icon on the upper right.  Then open the document that you want to upload with Adobe Acrobat, then Print the document, choose Encompass EFolder as the virtual printer. Encompass will open up or ask you to logon again.  Before doing this open the loan in question, then open its efolder.  Our advice is to get a trial copy of Adobe Acrobat DC, and then extend your trial indefinitely using your handy Adobe DC trial extension trick. 

Close Encompass and delete the following folders found at this file path: C:\Users\username\AppData\Roaming\Encompass

(Replace username with currently logged in user's Windows profile name)

BackgroundConversion
BackgroundUpload

(replace users with currently logged in user)

Restart Encompass, folder will auto generate, and queue for Background Attaching dialog box will be empty.

Article#: 000010878 Document Conversion Troubleshooting

Reasons Document Conversion can fail
1. Temp folder where conversion takes place is backed up
2. File to be uploaded includes oversized page sizes (11x17 inch limitation)
3. Low memory
Reasons Document Upload can fail
1. Temp folder where upload takes place is backed up
2. File is corrupted or contains security protection or authentication

Brought to You By

This Tech Tidbit was brought to you by your Encompass Pros at Eleven Dimensions Computer Technologies. See the new 11D website at:

Many Thanks to Our Partner companies

Windows Update Hall of Shame

The Hall of Shame


Occasionally, Windows updates can be really bad and really screw up your computers. Here's my list of the worst offenders.  These are only bad because they really screw up when Sophos Antivirus is installed.

KB4493472

This update can really interfere with Sophos antivirus. See the related story.  https://community.sophos.com/products/endpoint-security-control/f/sophos-endpoint-software/112101/sav-service-hangs-after-installing-kb4493472  If you have Windows 7, or Windows Server 2008, expect real trouble if you allow this one.

KB4499164

Once again, more issues caused by an update rollup. Causes Sophos Antivirus protected machines to hang and freeze.   It appears that once again there are conflicts with Sophos and the most recent (MAY) patch Tuesday from Microsoft. www.theregister.co.uk/.../ "Its advice on what to do is pretty blunt: uninstall the Windows update. Specifically, revert KB4499164 (May's full-fat Patch Tuesday) and KB4499165, the security-only update. As regular readers know, the latest Patch Tuesday is intended to mitigate a pretty nasty vuln (CVE-2019-0708) which permits unauthenticated remote code execution through the medium of Remote Desktop Services. Sophos itself opined that it was "so serious that Microsoft has even released patches for its long-unsupported operating systems, Windows 2003 and XP"."  Unfortunately, the new RDP worm bug needs this patch. See this:  https://portal.msrc.microsoft.com/en-US/security-guidance/advisory/CVE-2019-0708



KB4499175


A security only patch to fix the BlueKeep vulnerability. Get it from here: http://www.catalog.update.microsoft.com/Search.aspx?q=KB4499175

BlueKeep

Read about it:  https://www.scmagazineuk.com/devastating-exploit-using-ticking-bomb-bluekeep-only-weeks-away/article/1587473

Windows 7 for x64-based Systems Service Pack 14499164Monthly RollupRemote Code ExecutionCritical
4493472
4499175Security Only

Sunday, May 19, 2019

Unbricking and Recovering A Western Digital My Book Live World Edition

How to Recover, Rebuild and Unbrick Your Western Digital My Book Live

When you Mybook live is just showing red light in front, or the world edition shows just some steady white lights in front, you know it's really bad.  You can open it up, find the J8 solder pads on the board, and then solder on some header pins.  Connect those pins to a Prolific USB to Serial port converter. Just connect Grnd, URX and UTX, and then start it up.

The Live edition has an onboard JTAG and UART port. Until now I don't know the pinout of the JTAG so be warned to overwrite data in the NAND.
The Pinout of the UART Port "J8" is as follows: (your J8 port may not look like this at all, but it may just look like a 2x2 pin pad with a white square around it.
Pin 1 = +3.3V
Pin 2 = URX
Pin 3 = UTX
Pin 4 = GND
Warning: do not connect directly to a serial Port, you will need a ttl level shifter like the "Max233" or "FT232R". Otherwise you risk to break the hardware.
wd_mybook_live_UART.jpg
The UART Port will give you access to the console and during the booting to U-boot.
You will be able to change U-boot parameters, this will allow you to boot anything you want.
I would recommand that you backup the parameters before playing arround.
Baudrate is configured to: 115200
http://mybookworld.wikidot.com/wd-mybook-live-uart

Some Sample Output:
Initialising disks
No FIS received from device 1
No FIS received from device 1
Detecting SATA busses:
Bus 0: Found first device OK
  Device 0: Model: WDC WD10EADS-00L5B1  Firm: 01.01A01 Ser#: WD-WCAU4D836920
            Type: Hard Disk
            Supports 48-bit addressing
            Capacity: 953869.7 MB = 931.5 GB (1953525168 x 512)
  Device 1: not available
Environment successfully read from disk 0 primary image

U-Boot 1.1.2 (Oct  2 2008 - 12:51:43)

U-Boot code: 48D00000 -> 48D1B228  BSS: -> 48D1F040
## Unknown FLASH on Bank 0 - Size = 0x00000000 = 0 MB
Flash:  0 kB
In:    serial
Out:   serial
Err:   serial
WD 1NC Board

IDE read: device 0 block # 255, count 1 ... 1 blocks read: OK

Recovery mode selected
Hit any key to stop autoboot:  0

IDE device 0: Model: WDC WD10EADS-00L5B1  Firm: 01.01A01 Ser#: WD-WCAU4D836920
            Type: Hard Disk
            Supports 48-bit addressing
            Capacity: 953869.7 MB = 931.5 GB (1953525168 x 512)
... is now current device

IDE read: device 0 block # 300, count 5700 ... 5700 blocks read: OK
## Booting image at 48500000 ...
   Image Name:   Linux-2.6.24.4
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    1593324 Bytes =  1.5 MB
   Load Address: 48008000
   Entry Point:  48008000
   Verifying Checksum ... OK
OK

Starting kernel ...

Uncompressing Linux.............................................................                                                  ....................................... done, booting the kernel.
Linux version 2.6.24.4 (brian@dualla) (gcc version 4.2.4) #1 Tue Feb 10 11:00:22                                                   GMT 2009
...
raid1: raid set md125 active with 1 out of 2 mirrors
raid1 not hw raidable, needs two working disks.
md: ... autorun DONE.
EXT3-fs: unable to read superblock
EXT2-fs: unable to read superblock
FAT: unable to read boot sector
VFS: Cannot open root device "md0" or unknown-block(9,0)
Please append a correct "root=" boot option; here are the available partitions:
0800  976762584 sda driver: sd
  0801    1959930 sda1
  0802     257040 sda2
  0803     987997 sda3
  0804  973522935 sda4
097c  973522816 md124 (driver?)
097f     987904 md127 (driver?)
097e     256960 md126 (driver?)
097d    1959808 md125 (driver?)
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(9,0)

The above console output shows why it's now a brick and is completely bricked.