How can I get BrowserBuild property in Browser Hawk - coldfusion

I am using Browser Hawk version (14.0.1.0) to detect browsers. But its showing IE 9 and IE 11 as IE 7 and IE 10 as NetScape version 5. I went through the forum of Browser Hawk where its written that for IE 9, IE 10 running in emulate IE 7 mode, the browser hawk will detect it as IE 7. So I need to check with the BrowserBuild property of browser. Please refer: https://www.cyscape.com/support/kb/XcIBViewItem.asp?id=951. Now I have written the code to get the BrowserBuild property. My code is
variables.bh = CreateObject("java", "com.cyscape.browserhawk.BrowserHawk");
variables.bi = bh.getBrowserInfo(getPageContext().getRequest());
variables.ebi = CreateObject("java","com.cyscape.browserhawk.ExtendedBrowserInfo");
variables.options = CreateObject("java","com.cyscape.browserhawk.ExtendedOptions");
variables.options.addProperties("BrowserBuild");
variables.req = getPageContext().getRequest();
variables.res = getPageContext().getResponse();
variables.ebi = variables.bh.getExtendedBrowserInfo(variables.req, variables.res, variables.options);
writeDump(variables.ebi.getBrowserBuild);
I am using ColdFusion server side language. Now its giving undefined value for BrowserBuild.
Again when I am dumping the browser build field like
WriteDump(variables.ebi.BROWSERBUILD);
Its giving 137438953472 for all browsers.
Any one please help how can I get the BrowserBuild property.

Related

Open a c++ application installed on computer with a custom url in browser [duplicate]

How do i set up a custom protocol handler in chrome? Something like:
myprotocol://testfile
I would need this to send a request to http://example.com?query=testfile, then send the httpresponse to my extension.
The following method registers an application to a URI Scheme. So, you can use mycustproto: in your HTML code to trigger a local application. It works on a Google Chrome Version 51.0.2704.79 m (64-bit).
I mainly used this method for printing document silently without the print dialog popping up. The result is pretty good and is a seamless solution to integrate the external application with the browser.
HTML code (simple):
Click Me
HTML code (alternative):
<input id="DealerName" />
<button id="PrintBtn"></button>
$('#PrintBtn').on('click', function(event){
event.preventDefault();
window.location.href = 'mycustproto:dealer ' + $('#DealerName').val();
});
URI Scheme will look like this:
You can create the URI Scheme manually in registry, or run the "mycustproto.reg" file (see below).
HKEY_CURRENT_USER\Software\Classes
mycustproto
(Default) = "URL:MyCustProto Protocol"
URL Protocol = ""
DefaultIcon
(Default) = "myprogram.exe,1"
shell
open
command
(Default) = "C:\Program Files\MyProgram\myprogram.exe" "%1"
mycustproto.reg example:
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Classes\mycustproto]
"URL Protocol"="\"\""
#="\"URL:MyCustProto Protocol\""
[HKEY_CURRENT_USER\Software\Classes\mycustproto\DefaultIcon]
#="\"mycustproto.exe,1\""
[HKEY_CURRENT_USER\Software\Classes\mycustproto\shell]
[HKEY_CURRENT_USER\Software\Classes\mycustproto\shell\open]
[HKEY_CURRENT_USER\Software\Classes\mycustproto\shell\open\command]
#="\"C:\\Program Files\\MyProgram\\myprogram.exe\" \"%1\""
C# console application - myprogram.exe:
using System;
using System.Collections.Generic;
using System.Text;
namespace myprogram
{
class Program
{
static string ProcessInput(string s)
{
// TODO Verify and validate the input
// string as appropriate for your application.
return s;
}
static void Main(string[] args)
{
Console.WriteLine("Raw command-line: \n\t" + Environment.CommandLine);
Console.WriteLine("\n\nArguments:\n");
foreach (string s in args)
{
Console.WriteLine("\t" + ProcessInput(s));
}
Console.WriteLine("\nPress any key to continue...");
Console.ReadKey();
}
}
}
Try to run the program first to make sure the program has been placed in the correct path:
cmd> "C:\Program Files\MyProgram\myprogram.exe" "mycustproto:Hello World"
Click the link on your HTML page:
You will see a warning window popup for the first time.
To reset the external protocol handler setting in Chrome:
If you have ever accepted the custom protocol in Chrome and would like to reset the setting, do this (currently, there is no UI in Chrome to change the setting):
Edit "Local State" this file under this path:
C:\Users\Username\AppData\Local\Google\Chrome\User Data\
or Simply go to:
%USERPROFILE%\AppData\Local\Google\Chrome\User Data\
Then, search for this string: protocol_handler
You will see the custom protocol from there.
Note: Please close your Google Chrome before editing the file. Otherwise, the change you have made will be overwritten by Chrome.
Reference:
https://msdn.microsoft.com/en-us/library/aa767914(v=vs.85).aspx
Chrome 13 now supports the navigator.registerProtocolHandler API. For example,
navigator.registerProtocolHandler(
'web+custom', 'http://example.com/rph?q=%s', 'My App');
Note that your protocol name has to start with web+, with a few exceptions for common ones (like mailto, etc). For more details, see: http://updates.html5rocks.com/2011/06/Registering-a-custom-protocol-handler
This question is old now, but there's been a recent update to Chrome (at least where packaged apps are concerned)...
http://developer.chrome.com/apps/manifest/url_handlers
and
https://github.com/GoogleChrome/chrome-extensions-samples/blob/e716678b67fd30a5876a552b9665e9f847d6d84b/apps/samples/url-handler/README.md
It allows you to register a handler for a URL (as long as you own it). Sadly no myprotocol:// but at least you can do http://myprotocol.mysite.com and can create a webpage there that points people to the app in the app store.
This is how I did it. Your app would need to install a few reg keys on installation, then in any browser you can just link to foo:\anythingHere.txt and it will open your app and pass it that value.
This is not my code, just something I found on the web when searching the same question. Just change all "foo" in the text below to the protocol name you want and change the path to your exe as well.
(put this in to a text file as save as foo.reg on your desktop, then double click it to install the keys)
-----Below this line goes into the .reg file (NOT including this line)------
REGEDIT4
[HKEY_CLASSES_ROOT\foo]
#="URL:foo Protocol"
"URL Protocol"=""
[HKEY_CLASSES_ROOT\foo\shell]
[HKEY_CLASSES_ROOT\foo\shell\open]
[HKEY_CLASSES_ROOT\foo\shell\open\command]
#="\"C:\\Program Files (x86)\\Notepad++\\notepad++.exe\" \"%1\""
Not sure whether this is the right place for my answer, but as I found very few helpful threads and this was one of them, I am posting my solution here.
Problem: I wanted Linux Mint 19.2 Cinnamon to open Evolution when clicking on mailto links in Chromium. Gmail was registered as default handler in chrome://settings/handlers and I could not choose any other handler.
Solution:
Use the xdg-settings in the console
xdg-settings set default-url-scheme-handler mailto org.gnome.Evolution.desktop
Solution was found here https://alt.os.linux.ubuntu.narkive.com/U3Gy7inF/kubuntu-mailto-links-in-chrome-doesn-t-open-evolution and adapted for my case.
I've found the solution by Jun Hsieh and MuffinMan generally works when it comes to clicking links on pages in Chrome or pasting into the URL bar, but it doesn't seem to work in a specific case of passing the string on the command line.
For example, both of the following commands open a blank Chrome window which then does nothing.
"c:\Program Files (x86)\Google\Chrome\Application\chrome.exe" "foo://C:/test.txt"
"c:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --new-window "foo://C:/test.txt"
For comparison, feeding Chrome an http or https URL with either of these commands causes the web page to be opened.
This became apparent because one of our customers reported that clicking links for our product from a PDF being displayed within Adobe Reader fails to invoke our product when Chrome is the default browser. (It works fine with MSIE and Firefox as default, but not when either Chrome or Edge are default.)
I'm guessing that instead of just telling Windows to invoke the URL and letting Windows figure things out, the Adobe product is finding the default browser, which is Chrome in this case, and then passing the URL on the command line.
I'd be interested if anyone knows of Chrome security or other settings which might be relevant here so that Chrome will fully handle a protocol handler, even if it's provided via the command line. I've been looking but so far haven't found anything.
I've been testing this against Chrome 88.0.4324.182.
open
C:\Users\<Username>\AppData\Local\Google\Chrome\User Data\Default
open Preferences then search for excluded_schemes you will find it in 'protocol_handler' delete this excluded scheme(s) to reset chrome to open url with default application

Woff2 fonts gone in cefsharp on Windows Server 2012R2

Using Cefsharp for Windows Forms (all latest version)...
I added Cefsharp to a new solution and I created this code:
Private _chromeBrowser As ChromiumWebBrowser
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Call InitializeChromium()
End Sub
Private Sub InitializeChromium()
Dim settings As New CefSettings()
settings.CefCommandLineArgs.Add("disable-gpu", "1")
CefSharp.Cef.Initialize(settings)
_chromeBrowser = New ChromiumWebBrowser("https://js.devexpress.com/Demos/WidgetsGallery/Demo/SelectBox/Overview/Knockout/Light/")
Me.Controls.Add(_chromeBrowser)
_chromeBrowser.Dock = DockStyle.Fill
End Sub
The url I use, have some Woff2 fonts in eg. thier selectbox.
If I run the app in Windows 10, I see the dropdown (woff2) fine:
But if I run the code on my Windows Server 2012R2, the icons are missing:
If I open Chrome on my Windows Server 2012R2 and open the url, then the arrows are shown. So it is only when using Cefsharp.
Any idea why the woff2 font are not shown in a Cefsharp running on Windows Server 2012R2?
In my case, I was developing in Windows 8. I have updated font-face local to url
and it is okay now.
Ref: https://bitbucket.org/chromiumembedded/cef/issues/2858/fonts-not-loading-look-wrong-on-windows-7
solution.jpg

SharePoint 2013 unable to add or edit pages after visual upgrade to 2013

My site collection is throwing error while creating or editing pages after performing visual upgrade from 2010 to 2013 mode. I am able to create/edit, sub sites, lists, but not publishing pages. Unable to navigate to "Page Layouts and Site Templates" page from site settings. I am able to add/edit pages from sub site as long as I do not activate Publishing feature on the sub site. Once the publishing feature is activated the problem starts.
Error while creating a page:
Sorry, something went wrong
Data at the root level is invalid. Line 1, position 1.
Technical Details
Troubleshoot issues with Microsoft SharePoint Foundation.
Correlation ID:
Error from Logs:
Name=Request (POST:https://.com:443/sites//_layouts/15/CreatePublishingPageDialog.aspx?IsDlg=1)
Non-OAuth request. IsAuthenticated=True, UserIdentityName=0e.t|pingfederatests|, ClaimsCount=58
Site=/sites/
Spent 0 ms to bind 29925 byte file stream
WARNING: Cannot change FormContext.FormMode to [Invalid] because it is already set to [New]
WARNING: Cannot change FormContext.FormMode to [Invalid] because it is already set to [New]
Micro Trace Tags: 0 nasq,1 agb9s,50 7fz4,0 7fz4
Leaving Monitored Scope (Request (POST:https://.com:443/sites//_layouts/15/CreatePublishingPageDialog.aspx?IsDlg=1)). Execution Time=81.1101690298627
I am able to resolve this by updating the default page layout of the site collection using PowerShell. Followed the solution from http://www.justinkobel.com/post/2014/01/02/Error-in-SharePoint-Publishing-Sites-For-Default-Pages
Add-PSSNapin Microsoft.SharePoint.PowerShell
$site = Get-SPSite https://sitecollectionURL
$publishingSite = New-Object Microsoft.SharePoint.Publishing.PublishingSite($site)
$publishingWeb = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($site.RootWeb)
$pageLayout = $publishingWeb.GetAvailablePageLayouts() | ? { $_.Name -eq "BlankWebPartPage.aspx" }
$publishingWeb.SetDefaultPageLayout($pagelayout, $true)
$publishingWeb.Update()

ADOQuery on C++ Builder 6 and Windows 7 64bit

I am having a weird problem using the TADOQuery component.
I currently work at a place where they are using Borland C++Builder applications that run on a Windows XP VM. So we want to move to Windows 7 and serve it as a terminal so employees can receive new machines with Windows 10 without the need to create Win XP VM on each machine again.
Currently the application uses BDE components and it works great on XP. We created a Win7 64bit VM for testing, and installed the necessary driver etc, but BDE just won't work. When I try to login through the SQL Explorer that comes with Borland, it just hangs. It sends the request but never gets a response. I spent more than a week trying to debug this issue, but didn't get anywhere with it.
Anyways, I gave up on BDE and wanted to try to change to ADO. So I started by simply creating a TDBGrid and fill it with data using ADO components. It worked great on both XP and Win7! So now I am trying to convert the applications' BDE components (TDataBase, TQuery, etc) to ADO components.
I came across an interesting issue when trying to use parameters. Here is a query example:
SELECT t1.SEC_CODE, t1.CODE, t1.CTRL_NUM, t1.CHECK_CODE,
t1.CHECK_NO, t1.CLIENT_ID, t1.AMOUNT, t1.TRANS_NO, decode(t2.prefix,null,t2.name,t2.name||', '||t2.prefix) as fullName,
t1.ENTRY_DATE, t1.DEPOSIT_DATE, t1.ACCT_COMMENT, t2.NAME, t2.PREFIX
FROM ACCOUNTING.ACCT_CHECK_IN t1, OISC.CLIENT t2
WHERE
(:BEN =1 OR (:BEN =0 AND t1.ENTRY_DATE=:DATE)
OR (:BEN =2 AND t1.DEPOSIT_DATE IS NOT NULL)
OR (:BEN =3 AND t1.DEPOSIT_DATE IS NULL)) AND
(:ALEX =1 OR (:ALEX =0 AND t1.ENTRY_DATE>=:DATE1 AND
t1.ENTRY_DATE<=:DATE2) OR (:ALEX =2 AND t1.DEPOSIT_DATE>=:DATE1
AND t1.DEPOSIT_DATE<=:DATE2))
AND T2.CLIENT_ID(+)=T1.CLIENT_ID
ORDER BY t1.SEC_CODE, t1.CHECK_CODE, fullName, t1.check_no
Please don't pay attention to the parameter names, it's a little funny for me but you guys won't be able to connect.
The first issue here is that even though some parameters are the same name, ADO sees them as individual parameters! So, if I do this:
checkload1->Parameters->ParamByName("BEN")->Value=0
ADO will not replace every occurrence of "BEN" with 0, and I end up with a result set of 0 records! Instead, I am using this:
checkload1->Parameters->Items[0]->Value = 0; // BEN param
checkload1->Parameters->Items[1]->Value = 0;
checkload1->Parameters->Items[3]->Value = 0;
checkload1->Parameters->Items[4]->Value = 0;
Basically, replacing every "BEN" parameter with 0 based on the parameter index.
This brings me results, but not right away.
So here is how it works: the application is a tree based user interface. There is a node that says "Today's Checks" and it displays today's checks when it is expanded. Great, now this works fantastic with BDE, and I only assign the parameter value once and it automatically replaces it wherever it sees "BEN", etc.
When using ADO components, I expand the "Today's Checks" node and the code runs though, loading the parameters, activating the query component and I get no results! So the node stays collapsed. If I click on the + sign again to expand the tree, it loads the checks! And it will load them every time after that.
So, in the application there is a date option that defaults to today's date. If I change that to yesterday's date, I still get today's checks... It's like the parameters aren't getting updated. And if I try to start with a different date at the very beginning, I don't get any results! It will bring results with today's date, but after that it won't accept a different date.
I debugged the code and the dates are changing, but for some reason the parameters aren't changing. Here is my code block:
checkload1->Filter="" ;
checkload1->Filtered=false ;
switch(params)
{
case 0: checkload1->Parameters->Items[0]->Value = 1; // BEN param
checkload1->Parameters->Items[1]->Value = 1;
checkload1->Parameters->Items[3]->Value = 1;
checkload1->Parameters->Items[4]->Value = 1;
// ALEX Param
checkload1->Parameters->Items[5]->Value = 0;
checkload1->Parameters->Items[6]->Value = 0;
checkload1->Parameters->Items[9]->Value = 0;
checkload1->SQL->Strings[13] = "AND t1.CHECK_STATUS NOT IN ('Refunded', 'Posted') ";
break ;
case 1: checkload1->Parameters->Items[0]->Value = 0; // BEN param
checkload1->Parameters->Items[1]->Value = 0;
checkload1->Parameters->Items[3]->Value = 0;
checkload1->Parameters->Items[4]->Value = 0;
checkload1->Parameters->ParamByName("DATE")->Value=FormatDateTime("dd-mmm-yyyy", Date()) ;
checkload1->SQL->Strings[13] = " ";
break ;
case 2: checkload1->Parameters->Items[0]->Value = 2; // BEN param
checkload1->Parameters->Items[1]->Value = 2;
checkload1->Parameters->Items[3]->Value = 2;
checkload1->Parameters->Items[4]->Value = 2;
//ALEX param
checkload1->Parameters->Items[5]->Value = 2;
checkload1->Parameters->Items[6]->Value = 2;
checkload1->Parameters->Items[9]->Value = 2;
checkload1->SQL->Strings[13] = "AND t1.CHECK_STATUS IN ('Deposited') ";
break ;
case 3: checkload1->Parameters->Items[0]->Value = 3; // BEN param
checkload1->Parameters->Items[1]->Value = 3;
checkload1->Parameters->Items[3]->Value = 3;
checkload1->Parameters->Items[4]->Value = 3;
//ALEX param
checkload1->Parameters->Items[5]->Value = 0;
checkload1->Parameters->Items[6]->Value = 0;
checkload1->Parameters->Items[9]->Value = 0;
checkload1->SQL->Strings[13] = "AND t1.CHECK_STATUS IN ('Held') ";
break ;
}
if(!mainform->date1->Checked){
checkload1->Parameters->Items[5]->Value = 1;
checkload1->Parameters->Items[6]->Value = 1;
checkload1->Parameters->Items[9]->Value = 1;
}
checkload1->Parameters->Items[7]->Value = FormatDateTime("dd-mmm-yyyy", fromdate);
checkload1->Parameters->Items[10]->Value = FormatDateTime("dd-mmm-yyyy", fromdate);
checkload1->Parameters->Items[8]->Value = FormatDateTime("dd-mmm-yyyy", todate);
checkload1->Parameters->Items[11]->Value = FormatDateTime("dd-mmm-yyyy", todate);
if(filters != "") checkload1->SQL->Strings[12] = filters;
else checkload1->SQL->Strings[12]=" " ;
checkload1->Prepared = true;
checkload1->Active=true ;
Can someone with experience advise me on this?
I know this is ancient stuff, but those programs were written literally 15-20 years ago, and they are moving to a web-based user interface, but that's still being built. Until then, I need to make the required changes/updates as part of my job.
Okay I got this to work!!
For anyone out there who is struggling with BDE to work on Windows 7 64 bit, here is a solution! Remember the database I am dealing with is Oracle 8i and Borland C++ applications built with C++ Builder 6.
Follow the photo and arrows. I tried to put each photo with its own comment but then this site said I can't post more than 2 links... To hell with them so I put all on one picture.
This TQuery for example is looking for bnetdata as the database. Great, in the next picture we add an ADOConnection component
Click on connection string that's highlighted.
Choose use connection string and click on build.
Select the highlighted provider then click next.
Check use data source name then click the arrow to select one. Note that you will later enter the user name and password and check allow for saving password.
Select the same data source that the BDE components are using. Note that this is one of the sources under your system DSN in the ODBC Administrator. If it's not there, then create one.
Here is a shot from the ODBC Administrator. Note that this is still XP environment. You will need to create the same data source (bnetdata in my case) in the windows 7 machine.
Now click on advanced and check readwrite option from the list.
After you click OK on the ADOConnection component, as you see now in the object inspector. Look at the highlighted areas. Now, we need to set connected property to true. When you do that, it will ask you to log in to the database. Enter the user name and password and click OK. The connection property will now become true. After that you need to set the LoginPrompt property to false. Now click save on the project.
So let's say you have BDE database component too, click on it and then clear alias name and driver name and then put your database name under databaseName property (in my case it's bnetdata).
Save the project and compile in XP. Copy the application and paste it in Windows 7 machine and double click it and it will work! I have successfully converted all the applications to work on Windows 7. The hardest part was to get Borland installed and to get Windows 7 to recognize Oracle ODBC Driver under the Drivers tab in the ODBC Administrator.
Again, SQL Explorer that comes with Borland install is not going to work. So, I will still need to develop in my Windows XP VM but users can use the application in Windows 7 VM served as a terminal on a Windows server... Works for me!!
Hope this helps someone!
EDIT:
I also tried Microsoft OLE DB Provider for Oracle in the ADOConnection and it also worked. Didn't see a measurable impact on speed or performance. Both seem to perform the same way. I'm just surprised how adding the ADOConnection component allowed the application to connect to the database and work like it does in XP!
Also just to clear things up, you will not need to change the BDE components in the application. Only need to add the ADOConnection and all other components stay the same (BDE components). I was trying to convert to using ADO components but there is no need anymore.

Sitecore 7.0 and Sitecore Rocks 1.4.0.0 Preview

When previewing an item in a Sitecore 7.0 solution via Commandy in Sitecore Rocks 1.4.0.0, the command launches a browser and navigates to /sitecore/shell/WebService/browse.aspx as expected, but I am presented with the following error:
Compiler Error Message: CS0117: 'Sitecore.Web.Authentication.TicketManager' does not contain a definition for 'IsCurrentTicketValid'
Specifically, it's complaining about line 8 in browse.aspx, which is part of Sitecore Rocks.
How can I get this functionality working properly? I can preview properly from within the Sitecore Content Manager or Desktop, but the point of Sitecore Rocks is to keep me from having to switch back and forth between Visual Studio and Content Manager/Desktop.
The conditions in line 8 and 9 of browse.aspx make calls that don't exist in Sitecore.Kernel.dll in Sitecore 7.0; it contains code inline in the .aspx file, so you can directly edit it like to so to get it working:
if (Sitecore.Context.User.Identity.IsAuthenticated &&
Sitecore.Web.Authentication.TicketManager.IsCurrentTicketValid() &&
!Sitecore.Security.Authentication.AuthenticationHelper.IsAuthenticationTicketExpired())
{
Sitecore.Web.WebUtil.Redirect(redirect);
return;
}
becomes
if (Sitecore.Context.User.Identity.IsAuthenticated)
{
Sitecore.Web.WebUtil.Redirect(redirect);
return;
}
... and then you're up and running again.