Is there a maximum size for Windows clipboard data?
devblogs.microsoft.com
devblogs.microsoft.com
Any process you ever enable in code will be pushed to limits you never dreamed possible. This is exactly where discoverability can come into play - someone starts by copying 50 rows and using that to get their job done, and may never realize there are other ways (CSV export, etc).
If code can "recognize" when something like this is being done and provide documentation on other ways, it can help people learn new methods.
Now I'm imaging Clippy popping up when you copy a ludicrous amount of data to the clipboard. "You appear to be using a cludgy method, may I suggest something better?"
Of course, I'm guilty of things like this. I have one excel macro that splits data from a giant stream* (one monolithic CSV, actually) into discrete units, graphs them, and then sorts the graphs for printing. It makes a lot of use of the clipboard, and god help you if you try to copy/paste something while the macro is running.
*Giant enough that at one point it grew to where I overran my Int and had to upgrade some of the code to Longs :V
Copy/paste works flawlessly through the VDI into the putty session, so I usually just uuencode my blob, and copy it to destination cluster and uudecode there, instead of uploading the file to the VDI, then pscp to the bastion host, and then scp to the destination cluster. (I know of zmodem, port forwarding and such, none of this is allowed...)
Once upon a time at $workplace we had a production and development LAN and we had two PC’s sitting on our desks, one for prod and one for dev.
Now there was a special SMB share to move stuff between the two networks but trying to copy something from one Pc to the other was tedious.
So of course I wrote a magic clipboard utility that used a file on that SMB share as the clipboard “storage”. Running the utility on both PCs allowed me to use copy-paste between the two PCs…
It's fun help a "savvy" Excel user understand how a relational database can reduce their byzantine VLOOKUP-based fever dreams into simple joins. Typically if somebody can grok VLOOKUP-fueled nightmares they can grok SQL pretty quickly and will actually appreciate what it can do for them.
They did, they called it Salesforce.com
Salesforce admin is a pain in the ass. There's mandatory updates 3 times a year that require low level software development expertise in order for the admin to understand what will break, building new functionality essentially requires tens of thousands of dollars of consultant development, and god help you if you want to run a report that involves objects that don't have a direct parent-child relationship.
I'm an analyst, and because I know how a database works, Salesforce stuff gets dumped on my desk all the time. I actively seek out alternative systems for everything it does, and would dearly love to see us drop this eye-watering expense.
If you're veering from defaults, you're doing Salesforce wrong. Even Salesforce's own Services team these days refuse to write custom code that'll break beyond default features.
In my experience that was guaranteed if any of the clients connected other than by ethernet.
I've not done it but I understand that it's not difficult to have an Access front end for a SQL Server backend rather than the default mdb or accdb backend.
All being Microsoft products the migration to SQL server is easy as I understand it.
I find it hard to understand why large companies would not adopt this approach.
I've done more "development" of Access-based applications over the years than I'd care to admit and, as a menu-driven front end for interaction with a client/server RDBMS (SQL Server, Postgres, etc) I think it's good cheap solution. Visual BASIC for Applications (VBA) can even do some powerful (and arguably ill-advised) stuff like directly calling Win32 APIs. It's an awesome prototyping tool in my experience.
The typical Access solution I see in large corporate environments is something knocked-together by non-IT people. Once it gets to the level of needing to be upsized to a client/server RDBMS back-end the "real" IT department comes in and demands a purpose-built solution. Usually bureaucracy, disdain for Access, licensing costs for the client/server RDMS, taking away file servers, etc, end up killing it.
Upon upgrading from Windows XP, Access was removed from the environment AND existing access databases were shoved into a database farm.
But any new business needs for something similar IE "Hey IT, we want a little app just to store XYZ business info" fell on deaf ears - the response was always "Hire IT Company to build it and hand it over." which of course would cost tens of thousands rather than a handful and thus priced it out of existence.
Which meant of course the business people started finding solutions OUTSIDE of IT Support purview....
Doesn't everyone make daily backups in production environments?
Also, aren't all backups made "just in case"? No sysadmin ever arrives at the office, thinking "Today that accountant is going to mess up the database, I can just feel it in my bones, better make a backup this time" (unless they think that every day...).
You are right on the backup thing. It's just funny to me because access databases on shared drives corrupt very regularly. It's less of it "just in case", and more of a monthly necessity
Microsoft already has built that web-based access data-layer, it's called Dataverse - http://aka.ms/dataverse https://www.youtube.com/watch?v=iSKVxx_ghbw
When I worked for a company where corporate used it, the problem was that people would come to me for help. M is pretty easy to learn so it wasn't a big deal for me. But I am a software dev with database experience, so I'm not sure who the target market is here--it's not the pure Excel users. Like, they wanted tables from a shared folder appended on each other and joined to another table. In pure Power Query you can do this without too much trouble, but you need to know what you are doing. These people have trouble with VLOOKUP already (I mean the string/int problem is unintuitive, so I'm not talking about that), so this is an impossible task for them.
I'd say it's for the better: sometimes you want to stay in the same tool, and it's the tool's job to interpret your intent.
Imagine you are editing a markdown file and have a picture in your Windows clipboard.
IMHO, the proper action would be to output base64 encoded jpeg data, even if it's "partially recreating the same functions", as it makes a copy-paste of screenshots from say the snipping tool (Win Shift S) seamless.
BTW, github doesn't support base64 encoded jpeg or png data, under the excuse that SVG could have security implications (which is true but not applicable for png/jpg) so don't bother trying it over there...
checks latest
64mb spreadsheet that amounts to one gigantic, ever slower pivot table.
I feel called out. Maximum number of rows in a VLOOKUP in personal spreadsheet is like an array of 2x1000. In an earlier job, it was 13x39000. Excel automatically increases the range when you add rows in the middle. Then I split my data per year, & it was like 13x5000.
One day, I asked him what it was and he showed me. He was running a series of excel macros that took over 96 hours to run, and fed a critical business process that was worth a few million dollars.
I sat down and took a look at it, and in about 3 days implemented a prototype in SQLite and a small Perl script that ran in about 8 minutes. Basically, it was a series of sql joins and some regex. My colleague, a project manager, literally hugged me and was near tears.
Some devs later took that prototype and refactored it to run on a normal production platform.
So we end up building the feature in Excel. With large (for Excel, say 100K-500K rows) data sets, it gets pretty slow. Or it'll get too complex, so we'll put it into our own Postgres DB.
Eventually, it'll get big/complex enough that we prioritize using development resources to automate the feature.
To an extent, this has become a standard part of our rigor for deciding whether or not to build features. You say you need X, but you aren't doing X today. Can't do you do that with an SQL pull and then doing all the business logic in Excel, and then creating the entries by hand? In some cases, the answer is no, we need it to be part of a larger pipeline, etc., but for a lot of things we do, building it by hand proves that the feature is needed, and also helps us work through the edge cases and makes writing the stories/BRD much easier. It also takes pressure off the dev team to try and intuit the true requirements.
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Excel.Range)
Dim intRetval As Integer
' TODO maybe respect some of the properties on Assistant to let the user disable this
If InStr(Target.Formula, "VLOOKUP") = 0 Then
Exit Sub
End If
' TODO is one use really "excessive"?
Assistant.Visible = True
With Assistant.NewBalloon
' TODO I should probably do ".Mode = msoModeModeless" but I don't feel like writing a callback
.Text = "It looks like you're trying to implement a relational database in a spreadsheet."
.Labels(1).Text = "Get professional help"
.Labels(2).Text = "Just let me generate excessive technical debt without help"
.CheckBoxes(1).Text = "Don't show me this tip again"
.Button = msoButtonSetNone
.Animation = msoAnimationGetAttentionMinor
intRetval = .Show
' TODO make the user's choices actually do something
End With
End Sub
You'll need to load Office 97 or some other ancient version in a VM if you want to actually try this, since Microsoft finally killed off Clippit completely in Office 2007.might i introduce you to sed and awk?
Honest question though, as I have no experience with utilities like that: Could those tools together manipulate e.g. the data on the left to the graphs on the right?
depending on your windows, you might be able to take advantage of WSL or as a last resort run cygwin. maybe there are other methods of using awk/sed/grep type utilities as well, but I am not familiar.
i still remember the day when someone watching me struggling with large text files and took pity on me by showing me the light of the holy power of awk/sed/grep. it was taking minutes to make each search/replace edits and I had several of them. it took mere seconds for the shell commands to process the same thing.
I disagree with sibling comments that copy/paste is a hacky solution. It's a very natural one for lots of users and there's no actual fundamental reason not to be able to accommodate it.
This is a "Microsoft refuses to make composable software" problem.
This can get annoying though if the user is deliberately doing something that ends up triggering these messages.
There was a long discussion on memory management before they just stuck a max size on it.
Not me. And that’s not a brag. It is probably not a productive way to think using modern toolsets. But in my world, if you can copy a few things, you should definitely expect someone to copy a shitload of things or at the very least, document clearly and with rich error messages what went wrong.
Likewise, I tend to get nervous when I can’t explicitly handle out of memory conditions, and the problem is I’m a Go programmer. It kind of bothers me that there’s no standard way to deal with that on my end with built-in data structures such as maps and strings. This is probably sheer paranoia because most modern systems have plenty of memory… But it still leaves me uneasy.
Aha, so that's why Word[1] just explicitly asked me if I want to save the current copied image before quitting. It's probably asking before loading something big into memory?.
I don't think there is any implication that font files are being included with the data.
it has nothing to do with clearing memory.. clearing memory for anticipated use isn't really a thing ever since virtual memory became a thing. (memory isn't prepared for use until after an application actually tries to use it.)
Thanks Raymond! I decided to go the startup route instead of returning to MSFT, but you were an inspiration all the same.
I can take a screenshot of my Firefox with "PrtScn" button (moving a bitmap of the page into the Clipboard), paste it into Microsoft Paint, edit it a bit, and then copy/paste that into my Discord chat screen for commentary.
--------
Yes, Linux / *Nix users have pipes and great text processing tools. Yes, Powershell has interesting objects that can be passed round. But practically speaking? Most of my "inter-process communications" is over this silly "Clipboard" Windows has, and it works way better than it probably should.
We use this so users can attach invoices and other documents they've received through mail to orders in our application. Users typically run Outlook on their laptop/PC, but our application as a published application.
We rely on Excel exposing the data in an XML format on the clipboard to reliably import data from Excel. Same for Open/LibreOffice. Without it it's impossible to handle cells which contain both the quote character and newlines, due to the way Excel formats plaintext.
We don't want to import the whole file, because the users typically only need to import parts of the spreadsheet. This saves us from writing a complex UI to select the data to import.
And FWIW, I've used that with >100k rows of data.
home PC ->
RDP to work laptop at home ->
VNC to work network ->
RDP to work desktop ->
RDP to other VMs and PCs at work
I can copy text or a file or a screen shot at any level and paste at any other level. Pretty amazing.This idea has a lot of legs IMO.
It was one of the easiest-to-use calculators I've ever seen. Just enter your webpage to play the game, Ctrl-A (select-all), Ctrl-C (copy), and bam, the Utopia-program would instantly analyze your kingdom and provide advice.
Just all off of the HTML-copy that Clipboard supports.
------------
Windows developers "know" the clipboard is one of the most important inter-process communication structures of the entire system, and have known for years. Its probably one of the Win32 API's biggest advantages, no joke.
The shear amount of creative solutions I've seen from clipboard manipulations is outstanding.
It turns out, more and more applications are locking the clipboard and holding onto the lock inappropriately. Enough that there's a particular telemetry watcher for this condition for MSFT to get an idea on who the guilty parties are.
Everyone has had it happen - I notice it when colleagues are in a rush and send me something they didn't mean to send (because their clipboard didn't update). I don't know who the guilty parties are (since that telemetry is encrypted, and can't be inspected), but I sure hope someone is knocking down some doors to address the problem.
But you have found that it helps?
I am sure Raymond Chen knows. Looks like comments are allowed on his blog too!
I configured my clipboard manager to make a crinkly paper noise when an app copies, so at least I have some feedback when it fails.
### Starting Party
#
# Cariel Roame
# - Tome of Light 4
# Xyrella
# - Robes of Purity 2
# Rokara
# - Helm of Inspiration 1
# Murky
# - Time to Krill 3
# Millhouse Manastorm
# - Arcane Powder 1
# Deathwing
# - Heart of Unliving 3
#
CO+cmQQSDlN0YXJ0aW5nIFBhcnR5GAEiRQoJCBIQiwEYICAACgkIExDKARgjIAAKCQgLEIgBGAsgAAoLCLgCEOMCGLIEIAAKCAgOEB8YFCAACgsIqgIQygIYkgQgACgA
#
# To use this deck, copy it to your clipboard and create a new deck in HearthstoneIf it's a regular win32 app, then it has access to all your filesystem (except UAC bits), can read and post keystrokes to other windows, and indeed can just straight up inject code into other processes.
Is protected folder access an on-by-default thing, or is it only certain folders?
Quick googling makes me think my plan might trigger windows defender for an exemption request. Hm That's a drag, but understandable I suppose?
But honestly, I've had to whitelist Microsoft's own Windows utilities from CFA in its earlier days, so don't fret about it.
Thank you for the info.
I'm not sure why it would be impressive or unusual. The ability to store arbitrary data on the clipboard with metadata that describes what data it is, such as an image file, or an audio file, is very old.
Except its no where near as smooth or universal as in Windows. In Linux, you have to worry about KDE programs vs GNOME programs having different clipboards, for example.
Its also why compatible suites of programs (ie: Adobe) can be so useful when those custom formats come into play. Adobe can copy/paste layers from Photoshop and send them over to other programs. If the photoshop layer isn't understood, it seems to become a Bitmap, which works when I'm on a VBulletin forum over in Firefox land.
---------
Copy/paste works on files / file-managers, images, text, HTML. Yes, any OS could do the same thing, but they largely don't in my experience.
I don't worry about this on linux because it's not the case.
I suppose if I were on windows I would have to worry about legacy programs that only understand UCS-2 not being able to talk to modern programs that only understand UTF-8.
>Its also why compatible suites of programs (ie: Adobe) can be so useful when those custom formats come into play. Adobe can copy/paste layers from Photoshop and send them over to other programs. If the photoshop layer isn't understood, it seems to become a Bitmap, which works when I'm on a VBulletin forum over in Firefox land.
I'm able to paste images from GIMP, Krita, and Thunar into forums just fine.
But even if old, it's still notable that such an old concept/technology works so well, and there are few newer inter-process communication methods that work as reliably or with as good UX!
Who invented the "clipboard", Xerox PARC? No, wikipedia just credits two individuals, Pentti Kanerva and Larry Tesler .
https://support.apple.com/guide/mac-help/copy-and-paste-betw...
Selecting text and middle clicking is so much faster than ctrl+c, ctrl+v. Having the two separate, allows you to essentially copy two separate things at once, and paste them separately, which is great for filling out forms.
Also, KDE provides an absolute gem of a clipboard manager, which stores all recent copies in to a list, from which entries can be browsed in order to recopy some text that you may have copied a while ago. IDK where you got the idea that Gnome apps have a different clipboard, as I have never experienced that. Maybe that is an old thing? Definitely not how it is now, thats for sure.
Copy/paste works on files / file-managers, images, text and HTML. This is not a Windows only experience. In fact, the clipboard manager even has little file icons, and image previews, for copied objects.
In windows 10 and up, win + v to see (and the first time, enable) the clipboard history selector
Note that KDE has had it pre Windows 10 though.
Just for completeness & correctness: that's an X11 feature, not related to KDE, and predates KDE by several years. I can't easily find the history of it, but this Keith Packard paper[0] on it is dated 1990 so it's necessarily older than that…
[0] http://keithp.com/~keithp/talks/selection.ps
(pg. 5, "4.1. Selection names" - PRIMARY, SECONDARY, CLIPBOARD. I don't think SECONDARY is used much these days.)
I am no sure where you get this idea. The clipboard is an X11 shared resource and any program taking control of it removes what any other had on it before.
> Its also why compatible suites of programs (ie: Adobe) can be so useful when those custom formats come into play. Adobe can copy/paste layers from Photoshop and send them over to other programs. If the photoshop layer isn't understood, it seems to become a Bitmap, which works when I'm on a VBulletin forum over in Firefox land.
The same exists on X11, programs can define custom metadata and define a hierarchy of different metadata and associated data on the clipboard and any application can decide for itself which formats it understands and which it does not.
I've personally built software that puts images on clipboards, and falls back with uris to that image if direct images not be supported by whatever reads it.
The basic APIs were there from the beginning in Windows 1.0, including multiple clipboard formats, application specific formats, and the ability to register for clipboard changes. More standard formats have been added over the years, but it still supports some ancient formats, like Software Arts' Data Interchange Format.
https://www.os2museum.com/wp/windows-history/windows-library...
Way back in the 90s, it was possible to put any (+) document inside any sufficiently aware app or document with OLE ("object linking and embedding")
The (+) indicates that there were a lot of terms and conditions applying to this, but you could actually just put an excel spreadsheet in a word document, and it would run a small copy of excel inside word. This is why the original word save format is so horrendous - it's serialized binary objects.
Cool idea though!
Something similar is available in the more modern Windows 'snipping tool' feature (win-shift-s) but without the tablet magic.
Another under-appreciated Windows feature is how they implement drag-and-drop apps. When you drag a file into an app icon, it just stuffs the file path into the command line arguments and runs the app. In contrast, though MacOS introduced drag-and-drop, actually implementing it in System 7 was a huge complex chore.
It does instant rectangular selection, then pops up a simple editor which you can then copy/paste anywhere you'd like.
I have Win+Shift+S bound to a mouse chord, as well as copy and paste, so I can actually paste an arbitrary rectangle of my screen without touching the keyboard.
Insanely well engineered. It can perform miracles of computing. It damn well has to.
> I can take a screenshot of my Firefox with "PrtScn" button (moving a bitmap of the page into the Clipboard), paste it into Microsoft Paint, edit it a bit, and then copy/paste that into my Discord chat screen for commentary.
All without you worrying about supported image formats or color space encodings! It is insane! Copy from Firefox and then paste into a program that expects 16bit color and it'll probably work. The clipboard stores data in so many duplicate formats and can convert between so many formats, it is nuts.
For example, copying from Excel can output:
- to a table (when copied into word)
- to rich text when copied into Wordpad
- to plain text when copied into Notepad
- and even an image when copied into Paint.
All without having to select the desired type at the source.
If I used arch or some other power user linux, I suspect I would have to jump through quite a few hoops to get this experience setup as nicely. But as someone who daily drives both a linux distribution and a windows distribution, I see no notable differences in clipboard functionality.
https://devblogs.microsoft.com/oldnewthing/20220609-00/?p=10...
That, somehow, seems like the wrong conclusion. Why not try to solve the problem of Excel taking longer than 30 seconds to export a RTF table?
Thankfully, that can't happen :). XLSX has a row limit of 1,048,576 rows.
In all seriousness, I don't have an answer for you other than that the developer that's looking to shove >1M excel rows around should find a better solution than the clipboard. I've done more than my fair share of work pushing excel spreadsheets around (and I've even worked on Excel add-ins). There are plenty of performant ways of accessing large volumes of Excel data, none of them involve the clipboard. Most of them even work on non-Windows platforms.
The arbitrary row & column limits in Excel (XLS was pretty small, XLSX is quite a bit bigger, but still arbitrary) are annoying and I cannot begin to tell you how many hours over the years I've wasted due to this limitation or Excel silently truncating large CSV files on import.
Excel is an intensely business-critical product and has a lot of smart folks working on it. There are tradeoffs you're eliding and I'm confident that they know of them.
As a tech user, you quickly learn to fall in love with "paste as raw text", which skips all that and just give you text data.
'6K rows, 300ms to insert into page on paper (console.time(1); console.timeEnd(1)), but in reality browser freezes for 3 seconds (1.8s style, 900ms layout, 300ms update tree). Freezing goes away with position: absolute, but it still takes 3 seconds to show up after .appendChild. I tried replacing Table with Flex divs, even worse speed.'
I imagine I could make Chrome hang for more than 30 seconds with plain old HTML Tables :)
I guess I'm impatient... how does one go about this?
wild.