Can you load a custom Public Suffix file in Guava? - guava

I'm using Guava's InternetDomainName.from(domain).topPrivateDomain().toString() to extract the "top private domain" from full domain names.
e.g.
for bbc.co.uk, it would list .co.uk as the "top private domain", as opposed to simply .uk.
Unfortunately, the list it's based on (the Mozilla Public Suffix List, included in com.google.thirdparty.publicsuffix.PublicSuffixPatterns) is lacking certain commercial TLDs which effectively function as "top private domains".
e.g.: wordpress.com, wix.com
Does Guava offer the option to load an amended list, using Mozilla's original .dat format, which has the additions included, and use that instead of the hard coded one? Thanks!

Sorry, not currently. See this feature request.

Related

VS Code Regex search to remove references based on containing text in string

I am attempting to remove all references of a managed package that is going to be uninstalled that spans throughout code base in VS Code
I have using a query to find the field permissions but am wondering if there is a way to search for the reference outside of specifying the exact field name compared to the field containing only "agf" since they are all using it.
Below is the search query:
<fieldPermissions>
<editable>false</editable>
<field>User.agf_Certified_Product_Owner__c</field>
<readable>false</readable>
</fieldPermissions>
In the field, I want to be able to find and delete the 5 associated lines from multiple files if they match "agf" in any combination. Something like the below:
<fieldPermissions>
<editable>false</editable>
<field>agf</field>
<readable>false</readable>
</fieldPermissions>
With any combination of agf in the field, delete all from any file it appears in.
Not an answer but too long for a comment
You don't have to? Profiles/perm sets don't block package's delete. Probably neither do reports.
You'd use your time better by searching for all instances of agf__ (that's with double underscore), should find fields, objects... used in classes, flows, page layouts etc. And search for agf. (with dot) should find all instances where your Apex code calls their classes marked as global.
Alternatively Apex / VF pages with dependencies on package will have it listed in their "meta.xml", for example
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>54.0</apiVersion>
<packageVersions>
<majorNumber>236</majorNumber>
<minorNumber>1</minorNumber>
<namespace>SBQQ</namespace>
</packageVersions>
<status>Active</status>
</ApexClass>
Last but not least - why not just spawn a dev sandbox and attempt the delete there? If it succeeds - great. If not - it'll list the dependencies that blocked the delete. It'll be "the real thing", it'll smite you even if your VSCode project doesn't contain all flows, layouts and thus could lull you into false sense of security. I'd seriously do it in sandbox and then run all tests for good measure, just in case there are some dynamic soql queries that don't count as hard, delete-blocking references.
After delete's done - fetch Profiles / Permsets from this org and the field references will be gone from the xml.

Search string formatting in Elouqa API

I'm using the Elouqa Rest API in an integration with another product and I want to implement a file browser. As part of this I want to get a list of the folders inside another folder. Theapi documents here say that a search string can be appended but don't give any clues as to the format of the search string. I've tried various things but so far I'm just getting empty results. An example is here:
/API/rest/1.0/assets/email/folders?search=folderId+%3D+250
I've tried with and without +'s and with and without url encoding the = sign, also various combinations of quote marks but so far nothing.
I believe what you want is a slightly different endpoint e.g.:
/API/rest/1.0/assets/email/folder/250/contents
Which would provide a list of folders contained with folder 250
If you wanted to search for a given folder name then you would use
/API/rest/1.0/assets/email/folders?search=foldername
Hope that helps!

What does the parameter "cvid" in Bing search engine stands for?

As I searching something with Bing and I open the Chrome development tools. Here is the request url:
http://cn.bing.com/search?q=%e4%b9%a0%e8%bf%91%e5%b9%b3&go=%e6%8f%90%e4%ba%a4&qs=n&pq=%e4%b9%a0%e8%bf%91%e5%b9%b3&sc=6-6&sp=-1&sk=&cvid=AF49B4165317411D8AFEF30F13BCD108&first=10&FORM=PERE
So, what does the parameter "cvid" stands for? It seems if i don't set a cvid,i can't get the complete result html in my program.
By the way, the cvid is calculated by the browser automaticlly, so how to calculate?
In the Bing search context, cvid represents the JavaScript parameter ConversationId. Bing uses this key to identify your search result collection as its reply to your query, q. Similarly, pq is PartialQuery. These and other parameters may also apply to different kinds of searches, such as image or video searches.
Next, qs is your query's SuggestionType, sc shows your SuggestionCount, and from the suggestion list (dropped down, if enabled), sp shows the SuggestionPosition you chose. In your case, you did not select a suggestion, so &sp=-1. Toward the end of your string, sk is the SkipValue, because you might skip through your result pages, first tells the issuer how many results belong on the first page, and I'll let you figure out what FORM means. ;)
TRY:
Navigate to Bing, conduct a search, choose some options, change your displays, and change some search types. Next, open file explorer and navigate to your Windows OS equivalent of the following path.
C:\Users\{user}\AppData\Local\Microsoft\Windows
Next, you may need to adjust your View temporarily to "Show hidden files, folders, and drives." View tab > Options > Change... > View tab again, and click the bullet to "Show...".
In File Explorer's Search pane at the upper right, enter *.js to find all JavaScript files. It may point you several subfolders deeper, and the folder names may be hashed. Choose a JavaScript file you find interesting, right-click the file, and open it with Notepad, your favorite IDE, or some similar editor. You should see something akin to this (truncated; may not run independently):
var AutoSuggest,__extends,Bing,sa_inst;(function(n){var t;(function(n){var t,i,r,u,f,e;(function(n){n.User="SRCHHPGUSR"})(t=n.CookieNames||(n.CookieNames={})),function(n){n.AutoSuggest="AS"}(i=n.CrumbNames||(n.CrumbNames={})),function(n){n.CursorPosition="cp";n.ConversationId="cvid";n.SuggestionCount="sc";n.PartialQuery="pq";n.SuggestionPosition="sp";n.SuggestionType="qs";n.PreviewPaneSuggestionType="qsc";n.SkipValue="sk";n.PreviewPaneSkipValue="skc";n.Ghosting="ghc";n.Css="css";n.Count="count";n.DataSet="ds";n.SessionId="sid";n.TimeStamp="qt";n.Query="q";n.ImpressionGuid="ig";n.QFQuery="qry";n.BaseQuery="bq";n.FormCode="form";n.HashedMuid="nclid";n.RequestElToken="elvr";n.ElTokenValue="elv";n.AppId="appid";n.History="history";n.NoHistory="nohs";n.ApiTextDecoration="textdecorations";n.ClientId="clientid";n.Market="mkt";n.Scope="scope";n.CountryCode="cc";n.HomeGeographicRegion="hgr";n.SetLang="setlang";n.ZeroInputSerp="zis"}(r=n.QueryParams||(n.QueryParams={}))
I hope that helps someone! :D
I'm also trying to find out what this is :)
I'm pretty sure it's an encryption mechanism for bing a la public key cryptography, though I could be wildly wrong. There is another field called pq - and p's and q's are used a lot in crypto theory.
The field is 32 nibbles (e.g. 8D0E519A91024A08B075654D006C0A14) which equals 128 bits. This number results in some arithmetic operation with the binary value of your search and bing's private key - thus making url generation quite difficult.

How to map urls?

I would like to map pages such domain/content/myProject/home.html to domain/home.html. /content/myProject/ is not needed. I have the following code:
String newpath = getResourceResolver().map(page.getPath());
this does not change anything. newpath is stay page.getPath()
how to solve this issue?
Answering as this question as it remains unanswered. Here is an example of how the etc mappings should look like:
Trick is you add 2 entries to sling:internalRedirect as / and /content/example/
AEM first tries to resolve resources with first entry '/'. So non page URLs like /etc/designs, /content/dam etc will be addressed by the first entry. If it is unable to resolve using the first one, it uses the second entry to resolve the page.
This is also the adobe recommended way for URL shortening compared to other techniques like apache redirect.
You need to create map in etc.Then Resource Resolver will take care of trimming the path .
CREATING MAPPING DEFINITIONS IN AEM
In a standard installation of AEM you can find the folder:
/etc/map/http
This is the structure used when defining mappings for the HTTP protocol. Other folders (sling:Folder) can be created under /etc/map for any other protocols that you want to map.
Configuring an Internal Redirect to /content
To create the mapping that prefixes any request to http://localhost:4503/ with /content:
Using CRXDE navigate to /etc/map/http.
Create a new node:
Type sling:Mapping
This node type is intended for such mappings, though its use is not mandatory.
Name localhost_any
Click Save All.
Add the following properties to this node:
Name sling:match
Type String
Value localhost.4503/
Name sling:internalRedirect
Type String
Value /content/
Click Save All.
This will handle a request such as:
localhost:4503/geometrixx/en/products.html
as if:
localhost:4503/content/geometrixx/en/products.html
had been requested.
You can refer here for further documentation http://docs.adobe.com/docs/en/cq/5-6-1/deploying/resource_mapping.html

Storing templates using dictionary in c#

I have to store some templates based on the statecode.I cannot store them in database. So i thought of creating a dictionary with statecode as key and list as value. I have chosen a list because i need a template line by line.So each string in list is a line. Is there any better way of dealing with this kind of situation. Please comment.
private static readonly Dictionary<string, List<string>> NotaryForStates = new Dictionary<string, List<string>>()
{
{"AR",new List<string> {"Per Steve Hollowell, ESQ from the Legal Division of the AR, SOS. Telephone number for the Legal Division of the SOS: (501)-682-3012. Arkansas Code 16-47-101.", "State of Arkansas", "County of <notary county>","On this day, <sign date> before me, <name of notary>, the undersigned notary, personally appeared, <name of signer> who acknowledged he/she is the <title of signer> of <name of company> and that he/she as such <title of signer>, being authorized so to do, executed the foregoing instrument for the purposes therein contained, by signing the name of the corporation by himself/herself as <title of signer>.","In witness whereof I hereunto set my hand and official seal.","______________________","Notary Public","<Notary name>","My Commission expires: <notary commission date>"}},
{"CA",new List<string>{"State of California","County of <Notary County>","On <sign date> before me, <Notary Name>, Notary Public, personally appeared <Signing Party Name>, who proved to me on the basis of satisfactory evidence to be the person(s) whose name is subscribed to the within instrument and acknowledged to me that he/she executed the same in his/her authorized capacity, and that by his/her signature on the instrument the person, or the entity upon behalf of which the person acted, executed the instrument.","I certify under PENALTY OF PERJURY under the laws of the State of California that the foregoing paragraph is true and correct.","WITNESS my hand and official seal.","______________________________","Notary Public: «NotaryName»","My Comm. Expires: «NotaryCommExp»"}},
{"FL",new List<string>{"State of Florida","County of <Notary County>","On <sign date> before me, the undersigned, a Notary Public, for said County and State, personally appeared <Signing Party Name>, personally known to me to be the person that executed the foregoing instrument and acknowledged that is a <signer title> of <name of company> and that he/she did execute the foregoing instrument. <Name of Signer> is personally known to me.","_____________________","Notary Public: «NotaryName»","My Comm. Expires: «NotaryCommExp»"}}
};
First alternative: You may use a simple string instead of a list and separate the individual lines with Environment.NewLine ("\n"). You can create such strings easily with a StringBuilder object and split it again (if you need to) with the string.Split() method. This is also (slightly) faster than the List<string> approach.
Second alternative: You may use files and store only the filename in your dictionary.
Whether or not one of the above options is a better alternative to your original approach, depends on the concrete project you're working on. All in all, the List<string> approach might well be ok...
HTH!
Another alternative is to use resource files (which are commonly used for localization). Resource files provide a location for storing text or other types of objects which can be used across a Web site, WPF or Windows Forms application, thus creating a central location for maintaining the text. Using resource files can also simplify maintenance of your application.