|
Why are you using a topless selfie as your SO avatar?
|
|
|
|
|
Because it's a good pic. People say I look like Bruce Willis. It was taken on holiday, where shirts are generally not warn at home, but it's a head shot, so I'm hardly even topless. It's my avatar most places; seems I've overlooked here.
|
|
|
|
|
You know, that would make for a good programming quiz, particularly the requirement to return the line and column where the match starts.
Obviously you can just replace \r and \n with nothing to do find a match, but then you lose the line breaks and all the line/column info is lost.
Does Tomalak's regex preserve the matching line and column #? I (thankfully) know very little regex.
Marc
|
|
|
|
|
No. What I've done is remove all line breaks and hyphens (kind of iffy), then inserted a 'magic char' just before the match. Then I write that back to a new file, and do the same regex on each line, storing the pos and removing the 'magic char', to try my best a keeping the pos closest to original.
But it's what is supposed to be a couple of hours technical assessment, and their working seems to assume only one occurrence of the term, in one file, where the other part of the requirement is yo recursively select candidate files by entering a directory path.
I even started looking at Lucene.NET, but figured that wasn't the type of solution they were looking for.
|
|
|
|
|
Ah, good, a RegEx question. Ehhhxcellent.
Certainly the caret (^) isn't going to do it; but I expected the dollar sign ($) to work.
However, it doesn't and the MSDN documentation isn't as clear as it could be.
One place says: The match must occur at the end of the string or before \n at the end of the line or string. (Note the "before".)
Another place says: By default, $ matches only the end of the input string. If you specify the RegexOptions.Multiline option, it matches either the newline character (\n) or the end of the input string.
For these two statements to both be correct when using Multiline, the $ must act like a Zero-width positive lookahead assertion similar to (?=\n) -- it "matches" the linefeed character, but it doesn't consume it.
Caret behaves like a Zero-width positive lookbehind assertion -- (?<=\n) .
Therefore the dollar sign isn't going to do what you want either.
Your Romulan friend appears to have a reasonable solution.
As to "I despair for our profession", I blame Microsoft.
|
|
|
|
|
I now have a non-RegEx (and case-sensitive only) solution. Might write up a Tip.
|
|
|
|
|
I understand that modern browsers like to spawn multiple processes behind the scene, usually on a per-tab basis perhaps.
Anyone know how this works, as what you seem to end up with is several processes all accessing the same window? Windows is funny about multiple threads accessing the same window, never mind processes.
Perhaps the rendering is done in the main process and all the comms/javascript/layout calculation etc. in the child ones.
I don't know, but I'd like to. Anyone shed some light?
Regards,
Rob Philpott.
|
|
|
|
|
AFAIK they all use different trheads - in fact if one tab crashes the whole browser is kaputt.
Firefox qorks like that, IE is not a browser and Chrome kills my ram before starting up so I don't have too much experience on that one.
DURA LEX, SED LEX
GCS d--- s-/++ a- C++++ U+++ P- L- E-- W++ N++ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t++ 5? X R++ tv-- b+ DI+++ D++ G e++>+++ h--- ++>+++ y+++* Weapons extension: ma- k++ F+2 X
If you think 'goto' is evil, try writing an Assembly program without JMP. -- TNCaver
When I was six, there were no ones and zeroes - only zeroes. And not all of them worked. -- Ravi Bhavnani
|
|
|
|
|
ff only runs 1 process, even with many extensions & tabs and/or windows open.
chrome is just getting stupid (and fugly); sure bare bones is [supposedly] fastest, but just a few add-ons just starting up and rendering is way slower. (Of course you idiots, inter-process communications are slow - who was the braniac that decided separate processes was a good idea???) Without add-ons only has minimal standard settings (yep, jus like msof they think all users are stupid). Even on my main box (16G DDR3 RAM) it's slower then ff so I rarely use it and have already banished from the task bar it to the depths of the Accessories menu (it so does not deserve it's own menu). The mess of directories it creates are just way stupid too, caches mixed in with data files - how to set inclusive backups for that without backing up the crap??
Getting time to ditch chrome for edge as secondary browser, the edge is actually improving while chrome is for all it's updates is still stuck where it was 5 years ago (updates almost always security fixes - that really inspires confidence: NOT).
Sin tack ear lol
Pressing the "Any" key may be continuate
|
|
|
|
|
Lopatir wrote: Even on my main box (16G DDR3 RAM) it's slower then ff Holy mother... I guess Chrome will never see the light of my CPU then. Even on my next PC (16 GB DDR4, Intel i5 6600 if all goes well).
DURA LEX, SED LEX
GCS d--- s-/++ a- C++++ U+++ P- L- E-- W++ N++ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t++ 5? X R++ tv-- b+ DI+++ D++ G e++>+++ h--- ++>+++ y+++* Weapons extension: ma- k++ F+2 X
If you think 'goto' is evil, try writing an Assembly program without JMP. -- TNCaver
When I was six, there were no ones and zeroes - only zeroes. And not all of them worked. -- Ravi Bhavnani
|
|
|
|
|
Lopatir wrote: who was the braniac that decided separate processes was a good idea???
Citibank's online chat support feature loads via AJAX calls made on the main thread, instead of in the background. In firefox (one process) this locks up your entire browser until the POS loads (which must be in a colo on the Moon, considering how long it takes...)
In Chrome however, only the tab for Citibank locks up, so you can do something else while the page pulls its head out its...
Their online chat support is also on a different server, and uses cross-site scripting (BLOCKED!) to pass account information (REALLY!?) So unless you allow XSS, the support monkeys can't see any of your account information, and can't help you. Bravo. Bravo.
So, multiple processes helps to shield the user from terrible (or even malicious) website design. Ever see one of those pages that has an alert() loop? With multiple processes you can kill that one tab without losing whatever else you have open.
Obviously there are other features and improvements that could be made to mitigate all of these problems in a single process browser... But the more commonly used ones don't seem to offer this out of the box.
|
|
|
|
|
Lopatir wrote: Getting time to ditch chrome for edge as secondary browser, the edge is actually improving while chrome is for all it's updates is still stuck where it was 5 years ago
That's true. Even I have started using Edge as my secondary browser, ff being default. Edge has its issues but it's definitely improving while Chrome just seems too slow.
One thing though, I still prefer Chrome developer tool over ff for web development and Edge, I strictly use for browsing only.
Piyush K Singh
|
|
|
|
|
Seconded that. Yesterday I tried Edge since MS advertised that it supports ABP now, and it turned out to be a pleasant experience. I am using it now.
Google chrome has transformed from from a lightweight browser into a big mess of tangled processes. It spawns almost ten processes which is named chrome, and two processes which is named crash handler, even though I only opened three tabs. You would think that they did this to handle crash better, but no, when one tab is not responding, the entirely of chrome stopped responding. Also it hogs CPU and RAM.
I can't understand why such a huge company makes such an amateur mistake. Maybe they don't have capable programmers to begin with, instead they have people who are good at marketing and advertising.
Oh yeah, let's not forget their faulty Google Drive for Desktop.
|
|
|
|
|
Google self driving car also crashed recently.
Google is the new ms:
1. rush incomplete and faulty crap to market,
2. skip fixing simple stuff, instead concentrate solely on adding more shiny bling bloat,
3. remove popular features that could allow people to have control or even worse adjust default settings,
4. open customer feedback portals and expert message boards, and ignore absolutely everything on them,
5. suggest people should always load upgrades to be relevant and enjoy the new [useless] bling
.. force updates by removing options to ignore them - ref item 1 for schedule
Sin tack ear lol
Pressing the "Any" key may be continuate
|
|
|
|
|
They're not accessing the same window, each tab will be its own GUI window that the process for that tab will interact with, with the title-bar, tab selectors etc belonging to the parent app, but the area inside the tab will belong to the child process. Think of browser tabs like a Multi Document Interface where each document is always maximised to the size of the parent browser process.
|
|
|
|
|
Well this goes against my understanding. You have a main browser window which as you say has title bars and all that stuff, a child control/window (tab selector), and each tab will be its own window as well (probably chrome then another child for its client area). How on earth do you get another process to provide the rendering/message pump etc. to that?
Regards,
Rob Philpott.
|
|
|
|
|
|
Thanks for the link, but I'm not sufficiently interested to go through that!
Regards,
Rob Philpott.
|
|
|
|
|
It was a kind of joke, but I would risk here an answer now, even it is clearly a programming answer...
In Windows, SetParent[^] can set the parent window even if it is from a different process...
So technically it is an easy problem - all you need is to pass a HWND to the new (child) process and you are done...
It is clear that in the case of Chrome the main process is different - in behaviour - from the others (even it is the same exe)... Hit Shift+Esc in Chrome and you will get a list o all the processes it is running... You can see that the one labeled 'Browser' can not be closed...This is the manager process...
Now that you know all this, go and write a CP article about!!!
Skipper: We'll fix it.
Alex: Fix it? How you gonna fix this?
Skipper: Grit, spit and a whole lotta duct tape.
|
|
|
|
|
Kornfeld Eliyahu Peter wrote: SetParent[^] can set the parent window even if it is from a different process...
Right, it's time for a career change! That seems to go completely against the whole point of a protected operating system. If I was drunk in the pub, a £50 bet would be looming. I will investigate this further.
I think I found my answer here though: Chromium Blog: Multi-process Architecture[^]
The browser process creates many renderer processes, each responsible for rendering web pages. The renderer processes contain all the complex logic for handling HTML, JavaScript, CSS, images, and so on. We achieve this using the open source WebKit rendering engine, which is also used by Apple's Safari web browser. Each renderer process is run in a sandbox, which means it has almost no direct access to your disk, network, or display. All interactions with web apps, including user input events and screen painting, must go through the browser process.
Regards,
Rob Philpott.
|
|
|
|
|
What freaks me out more is when you look at the command line for each tab in Chrome:
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --type=renderer --enable-features="*AutofillCreditCardSigninPromo<AutofillCreditCardSigninPromo,AutomaticTabDiscarding<AutomaticTabDiscarding,BlockSmallPluginContent<PluginPowerSaverTiny,DocumentWriteEvaluator<DisallowFetchForDocWrittenScriptsInMainFrame,MaterialDesignUserManager<MaterialDesignUserManager,NonValidatingReloadOnNormalReload<NonValidatingReloadOnNormalReload,OverrideYouTubeFlashEmbed<Override YouTube Flash emed,*PreconnectMore<PreconnectMore,*TranslateUI2016Q2<TranslateUI2016Q2" --disable-features=MetricsReporting<MetricsAndCrashSampling,PointerEvent<PointerEvent,SSLPostQuantumExperiment<SSLPostQuantum,UpdateRendererPriorityOnStartup<UpdateRendererPriorityOnStartup --force-fieldtrials="*AppBannerTriggering/Control/*AutofillCreditCardSigninPromo/Default/*AutomaticTabDiscarding/Enabled_Once_10-gen2/CaptivePortalInterstitial/Enabled/*ChildAccountDetection/Disabled/*ChromeChannelStable/Enabled/*ClientSideDetectionModel/Model0/*DisallowFetchForDocWrittenScriptsInMainFrame/DocumentWriteEvaluatorGroup/EnableWin32kLockDownMimeTypes/PPAPILockdown_Enabled/ExtensionDeveloperModeWarning/Enabled/*GFE/Default/*GoogleBrandedContextMenu/default/InstanceID/Enabled/MaterialDesignDownloads/Enabled/MaterialDesignUserManager/Enabled/MetricsAndCrashSampling/OutOfReportingSample/*NetworkQualityEstimator/Enabled/*NonValidatingReloadOnNormalReload/Enabled2/*OfferUploadCreditCards/Enabled/*OmniboxBundledExperimentV1/StandardR7/*Override YouTube Flash emed/YouTubeFlashRewrite/*PasswordBranding/Disabled/*PasswordGeneration/Disabled/*PasswordManagerSettingsMigration/Enable/*PluginPowerSaverTiny/Enabled2/*PreconnectMore/Default/*QUIC/EnabledNoId/ReportCertificateErrors/ShowAndPossiblySend/SHA1IdentityUIWarning/Enabled/SHA1ToolbarUIJanuary2016/Warning/SHA1ToolbarUIJanuary2017/Error/*SRTPromptFieldTrial/BiMonthlyPrompt/SSLCommonNameMismatchHandling/Enabled/*SSLPostQuantum/disabled/*SafeBrowsingIncidentReportingService/Default/SafeBrowsingUnverifiedDownloads/DisableByParameterMostSbTypes2/*SafeBrowsingUpdateFrequency/Default/*SignInPasswordPromo/Default/*StrictSecureCookies/Default/TranslateUI2016Q2/DefaultTranslateUI2016Q2/*TriggeredResetFieldTrial/On/*UMA-Dynamic-Uniformity-Trial/Group6/*UMA-Population-Restrict/normal/*UMA-Uniformity-Trial-1-Percent/group_47/*UMA-Uniformity-Trial-10-Percent/group_07/*UMA-Uniformity-Trial-100-Percent/group_01/*UMA-Uniformity-Trial-20-Percent/group_02/*UMA-Uniformity-Trial-5-Percent/group_02/*UMA-Uniformity-Trial-50-Percent/default/WebBluetoothBlacklist/BlacklistUpdate1/*WebFontsInterventionV2/Default/" --primordial-pipe-token=40FD41B8257D2C6E312516F374A00749 --lang=en-US --enable-offline-auto-reload --enable-offline-auto-reload-visible-only --blink-settings=disallowFetchForDocWrittenScriptsInMainFrame=false,disallowFetchForDocWrittenScriptsInMainFrameOnSlowConnections=false --enable-pinch --device-scale-factor=1.1041666269302368 --num-raster-threads=4 --enable-main-frame-before-activation --content-image-texture-target=0,0,3553;0,1,3553;0,2,3553;0,3,3553;0,4,3553;0,5,3553;0,6,3553;0,7,3553;0,8,3553;0,9,3553;0,10,3553;0,11,3553;0,12,3553;0,13,3553;0,14,3553;1,0,3553;1,1,3553;1,2,3553;1,3,3553;1,4,3553;1,5,3553;1,6,3553;1,7,3553;1,8,3553;1,9,3553;1,10,3553;1,11,3553;1,12,3553;1,13,3553;1,14,3553;2,0,3553;2,1,3553;2,2,3553;2,3,3553;2,4,3553;2,5,3553;2,6,3553;2,7,3553;2,8,3553;2,9,3553;2,10,3553;2,11,3553;2,12,3553;2,13,3553;2,14,3553;3,0,3553;3,1,3553;3,2,3553;3,3,3553;3,4,3553;3,5,3553;3,6,3553;3,7,3553;3,8,3553;3,9,3553;3,10,3553;3,11,3553;3,12,3553;3,13,3553;3,14,3553 --mojo-application-channel-token=40FD41B8257D2C6E312516F374A00749 --channel="4860.1284.267757369\20359401" --mojo-platform-channel-handle=17672 /prefetch:1
Marc
|
|
|
|
|
HOLY CRAP!
".45 ACP - because shooting twice is just silly" - JSOP, 2010
- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
I don't know if it's holy, but for sure it's /redacted/.
DURA LEX, SED LEX
GCS d--- s-/++ a- C++++ U+++ P- L- E-- W++ N++ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t++ 5? X R++ tv-- b+ DI+++ D++ G e++>+++ h--- ++>+++ y+++* Weapons extension: ma- k++ F+2 X
If you think 'goto' is evil, try writing an Assembly program without JMP. -- TNCaver
When I was six, there were no ones and zeroes - only zeroes. And not all of them worked. -- Ravi Bhavnani
|
|
|
|
|
They still use command line arguments!? That's so 1970's! I thought Google would be more modern than that.
if (Object.DividedByZero == true) { Universe.Implode(); }
Meus ratio ex fortis machina. Simplicitatis de formae ac munus. -Foothill, 2016
|
|
|
|
|
Hah hah. They used command line argument to send info to those child processes?
|
|
|
|
|