What is the purpose of the cef.pak file in cefsharp? - winforms

In the FAQs of CefSharp, it states that you should disable Package Loading:
var settings = new CefSharp.CefSettings
{
PackLoadingDisabled = true
};
which is normally OK for a production-mode application
I have an issue where on a particular website a red border is appearing around a drop-down box. If I set PackLoadingDisabled = false and ensure that the cef.pak file is in the folder (This cef.pak is distributed with the CefSharp nuget package. I am not including any other .pak file except locates/en-US.pak) then this fixes the issue.
My question is, What purpose does this cef.pak file serve?
I've looked at the CEF3 Readme and it shows that it is optional, but it isn't very clear on what purpose this Pack serves. Before I go and include it in my software distribution I need to know exactly what it is for.
Am I safe to enabled Pack Loading in my release version?

pak files are used for the developer tools that can be turned on.
We choose NOT to ship the pak. The only that arises is that a 'locales' folder is created no matter what pack loading disabled value we use. The localesdirpath similarly has no effect.
Both the locales folder and the red scroll bars - are inherited by cefSharp from cef, so are upstream bugs. The good news is you can fix the red scroll bars with some javascript and means you can still use the current chromium code.
Look for ::-webkit-scrollbar / ::-webkit-scrollbar-thumb / ::-webkit-scrollbar-thumb:vertical:hover / ::-webkit-scrollbar-thumb:vertical:active etc...

Related

React PDF Viewer library cannot render the first page as soon as the minimum requirement is downloaded

I'm using react-pdf-viewer 3.9.0 with "pdfjs-dist": "2.15.349".
It seems like the React PDF Viewer still waits until it completely downloads a file, instead of rendering the first page as soon as the minimum requirement is downloaded (the fast web view, or linearization technology).
My files are already linearized (byte-streaming)
I would like to render the first page, even if the fetching file is in progress. I'd love any direction on how to solve this! Thank you!
Unfortunately, React PDF Viewer does not currently support the fast web view or linearization technology. However, you could try using a third-party library such as Mozilla's PDF.js which does support this feature. If you use this library, you will be able to render the first page of the PDF even if the fetching file is still in progress.
History
From Chromium Bug tracker and dialogs
Adobe include special hints stream into their linerilized PDFs. Format of such stream is black box and understood only by Adobe software. This allows Adobe to load linerilized PDFs more efficiently.
The alternative is server partial byte ranges. Chromium Bugs for read and alter were opened 2011
reputedly in 2014 Adobe posted (source no longer on Adobe site) along the lines of indicate that Google chrome does not support byteserving a PDF. That bug is still open whilst others related were closed "Wont fix"
Thus both methods are problematic for Foxit/Skia (Chromes binary developers) and other 3rd Parties to emulate.
try this 2GB Link in Acrobat it should open page 1 before download. Chrome needs to wait for the whole download ! then although Downloaded! My Edge expects to save it in about 10 minutes time.
https://s3.amazonaws.com/pdftron/downloads/pl/2gb-sample-file.pdf
One commercial solution :- (A few seconds to display their file)
PDFTron (owner company of Iceni, iText, PDFLib, XODO and many others) PDF.js more specifically a "Pre-Loaded" Express can
Use Adobe Linearized PDFs
Use Adobe byte "Range Request" services rfc7233#section-2.1
Firefox/Mozilla using simpler JavaScript methodologies
It can vary if Firefox viewer can use Linearized files, one of my older legacy viewers does not work with that sample, but the newer inbuilt FireFox enabler does.
Unclear if either can be passed through Mozilla PDF.js based React PDF Viewer, but supposedly was, from 3.3.3 onwards. However the dev viewer as linked above, does not exhibit that behaviour when using simple
unserved file open e.g. "drag and drop" However that 1st Page does appear fast (along with others) after the time taken to upload.
NOTE a "/Linearized" PDF file must not have been "adapted" e.g. annotated or simply served (other than as transcoded text) etc. after "Web Optimisation". The viewer must be working with the decimal addressed binary file bytes from server.

"S is not defined" Error in Adobe DTM

I am in the process of migrating an existing Adobe anlytics implementation on s_code version 27.5 to DTM. The first step of the migration and what is in scope of the project is a pick up and shift job of the current s_code into AdobeDTM.
The site has multiple JS files that house functions that need the 's object' to be initialised to work, however s is being initialised in the s_code contents after most of these JS functions have run so is throwing errors for 'S is not defined'. It is not being initialised globally as it would be in a standard implementation.
Is there a way I can initialise 's' in the DTM satellite library globally. I have tried to add var = s{}; a page load rule under third party/custom tags area but only having intermittent luck with it, where sometimes getting errors thrown.
Any support/insight into this issue would be most appreciated.
Thanks!
Step 1: Change the Code Configuration to Custom
Note: If you migrated your legacy H code to DTM as a tool, then you should already be familiar with and already done this step, since DTM does not allow you to specify legacy H code for the "Managed by Adobe" option.
In the Library Management section of the Adobe Analytics tool, change the Code Configuration option to Custom, and Code Hosted to In DTM.
If you are using the legacy H code library, then you must also check the "Set report suites using custom code below" option. If part of your migration to DTM was to move to AppMeasurement library, checking this option is optional, depending on how you want to handle report suite routing.
Then, click the Open Editor button to open the editor. You should see the Adobe Analytics library in the code box. If you are migrating legacy H code, then remove everything currently in the box and add your legacy H code library (which you should have already done based on the question).
Step 2: Instantiate the s object
If you are using the legacy H code, then add the following line to the top of the code box, above the library:
window.s = s_gi("[report suite id(s)]");
You will need to replace [report suite id(s)] with the report suite id(s) you want to send the data to. s_gi() requires a value to be passed to it, which is why you must check the checkbox above.
If you are using AppMeasurement library, then add the following line to the top of the code box, above the library:
window.s = new AppMeasurement("[report suite id(s)]");
If you checked the "Set report suites using custom code below" checkbox, then specify the report suite(s). If you did not check it, then do not pass anything to Appmeasurement(). Alternatively, you can pass nothing, but also add the following underneath it:
s.account="[report suite id(s)]";
Note however in step 3 you will be setting it in doPlugins anyway so you don't really need this here (I just added this sidenote for other readers who may be migrating AppMeasurement s_code.js to DTM).
Note: Aside from the window.s part, you should already be familiar with this line of code, and already have logic for populating report suite(s), coming from a legacy implementation. Specifically, you may be using the dynamicAccountXXX variables. If you are upgrading to AppMeasurement library, then you will need to write your own logic to simulate that, since AppMeasurement (for reasons unclear to anybody) does not have this functionality.
Step 3: Setting report suite(s) after page load
One of the many caveats about implementing Adobe Analytics as a tool is that DTM (for reasons unclear to anybody) creates a new s object whenever an event based or direct call rule is triggered and AA is set to trigger. In practice, this means almost all of the variables you set within the custom code boxes in the tool config will not be carried over to subsequent AA calls on a page - report suite(s) being one of them.
What DTM does for report suite is set it to the specified Production Report Suite(s) if DTM is in production mode, or Staging Report Suite(s) if in staging mode. Even if you enabled the "Set report suites using custom code below" option!
To get around this, you will need to include doPlugins function (and usePlugins) in one of the tool's custom code boxes if you don't already have it included (you almost certainly do, coming from a legacy implementation), and you will need to also assign the report suite(s) within it (doPlugins and usePlugins do get carried over now).
For legacy H library, within doPlugins, add the following:
s.sa("[report suite id(s)]");
Note: setting dynamicAccountXXX variables within doPlugins will not work. You will need to write your own logic for passing the report suite(s) to s.sa()
For AppMeasurement library, within doPlugins, add the following:
s.account="[report suite id(s)]";
General Notes:
In the Library Management section, setting Load library at
Page Top will load the library synchronously at the position where
you put your DTM Header tag, which is the earliest you can trigger it
through DTM. However, this is not a guarantee the library will be
loaded before your other scripts that referenced it are executed
(e.g., references to s object in some other script tag above the
DTM Header script will continue to give you a reference error).
If you are indeed still using the legacy H library, then I would
recommend your highest priority be to migrate to AppMeasurement
library. Even higher priority than migrating the code to DTM, IMO.
While I echo Mark's sentiments about implementing AA code as a 3rd
party tag in general, the sad truth is in practice, it may still be
your best option at the moment, depending on your exact scenario. DTM
currently has too many caveats, short-comings, and outright bugs that
make it impossible to implement AA as a tool in DTM, depending on
your exact implementation requirements. Particularly when it comes to
making AA integrate with certain common 3rd party tools, and even
some of Adobe's other tools!
You will be better off if you migrate completely to DTM for analytics deployment rather than trying to reference the s object from legacy H page code.
If migrating completely from H-code to DTM is an option, I would do the following:
Remove all H page code and any references to s_code
Remove all calls to s.t or s.tl on links or pages
Deploy DTM Header / Footer code on all pages
Within DTM, Add the Adobe Analytics Tool
Within DTM, Add the Adobe Marketing Cloud ID Service
Within DTM and the "Custom Page Code" of Adobe Analytics tool, create the "do_plugins" section and add any custom plugins from the H-code.
Following these steps will allow the s object to be created within DTM and allow for all other rules to use it correctly.
What I would not do:
Deploy H-code (s_code) as a third-party script and try and reference the s object outside of the Adobe Analytics tool. This is not efficient and doesn't allow you to get the best practices from DTM, IMO.
Mark
One of the issues noticed using DTM to implement Adobe Analytics was with the S-Object being undefined.enter image description here
Reasons very much unclear.You have a workaround that I used by reminding DTM to set the S object again. In-cases where DTM does not recognizes what needs to be done.
var s = _satellite.getToolsByType('sc')[0].getS();
For my Implementation we had used a Third Party JavaScript that set within a Direct call rule and within which the above code was set.
The solution worked great ....

Working With A Codename One Project In Git/SVN version control

We are trying to work on a Codename One project using git version control.
When I pull the project from git, the files (modified and newly added theme res files) are updated but they don't appear in the theme.
My changes aren't reflected when I try to run the project, how to refresh the project?
I tried to build/clean, refresh the cn1lib too but made no progress.
Thankyou shai, i uncheck the xml team mode but that doesnt make any difference.. you gave the link (https://www.codenameone.com/team.html), what is this for?? sorry i didn't quite get it.
And the solution isnt that clear. what do you mean by checking the res directory...
Let me clear my problem here.. when my team member adds a form (eg main form) in the gui builder, it get pulled from git in my project. there r 2 files main.ui and main file but when i open my res file or gui builder, the main form is not there.
This is actually triggered by a feature specifically designed for working with a team in version controlled environments. You can get this to work by unchecking File->XML Team Mode in the designer but that would "work around" this feature: http://www.codenameone.com/blog/teamwork-and-other-things.html
The solution would be to checkin the res directory, when it exists opening the res file refers to that instead of to the theme file. This allows your team to edit that directory together and avoid conflicts that will arise when sharing the binary res file.

Aggregate and compress CSS files on Responsive Site

What is the best practice for aggregating and compressing CSS files on a responsive site. When I select the Aggregate and Compress CSS files option in Drupal 7 under performance and look at the site on a mobile device it is using the style sheet from the main site not the specified one for that device. I am using AdaptiveTheme.
Your site performance wouldn't be slow down. It is somewhere other things rather than CSS minification. Online YUI Compressor minifies properly and rather than slowed down your page load speed, it enhances page speed.
Well according to the documentation
You need to turn on Production mode
Any additional changes you make you need to resave the theme (so that it can be rendered properly again)
All responsive themes are placed into one complete file
Also highly advisabled to install AT Tools as it has additional features that help you out with regards to this
Responsive Styles - Production mode
When in production mode all the responsive stylesheets are aggregated into one file and use embedded #media queries. AT Core will automatically aggregate the CSS from each of the development mode stylesheets and wrap it in the right media query. This reduces the number of HTTP requests from 5 to 1.
This file is always called: ThemeName.responsive.styles.css
By default will find this file at: ~/[public files]/adaptivetheme/[ThemeName]/ThemeName.responsive.styles.css
However you can choose where to save AT's generated files, for example you can save them directly to your theme or enter a custom directory path - see File Generation System.
NOTE: please see the section below titled "Relative Paths in Responsive Styles".
Ref: Referencing AdaptiveThemes documentation

What are your recommendations for reducing the number of resources (JavaScript and CSS) that DotNetNuke loads?

The home page for DotNetNuke 5.2 is around 252.6KB. It uses 15 JavaScripts and 8 CSS files. The number of resources DotNetNuke uses seems excessive to me. I am looking for best practices creating DotNetNuke skins that limit the JavaScript and CSS resources.
You can use the Unload CSS Skin Object to remove links to some of the CSS files loaded by the framework (like Default.css, portal.css & any module-specific CSS files). You can then move all of those styles into the skin (or portal stylesheet, whichever is your preference), so that there's only one stylesheet that gets loaded.
I don't know of any solutions for combining JavaScript resources or reducing the number of scripts that DNN requires.
From 6.1 onward, the Client Resource Management component is the solution for this. It automatically combines all your files, cleaning them up, removing comments, and minifying if desired.
http://www.dotnetnuke.com/Resources/Wiki/Page/Client-Resource-Management-API.aspx
It takes a little getting used to, but the control is quite nice. You can decide which order they'll go in, you can group the files in bunches if you don't want one big single file - maybe you want certain bunches of scripts together but not all.
One thing to remember is that when you're doing development (as noted by the comment below, which I've since edited this post), you should always use debug=true in the web.config, otherwise if you are using Resource Mgmt and change your source files, you'll constantly need to regenerate the combined files by going into Site Settings, Client Resource Management, and increment the version. It's kind of a protection to keep anything from altering your clients' browser caches without intent (that's the message box that pops up to let you know when you do it). I'm sure if you have a zillion users this might make a difference.
Part of that is just the dynamic nature of DNN - there are some good resources that R2i has published about combining javascript and CSS
One concrete suggestion is to combine all your skin and contianer css in one file and if you have full control of the site to combine the css from the modules you use into that same file.
I know with the addition of the Telerik controls there is some abilities to combine resource files
Another thing that helps is to combine graphics into a single file and use CSS (the sprite technique) to cut down number of files loaded and calls to the sever
Like it was stated above, it's the nature of the beast. Each module will have at least 1 css file included. You can check out PageBlaster from snapsis.com, I believe it will do what you are looking for.

Resources