Article directory CPU Multi-Level Cache & Cache Coherence Protocol (MESI) CPU multi-level cache Cache Coherence Protocol (MESI) Cache line Four cache states cache line state transition Multi-core collaboration example Website experience MESI optimization and introduced issues Store Buffers & Invalidate Queue Problems caused by Store Bufferes & Invalidate Queue Hardware memory model Read Barrier & […]
Tag: this
Millions of levels of import and export, watch me do this
Blog: xiaohugg.top Background I believe that in business, there will be a lot of data import and export, which generally involves the import and export of millions of data levels. Without an excellent performance architecture, it is easy to cause OOM and cause the server to crash, so I wrote this article. Simply write down […]
Have you ever used enum and Collection.stream() like this?
Recently, I am working on a data chart display function that displays the quantity and amount of orders in the past seven days or the past half month. It can be understood as shown in the figure below: I implemented data initialization and assembly using the stream method of enumeration and collection. The enumeration is […]
XUnit Unit Test (Practical Project) – I won’t hit you with you after reading this
1. Introduction xUnit.net is a free, open source unit testing framework for .NET that enables parallel testing and data-driven testing. The test project needs to reference both xUnit and the project under test to test it. After the test is written, use Test Runner to test the project. Test Runner can read the test code […]
JS Series (4) – this points to related
This is a keyword in JavaScript, but it is a relatively special keyword. Unlike keywords such as function, var, for, and if, you can clearly understand how it is used. this will bind an object in the execution context, but under what conditions is it bound? Different objects will be bound under different execution conditions, […]
Selenium – Automate anything you want with this framework!
IntroductiontoChromeDevTools ChromeDevToolsisasetoftoolsbuiltdirectlyintoChromium-basedbrowserssuchasChrome,Opera,andMicrosoftEdgetohelpdevelopersdebugandstudywebsites. WithChromeDevTools,developerscangaindeeperaccesstowebsitesandbeableto: InspectelementsintheDOM EditelementsandCSSonthefly Checkandmonitorwebsiteperformance Simulatetheuser’sgeographiclocation Simulatefaster/slowernetworkspeeds ExecuteanddebugJavaScript Viewconsolelog etc. Selenium4ChromeDevToolsAPI Seleniumisacomprehensivesetoftoolsandlibrariesthatsupportwebbrowserautomation.Selenium4addsnativesupportfortheChromeDevToolsAPI.WiththesenewAPIs,ourtestscannow: Captureandmonitornetworktrafficandperformance Simulatedgeolocationforlocation-awaretesting,localizationandinternationalizationtesting Changedevicemodesandtestyourapp’sresponsiveness Thisisjustthetipoftheiceberg! Selenium4introducesthenewChromiumDriverclass,whichincludestwomethodsforaccessingChromeDevTools:getDevTools()andexecuteCdpCommand(). ThegetDevTools()methodreturnsanewDevToolsobjectthatallowsyoutosendbuilt-inSeleniumcommandsforCDPusingthesend()method.ThesecommandsarewrappermethodsthatmakecallingCDPfunctionsclearerandeasier. TheexecuteCdpCommand()methodalsoallowsyoutoexecuteCDPmethods,butismoreprimitive.InsteadofusingawrappedAPI,itallowsyoutodirectlypassinaChromeDevToolscommandandtheargumentstothatcommand.IfthereisnoSeleniumwrapperAPIforaCDPcommand,oryouwanttocallitdifferentlythantheSeleniumAPI,youcanuseexecuteCdpCommand(). Chromium-baseddriverslikeChromeDriverandEdgeDrivernowinheritfromChromiumDriver,soyoucanaccesstheSeleniumCDPAPIfromthesedriversaswell. Let’sexplorehowyoucanleveragethesenewSelenium4APIstosolvevarioususecases. Emulateddevicemode Mostoftheappswebuildtodayareresponsivetomeettheneedsofendusersfromavarietyofplatforms,devices(e.g.mobile,tablet,wearables,desktop)andscreenorientations. Astesters,wemaywanttoplaceourappsindifferentsizestotriggerresponsivenessintheapp. HowcanweachievethisusingSelenium’snewCDPfunctionality? TheCDPcommandformodifyingdevicemetricsisEmulation.setDeviceMetricsOverride,andthiscommandrequiresinputofwidth,height,mobiledeviceflag,anddevicescalingfactor.Thesefourkeysarerequiredinthisscenario,buttherearesomeoptionalkeys. InourSeleniumtests,wecanusetheDevTools::send()methodandusethebuilt-insetDeviceMetricsOverride()command,butthisSeleniumAPIaccepts12parameters-inadditiontothe4requiredparameters,thereare8optionalonesparameter.Foranyofthese8optionalparametersthatwedon’tneedtosend,wecanpassOptional.empty(). However,tosimplifythisprocessandonlypasstherequiredparameters,IwillusetheoriginalexecuteCdpCommand()methodinthecodebelow. packagecom.devtools; importorg.openqa.selenium.chrome.ChromeDriver; importorg.openqa.selenium.devtools.DevTools; importjava.util.HashMap; importjava.util.Map; publicclassSetDeviceMode{ finalstaticStringPROJECT_PATH=System.getProperty(“user.dir”); publicstaticvoidmain(String[]args){ System.setProperty(“webdriver.chrome.driver”,PROJECT_PATH+”/src/main/resources/chromedriver”); ChromeDriverdriver; driver=newChromeDriver(); DevToolsdevTools=driver.getDevTools(); devTools.createSession(); MapdeviceMetrics=newHashMap() {<!—->{ put(“width”,600); put(“height”,1000); put(“mobile”,true); put(“deviceScaleFactor”,50); }}; driver.executeCdpCommand(“Emulation.setDeviceMetricsOverride”,deviceMetrics); driver.get(“https://www.google.com”); } } Online19,Icreateamapcontainingthekeysrequiredforthiscommand. Thenonline26,IcalltheexecuteCdpCommand()method,passingtwoparameters:thecommandname”Emulation.setDeviceMetricsOverride”,andthedevicemetricsmapcontainingtheparameters. […]
Have you mastered character functions and string functions yet? Come and read this
Article directory Preface 1. Character classification function 1.1 islower 1.2isupper 2.Character conversion function 2.1 lower 2.2 toupper 3. The use and simulation implementation of strlen 3.1 Note on the use of strlen (error-prone) 3.2 Simulation implementation of strlen 3.2.1 Counter mode 3.2.2 Pointer mode 3.2.3 Recursive method 4. Use and simulation implementation of strcpy 4.1 […]
Use Python to implement automatic mine clearance! The webpage exclaimed: This is too fast!
Using Python + OpenCV to realize automatic mine clearance and break the world record, let’s take a look at the effect first. Intermediate – 0.74 seconds 3BV/S=60.81 I believe that many people have known about Minesweeper, a classic game (graphics card test) game (software) for a long time. Many people have heard of Chinese Minesweeper, […]
Let’s take a closer look at the pitfalls that JDK8 has gone through, and we won’t do this again in the future. . .
Finally count the pitfalls that JDK8 has stepped on, and never do it again Repeated things should not be done a second time, otherwise it is disrespectful to life. The main content of this article: The pitfalls of JDK8, the basic content. Reasons for stepping into the trap: unknown and forgotten. Main content of this […]
If wages are calculated based on the amount of code, maybe it should be written like this!
Because the official account has changed the push rules, please click “Looking” and add “star” to get exciting technology sharing as soon as possible Click to follow the #InternetArchitect official account and get the full set of architect information here 0,2T architect learning materials dry content Previous article: Sharing of useful learning materials for 2T […]