Tuesday, February 16, 2021

Comcast CM-500 with Linksys G wireless

1. Connect Netgear CM500 to Cable wall port

2. Power on CM500

wait to see all light(power,up stream/downsteam/online) turn solid green

(if not, change to a different Cox wall port...), this is a must be before go to next. 


3. Connect PC to Netgear internet port and try to access google.com(if no access, call Camcast for 4 and 5)

4. Active your account

5. Add Netgear to your account

If succeed, go next:

6. Connect Netgear internet port to Linsys Wireless Internet port

192.168.1.1

Change name/password...

Make sure to enable MAC Address Clone(Clone to connected PC)

Don't forget this, otherwise internet will not work for Wireless

connect pc to Linksys Cable port(shall have access)

7. Reboot Linksys

Shall have wireless

Monday, January 11, 2021

APEX: PopUP LOV multiple columns width control

 put following JS in the item 'initial js to run' field to control the columns width:

function(options) {

  var col, columns = options.columns;


  // set a minimum width for the dialog

  options.minWidth = 800;


  // set custom column widths for each column

  col = columns.SERVER_NAME;

  col.width = 120;

  col = columns.ENVIRONMENT;

  col.width = 220;

  col = columns.APP;

  col.width = 220;


  // the last two columns do not stretch

  col = columns.LOCATION;

  col.width = 80;

  col.noStretch = true;

  return options;

}

Thursday, June 11, 2020

Using python to get file from Azure Blob Storage using shared key

Here is the code to get file from Azure Blob Storage:



import base64
import hmac
import hashlib
import datetime

import requests

storage_account='your account name'
file_path='the path of your file'
token='shared key of your account'
def _sign_string(key, string_to_sign):
        key = base64.b64decode(key.encode('utf-8'))
        string_to_sign = string_to_sign.encode('utf-8')
        signed_hmac_sha256 = hmac.HMAC(key, string_to_sign, hashlib.sha256)
        digest = signed_hmac_sha256.digest()
        encoded_digest = base64.b64encode(digest).decode('utf-8')
        return encoded_digest

now = datetime.datetime.utcnow().strftime('%a, %d %b %Y %H:%M:%S GMT')
url ='https://{account}.blob.core.windows.net/{path}'.format(account=storage_account,path=file_path)
version = '2009-09-19'  ## you may change this based on the version you are using
headers = {'x-ms-version': version,'x-ms-date': now}

content = 'GET{spaces}x-ms-date:{now}\nx-ms-version:{version}\n/{account}/{path}'.form
at(spaces='\n'*12,now=now, version=version, account=storage_account, path=file_path)

headers['Authorization'] = 'SharedKey ' + storage_account + ':' + _sign_string(token,
content)

response = requests.get(url, headers=headers)
assert response.status_code == 200
file = open("oci_servers.csv", "w")
file.write(response.text)
file.close()
#print response.text

Wednesday, March 11, 2020

Report-- Show column only when download to csv

in the col condition, chose PL/SQL compression and put this:

:REQUEST LIKE 'FLOW_EXCEL_OUTPUT%'

Friday, February 28, 2020

APEX: text highlighter with Mark.js

Today I have a need to highlighter some of the key word(typed in search string) in the report and I find out this wonderful Mark.js library(you can find all the detail here https://markjs.io/)

Here is what I did for the Classic Report:

1. include the javascripts: include this url in the File URLS section of the page(Here I am using the JQuery model):

https://cdnjs.cloudflare.com/ajax/libs/mark.js/8.11.1/jquery.mark.min.js

2. put following css in the CSS inline section of the page:

mark {
  padding: 0;
  background: #00ff19;
  color: black;  
}

3. create a after refresh DA and put following javascripts in the action:

$('.t-Report-cell').mark($v('Pxx_SEARCH'), {"separateWordSearch": false});

Pxx_SEARCH is my search item in my page

There are many options available(check detail in https://markjs.io/). You can set up by your choice.

Tuesday, October 15, 2019

Log Errors when insert select all

When you use insert into ., select ... statement, if few of your data will have issues, your statement will fail due to violation of some existing constraints. To avoid this happening, which means you want to make sure all the 'good' data are still being inserted while keep your eye on those 'bad' boys, you can use log errors feature:

1. set up the base error log table:

BEGIN
  DBMS_ERRLOG.create_error_log (dml_table_name => 'XXXXX');
END;

XXX is your table name that you are going to insert to
This will create a table err$_XXX which will store all error data/log

2. Add log errors at the end of your insert statement

insert into .... 
LOG ERRORS INTO err$_XXX ('INSERT') REJECT LIMIT UNLIMITED;

Friday, August 30, 2019

Oracle APEX: url inside email contains ROWID

If your email contains a url which has ROWID as part of it, be careful because sometime the ROWID has some 'special' character which the browser will 'convert' it to 'space' and when that happens, ur url will broke(today I have one record which has the '+' in the ROWID).

Here is how to get it address:

inside your email procedure, replace the rowid with APEX_UTIL.URL_ENCODE(IN_ROWID), so your procedure will looks like this:

Before change:

create or replace procedure my_email(in_rowid varchar2) is
begin
 ...
 ...
 url:='https://xxx/apex/f?p=207:442:::NO::P442_ROWID:'||in_rowid;
...
end;

After change:

create or replace procedure my_email(in_rowid varchar2) is
begin
 ...
 ...
 url:='https://xxx/apex/f?p=207:442:::NO::P442_ROWID:'||APEX_UTIL.URL_ENCODE(in_rowid);
...
end;