Disable camel-debezium-mysql endpoint URI in Camel metrics - mysql

The full Debezium MySQL URI string shows up in metrics. It shows the MySQL user and password in plaintext, which is unsafe. How can one disable this? I followed this setup here.
More information:
Using quarkus 1.11.1.Final which uses camel 3.7.0 with debezium-connector-mysql 1.3.1.Final
This is the Camel route:
from("debezium-mysql:" + config.getConnectorName()
+ "?databaseHostname=" + config.getHost()
+ "&databasePort=" + config.getPort()
+ "&databaseUser=" + config.getUser()
+ "&databasePassword=" + config.getPassword()
+ "&databaseServerName=" + config.getDatabaseServerName()
+ "&databaseServerId=" + config.getDatabaseServerId()
+ "&databaseIncludeList=" + config.getDatabases()
+ "&tableIncludeList=" + config.getTables()
+ "&columnIncludeList=" + config.getColumns()
+ "&databaseHistoryFileFilename=" + config.getHistoryFile()
+ "&offsetStorageFileName=" + config.getStorageFile()
+ "&exchangePattern=InOnly")
.routeId("debezium")
.process(outgoingProcessor)
.marshal().json(JsonLibrary.Jackson)
.to(ExchangePattern.InOnly, outgoingUri)
.to("micrometer:counter:outgoing.counter")
.end();
And when accessing the metrics at /q/metrics, I find this entry:
# HELP CamelExchangeEventNotifier_seconds_max
# TYPE CamelExchangeEventNotifier_seconds_max gauge
CamelExchangeEventNotifier_seconds_max{camelContext="camel-1", endpointName="debezium-mysql://entire connection string here with user and password", eventType="ExchangeCompletedEvent", failed="false", serviceName="MicrometerEventNotifierService",} 0.0

Thank you for bring this up. I have created a Jira ticket to fix this in the upcoming Camel release to mask those sensitive data in those events in the metrics.

Related

Minimizing a system of linear equations with limited variables in Octave

I have scoured Octave resources, pdfs on optimization, and many of the questions here, but I can't seem to find or understand the right solution. I'm trying to find a corrective solution to move a group of data points to match closely another set. The equation used is a quadratic with a cross term, i.e. ax^2 +bx +c + d*y = x', where x is from one data set and x' is from another. There is a similar equation for the y coordinate.
I make the x and y values fixed from the data, and am trying to optimize the coefficients to minimize the square sum error between all the points. For now, I'm just trying to minimize the difference between x and x', via ax^2 +bx +c + d*y - x' = 0. I will try to do a square sum of all the equations later, unless someone here can help me with that as well.
I've tried using fminunc and fminsearch, both having and error after a few iterations due to matrix sizes. I don't think these solutions like having more equations than variables. I do not think qp or glpk are useful solutions.
Here is an example of my system of equations I'm trying to minimize. Future iterations may have as many as 32 equations, but the same number of vairables/coefficients.
function zer = fcn(coeff)
zer = zeros(18,1);
zer(1) = coeff(1)*19.338458^2 + coeff(2)*19.338458 + coeff(3) + coeff(4)*17.806945 - 23.200000;
zer(2) = coeff(1)*-0.146987^2 + coeff(2)*-0.146987 + coeff(3) + coeff(4)*2.273490 - 2.900000;
zer(3) = coeff(1)*-18.333520^2 + coeff(2)*-18.333520 + coeff(3) + coeff(4)*-19.133048 - -15.700000;
zer(4) = coeff(1)*-24.447818^2 + coeff(2)*-24.447818 + coeff(3) + coeff(4)*2.146905 - -21.700000;
zer(5) = coeff(1)*0.363997^2 + coeff(2)*0.363997 + coeff(3) + coeff(4)*27.305928 - 3.500000;
zer(6) = coeff(1)*15.042656^2 + coeff(2)*15.042656 + coeff(3) + coeff(4)*-15.456741 - 18.800000;
zer(7) = coeff(1)*18.529375^2 + coeff(2)*18.529375 + coeff(3) + coeff(4)*1.046316 - 22.100000;
zer(8) = coeff(1)*0.045810^2 + coeff(2)*0.045810 + coeff(3) + coeff(4)*-21.082700 - 3.300000;
zer(9) = coeff(1)*-18.499911^2 + coeff(2)*-18.499911 + coeff(3) + coeff(4)*22.048530 - -15.700000;
zer(10) = coeff(5)*17.806945^2 + coeff(6)*17.806945 + coeff(7) + coeff(8)*19.338458 - 16.000000;
zer(11) = coeff(5)*2.273490^2 + coeff(6)*2.273490 + coeff(7) + coeff(8)*-0.146987 - 0.300000;
zer(12) = coeff(5)*-19.133048^2 + coeff(6)*-19.133048 + coeff(7) + coeff(8)*-18.333520 - -21.400000;
zer(13) = coeff(5)*2.146905^2 + coeff(6)*2.146905 + coeff(7) + coeff(8)*-24.447818 - 0.400000;
zer(14) = coeff(5)*27.305928^2 + coeff(6)*27.305928 + coeff(7) + coeff(8)*0.363997 - 25.700000;
zer(15) = coeff(5)*-15.456741^2 + coeff(6)*-15.456741 + coeff(7) + coeff(8)*15.042656 - -18.300000;
zer(16) = coeff(5)*1.046316^2 + coeff(6)*1.046316 + coeff(7) + coeff(8)*18.529375 - -1.100000;
zer(17) = coeff(5)*-21.082700^2 + coeff(6)*-21.082700 + coeff(7) + coeff(8)*0.045810 - -23.200000;
zer(18) = coeff(5)*22.048530^2 + coeff(6)*22.048530 + coeff(7) + coeff(8)*-18.499911 - 20.200000;
endfunction
Erwin and Cris in the comments are 100% correct.
All that needs to be done here is convert this into a matrix with a answer vector.
best_solution = Matrix\answer_vector;
It's embarrassing how much I overcomplicated the problem.

Display text as html in Razor page

I've just started using Blazor and Razor pages.. it's a lot better than my old plain html pages I was building. But I'm having a problem converting my strings of html I build into actual HTML. Now, this works if I copy and paste my string and save that as an html page. It displays as html no problem. However, when I try to get my Razor page to display it, it displays as plain text. Even trying the trick:
<div>
#(new HtmlString(htmlString))
</div>
displays plain text. This is going to be painful as it's kind of long, but here is the string I'm trying to convert:
"<pre><br><b>STATION INFO</b><br><br> Extension: 34263 Lock Messages? n BCC: 0 <br> Type: 9630 Security Code: 12345 TN: 1<br> Port: S17746 Coverage Path 1: 132 COR: 44<br> Name: Lastname, Firstname Coverage Path 2: COS: 1<br><br><b>STATION OPTIONS</b><br> Time of Day Lock Table: <br> Loss Group: 19 Personalized Ringing Pattern: 1<br> Message Lamp Ext: 34263<br> Speakerphone: 2-way Mute Button Enabled? y<br> Display Language: english Expansion Module? <br> Survivable GK Node Name: <br> Survivable COR: internal Media Complex Ext: <br> Survivable Trunk Dest? IP SoftPhone? y<br><br> IP Video Softphone? n<br><br> Customizable Labels? y<br><br><br> <b>FEATURE OPTIONS</b><br><br> LWC Reception: spe Auto Select Any Idle Appearance? n<br> LWC Activation? y Coverage Msg Retrieval? y<br> LWC Log External Calls? n Auto Answer: none<br> CDR Privacy? n Data Restriction? n<br> Redirect Notification? y Idle Appearance Preference? n<br> Per Button Ring Control? n Bridged Idle Line Preference? n<br> Bridged Call Alerting? n Restrict Last Appearance? y<br> Active Station Ringing: continuous<br> EMU Login Allowed? n<br> H.320 Conversion? n Per Station CPN - Send Calling Number? y<br> Service Link Mode: as-needed EC500 State: unknown<br> Multimedia Mode: enhanced Audible Message Waiting? n<br> MWI Served User Type: sip-adjunct Display Client Redirection? n</pre><br>"
it's being built by my method that returns a string. For fun, here is my method:
public static string CreateStationString(List<StarfishStation> html)
{
var myHTML1 =
"<pre>" + "<br>" +
"<b>STATION INFO</b>" + "<br>" +
"" + "<br>" +
" Extension: " + html[0].DeftyExtension.PadRight(29, ' ') + "Lock Messages? " + html[0].DeftyMessagelock.PadRight(9, ' ') + "BCC: 0 <br>" +
" Type: " + html[0].DeftyDisplaysettype.PadRight(29, ' ') + "Security Code: " + html[0].DeftySecuritycode.PadRight(10, ' ') + "TN: " + html[0].DeftyTenantpartitionnumber + "<br>" +
" Port: " + html[0].DeftyPort.PadRight(27, ' ') + "Coverage Path 1: " + html[0].DeftyCoveragepath.PadRight(9, ' ') + "COR: " + html[0].DeftyCor + "<br>" +
" Name: " + html[0].DeftyName.PadRight(27, ' ') + "Coverage Path 2: " + html[0].DeftyCoverage2path.PadRight(9, ' ') + "COS: " + html[0].DeftyCos + "<br><br>" +
"<b>STATION OPTIONS</b>" + "<br>" +
" Time of Day Lock Table: <br>" +
" Loss Group: " + html[0].DeftyLossgroup + " Personalized Ringing Pattern: " + html[0].DeftyPersonalizedringpattern + "<br>" +
" Message Lamp Ext: " + html[0].DeftyMessagewaitlamplextension + "<br>" +
" Speakerphone: " + html[0].DeftySpeakerphone + " Mute Button Enabled? " + html[0].DeftyMutebutton + "<br>" +
" Display Language: " + html[0].DeftyLanguage.PadRight(32, ' ') + "Expansion Module? " + html[0].DeftyExpansionmodule + "<br>" +
" Survivable GK Node Name: <br>" +
" Survivable COR: internal Media Complex Ext: <br>" +
" Survivable Trunk Dest? IP SoftPhone? " + html[0].DeftyIpsoftphone + "<br>" +
"" + "<br>" +
" IP Video Softphone? n<br>" +
"<br>" +
" Customizable Labels? y<br><br>" +
"<br>" +
" <b>FEATURE OPTIONS</b><br><br>" +
" LWC Reception: " + html[0].DeftyLwcreception.PadRight(20, ' ') + "Auto Select Any Idle Appearance? " + html[0].DeftyIdleappearancepreference + "<br>" +
" LWC Activation? " + html[0].DeftyLwcactivation.PadRight(29, ' ') + "Coverage Msg Retrieval? " + html[0].DeftyCoveragemessageretrieval + "<br>" +
" LWC Log External Calls? " + html[0].DeftyLwclogexterncall.PadRight(40, ' ') + "Auto Answer: " + html[0].DeftyAutoanswer + "<br>" +
" CDR Privacy? " + html[0].DeftyCdrprivacy.PadRight(35, ' ') + "Data Restriction? " + html[0].DeftyDatarestriction + "<br>" +
" Redirect Notification? " + html[0].DeftyRedirectnotification.PadRight(25, ' ') + "Idle Appearance Preference? " + html[0].DeftyIdleappearancepreference + "<br>" +
" Per Button Ring Control? " + html[0].DeftyPerbuttonnringcontrol.PadRight(23, ' ') + "Bridged Idle Line Preference? n" + "<br>" +
" Bridged Call Alerting? " + html[0].DeftyBridgecallalerting.PadRight(27, ' ') + "Restrict Last Appearance? " + html[0].DeftyRestrictlastappearance + "<br>" +
" Active Station Ringing: " + html[0].DeftyActivestationringing + "<br>" +
" EMU Login Allowed? " + html[0].DeftyEMULoginAllowed + "<br>" +
" H.320 Conversion? " + html[0].DeftyH320conv.PadRight(14, ' ') + "Per Station CPN - Send Calling Number? " + html[0].DeftyCpnrestriction + "<br>" +
" Service Link Mode: " + html[0].DeftyServicelinkmode.PadRight(31, ' ') + "EC500 State: unknown<br>" + //check ec500
" Multimedia Mode: " + html[0].DeftyMultimediamode.PadRight(28, ' ') + "Audible Message Waiting? " + html[0].DeftyAudiblemessagewaiting + "<br>" +
" MWI Served User Type: " + html[0].DeftyMessagewaitindicatortype.PadRight(25, ' ') + "Display Client Redirection? n</pre><br>";
return myHTML1;
}
When I look at the frame source, here's what I see:
<div>
<pre><br><b>STATION INFO</b><br><br> Extension: 34263 Lock Messages? n BCC: 0 <br> Type: 9630 Security Code: 12345 TN: 1<br> Port: S17746 Coverage Path 1: 132 COR: 44<br> Name: Lastname Firstname Coverage Path 2: COS: 1<br><br><b>STATION OPTIONS</b><br> Time of Day Lock Table: <br> Loss Group: 19 Personalized Ringing Pattern: 1<br> Message Lamp Ext: 34263<br> Speakerphone: 2-way Mute Button Enabled? y<br> Display Language: english Expansion Module? <br> Survivable GK Node Name: <br> Survivable COR: internal Media Complex Ext: <br> Survivable Trunk Dest? IP SoftPhone? y<br><br> IP Video Softphone? n<br><br> Customizable Labels? y<br><br><br> <b>FEATURE OPTIONS</b><br><br> LWC Reception: spe Auto Select Any Idle Appearance? n<br> LWC Activation? y Coverage Msg Retrieval? y<br> LWC Log External Calls? n Auto Answer: none<br> CDR Privacy? n Data Restriction? n<br> Redirect Notification? y Idle Appearance Preference? n<br> Per Button Ring Control? n Bridged Idle Line Preference? n<br> Bridged Call Alerting? n Restrict Last Appearance? y<br> Active Station Ringing: continuous<br> EMU Login Allowed? n<br> H.320 Conversion? n Per Station CPN - Send Calling Number? y<br> Service Link Mode: as-needed EC500 State: unknown<br> Multimedia Mode: enhanced Audible Message Waiting? n<br> MWI Served User Type: sip-adjunct Display Client Redirection? n</pre><br>
</div>
Sorry this is so long.. but can anyone please help me out?
Thanks!
Dave M.
Wow ok.. so stumbled upon the answer:
<div>
#((MarkupString)htmlString)
</div>
instead of:
<div>
#(new HtmlString(htmlString))
</div>
found the answer here: Convert plain text with html tags to html string and render it in Blazor

Why CurrentApp::AppId take so long in Windows Phone 10?

I have a windows 8 universal project and have a function to get APP ID,
The following function works well in Windows Phone 8.1
Platform::Guid appId = Windows::ApplicationModel::Store::CurrentApp::AppId;
however, it spent around 40s in Windows Phone 10.
From MSDN, only the Metadata is different,
May I know is it caused by the metadata? And how to solve it?
To instead of using AppID, you might use the following code,
Windows::ApplicationModel::Package^ package = Windows::ApplicationModel::Package::Current;
Windows::ApplicationModel::PackageId^ packageId = package->Id;
Windows::ApplicationModel::PackageVersion version = packageId->Version;
Platform::String^ output =
"Name: \"" + packageId->Name + "\"\n" +
"Version: " + version.Major.ToString() + "."
+ version.Minor.ToString() + "."
+ version.Revision.ToString() + "."
+ version.Build.ToString() + "\n" +
"Architecture: " + packageId->Architecture.ToString() + "\n" +
"ResourceId: \"" + packageId->ResourceId + "\"\n" +
"Publisher: \"" + packageId->Publisher + "\"\n" +
"PublisherId: \"" + packageId->PublisherId + "\"\n" +
"FullName: \"" + packageId->FullName + "\"\n" +
"FamilyName: \"" + packageId->FamilyName + "\"\n" +
"IsFramework: " + package->IsFramework.ToString();
Sample output from device
Output:
Name: "f3e02737-ddfa-47a0-a837-37ee53459898"
Version: 1.0.0.0
Architecture: Arm
ResourceId: ""
Publisher: "CN=heefan"
PublisherId: "gsbawe9kfjm1p"
FullName: "f3e02737-ddfa-47a0-a837-37ee53459898_1.0.0.0_arm__gsbawe9kfjm1p"
FamilyName: "f3e02737-ddfa-47a0-a837-37ee53459898_gsbawe9kfjm1p"
IsFramework: false
I also have no idea why AppID take long time to compute.

Is there command line to deploy chrome extension for faster development?

http://developer.chrome.com/extensions/getstarted.html
In the docs,
it instructs we have to open the chrome:extesion page every time and load our own extension
is there any way to use command line such that i can do faster?
(mac OS or linux)
Thanks
Check out chrome.runtime.reload(). I haven't used it myself, but I suppose you could put a button somewhere convenient and trigger that method with it.
A team I am working with on a Chrome extension has figured out the following CHROME_RUN.py Python script:
cwd = sys.path[0]
CHROME_EXTENSION_DIR = cwd + "/Chrome-Extension"
TEMP_DIR = tempfile.mkdtemp()
TEMP_CHROME_PROFILE = TEMP_DIR + "/Chrome-Temp-Profile"
ccUrl = "PAGE_TO_OPEN.HTML"
if not os.path.exists(TEMP_DIR):
os.makedirs(TEMP_DIR)
FULL_CHROME_ARGS = "-user-data-dir=" + TEMP_CHROME_PROFILE + " --load-extension=" + CHROME_EXTENSION_DIR + " \"" + ccUrl + "\"";
if _platform == "win32":
os.system("BUILD_CHROME_PROJECT.py")
os.system("start chrome " + "-user-data-dir=" + TEMP_CHROME_PROFILE + " --load-extension=" + CHROME_EXTENSION_DIR + " \"" + ccUrl + "\"")
elif _platform == "darwin":
os.system("python BUILD_CHROME_PROJECT.py")
os.system("open /Applications/Google\ Chrome.app --args " + "-user-data-dir=" + TEMP_CHROME_PROFILE + " --load-extension=" + CHROME_EXTENSION_DIR + " \"" + ccUrl + "\"")
elif _platform == "linux" or _platform == "linux2":
os.system("./BUILD_CHROME_PROJECT.py")
os.system("chromium " + "-user-data-dir=" + TEMP_CHROME_PROFILE + " --load-extension=" + CHROME_EXTENSION_DIR + " \"" + ccUrl + "\"")
shutil.rmtree(TEMP_DIR)
which is compatible with OSX, Windows and Linux.
If you are looking for the actual arguments to provide Chrome, it is as follows:
FULL_CHROME_ARGS = "-user-data-dir=" + TEMP_CHROME_PROFILE + " --load-extension=" + CHROME_EXTENSION_DIR + " \"" + ccUrl + "\"";
It will creates a temporary profile and launches Chrome with the provided URL. This version of Chrome is similar to how FireFox sandboxes an instance of the browser for plugin testing (fresh, clean instance of the browser with history, cache, etc. from your browsing history)
Go to the extension page, press ctrl+R, the original extension will be reloaded automatically and that doesn't need to do any import action any more.

Paste to mysql CLI does not work - it loses some characters

I paste a >2KB SQL file to mysql CLI and it randomly loses characters and then reports syntax error in my SQL.
For example:
(.....)
UPDATE ct_transform_target_summary
SET
ytd_margin_target = jul_margin_target + aug_margin_target + sep_margin_target + oct_margin_target + nov_margin_target + dec_margin_target +
jan_margin_target + feb_margin_target + mar_margin_target + apr_margin_target + may_margin_target + jun_margin_target,
ytd_adjustments = jul_margin_adj + aug_margin_adj + sep_margin_adj + oct_margin_adj + nov_margin_adj + dec_margin_adj +
jan_margin_adj + feb_margin_adj + mar_margin_adj + apt_margin_adj + may_margin_adj + jun_margin_adj,
ytd_margin = jul_margin + aug_margin + sep_margin + oct_margin + nov_margin + dec_margin +
jan_margin + feb_margin + mar_margin + apr_margin + may_margin + jun_margin;
(....)
Becomes:
(....)
->
->
-> SET
-> ytd_margin_target = jul_margin_target + aug_margin_target + sep_margin_target + oct_margin_target + nov_margin_target + dec_margin_target +
->
-> ytd_adjustments = jul_margin_adj + aug_margin_adj + sep_margin_adj + oct_margin_adj + nov_margin_adj + dec_margin_adj +
-> jan_margin_adj + feb_ma
-> ytd_margin = jul_margin + aug_margin + sep_margin + oct_margin + nov_margin + dec_margin +
-> jan_margin + feb_margin + mar_margin + apr_margin + may_
This apparently never happens to short SQL code, but only happens to long code.
Could this be caused by my terminal (Fedora 17 Gnome terminal) or could it be an issue of mysql CLI?
Never had I experienced such problem in terminal before. It only happens in mysql cli.
Write the SQL to a file, ie: query.sql, then use the source command in the mySQL CLI.
$ vi query.sql
$ mysql -h db.host.tld -u user -p
mysql> use mydatabase
mysql> source query.sql
Pasting into the MySQL CLI client is tricky, because it uses Readline for interactive line editing. Readline interprets certain input as control sequences and does not pass them verbatim to the MySQL client. The character most likely to be causing problems in your case is tabulation, used often for indentation purposes in SQL, but used in Readline for tab completion. Inadvertent tab completion in the middle of your query might have very unexpected results and it is often hard to pinpoint the exact location where it has introduced interference.
I think Sammitch is on the right track here, but I believe that solution only works if you are logged into the machine where mysql is living. The following should work from anywhere.
$ vi query.sql
$ mysql -h db.host.tld -u user -p mydatabase < query.sql
Pasting into the CLI always makes me nervous!
Does this happen when you paste to a file in your terminal on your mysql server? Most likely you are having a buffer issue when pasting across the network. But I would check pasting to a file on the same server and if that works, then it is the mysql cli that is causing some issue, but I bet it's just the network latency causing problems.