19,785 Matching Annotations
  1. Apr 2022
    1. I found something wired! I had a target=blank in my kindergarten.svelte file that when I click on a link that opens in a new tab , in that tab when I click on other links page doesn't load without refresh! It's a little bit confusing !

      doesn't make sense

    1. In fact, "stuff" was a better name. If I said "put it in the context", there were like 15 things in the codebase called "context", but "put it in stuff", well, there's only one thing called "stuff". Because no one else was brave/silly enough to use that name.

      naming

    2. I suppose most systems use a word like "context", "environment", "data", "info", "headers", "metadata"... but those words really aren't any more descriptive, now are they! They are just stuff!

      naming

    1. Loading in, receiving, and/or passing cargo

      naming

    2. Synonyms include bequest and primogeniture, which are both wonderfully ridiculous suggestions

      naming

    3. The drawback of a few more keystrokes is a hit I'll gladly take.
    4. Since context just fits best if it wasn't taken already, I propose layoutContext or loadContext to show a) the semantic similarity to contexts but b) make it visible that this is different and belongs to a specific part.
    5. inherit inherits inherited pipe chain context (keep as is) locals (again) tunnel metadata env scene domain foo $layout

      naming

    6. payload bag obj

      naming

    7. yield, present, furnish

      naming

    8. isn't ideal but it sort of works if you squint

      .

    9. Some ideas that were floated, in no particular order of terribleness:

      .

    10. I tried mapping out the different flow of information for the two different contexts:
    1. it's the fact that Microsoft hasn't prioritized this work. There's nothing magical about Blink or V8 that makes the Chrome password manager better than Edge's; it's just that Google has taken the time to do the work.

      .

    1. Will be executed right after outermost transaction have been successfully committed and data become available to other DBMS clients.

      Very good, pithy summary. Worth 100 words.

      The first half was good enough. But the addition of "and data become available to other DBMS clients" makes it real-world and makes it clear why it (the first part) even matters.

    2. (I can't imagine use case for it but if you can, please open a pull request or issue).
    3. after_commit { puts "We're all done!" }

      Notice the order: this is printed last, after the outer (real) transaction is committed, not when the inner "transaction" block finishes without error.

    4. We're all done!

      Notice the order: this is printed last

    1. I'm a big fan of refinements (yes, I am), and that's what I did to make this code look simpler and more beautiful:
    2. These callbacks are smart enough to run after the final (outer) transaction* is committed. * Usually, there is one real transaction and nested transactions are implemented through savepoints (see, for example, PostgreSQL).

      important qualification: the outer transaction, the (only) real transaction

    1. These callbacks are focused on the transactions, instead of specific model actions.

      At least I think this is talking about this as limitation/problem.

      The limitation/problem being that it's not good/useful for performing after-transaction code only for specific actions.

      But the next sentence "This is beneficial..." seems contradictory, so I'm a bit confused/unclear of what the intention is...

      Looking at this project more, it doesn't appear to solve the "after-transaction code only for specific actions" problem like I initially thought it did (and like https://github.com/grosser/ar_after_transaction does), so I believe I was mistaken. Still not sure what is meant by "instead of specific model actions". Are they claiming that "before_commit_on_create" for example is a "specific model action"? (hardly!) That seems almost identical to the (not specific enough) callbacks provided natively by Rails. Oh yeah, I guess they do point out that Rails 3 adds this functionality, so this gem is only needed for Rails 2.

    2. This is beneficial

      seemingly contradictory with previous sentence, which described a problem....

    1. In this case, the worker process query the newly-created notification before main process commits the transaction, it will raise NotFoundError, because transaction in worker process can't read uncommitted notification from transaction in main process.
    1. I am not looking for model based after commits on update/create/etc, I want to be able to dynamically define a block that will be executed only if the current (top-most) transaction passes:
    2. This would work if your transaction only wraps a single model's save operation. I need to wrap at least Node + Version + Attachment

      looking for a callback that you can register to happen after current transaction is committed, not just after_commit of model -- though actually, that might fire precisely when current transaction is committed, too (except that it might only get triggered for nested transactions, not the top-most transaction), so it could maybe go there ... but I think the problem is just that it doesn't belong there, because it's not specific to the model...

      I guess the OP said it best:

      I am not looking for model based after commits on update/create/etc, I want to be able to dynamically define a block that will be executed only if the current (top-most) transaction passes:

    1. We’re going to build the query from the inside out; concentrate on what each step means and how we combine them, not what it will return if run in isolation.
    2. (Note this is NOT post.comments.order... we don’t know what post, yet. We want the final query to return comments, so our filter starts with Comment.)
    3. SELECT lateral_subquery.* FROM posts JOIN LATERAL ( SELECT comments.* FROM comments WHERE (comments.post_id = posts.id) LIMIT 3 ) lateral_subquery ON true WHERE posts.id
    4. You want the front page to show a few hundred posts along with the top three comments on each post. You’re planning on being very popular, so the front page will need to be very fast. How do you fetch that data efficiently from postgresql using Activerecord?
    5. Making one Comment query per Post is too expensive; it’s N+1 queries (one to fetch the posts, N to fetch the comments). You could use includes to preload all the comments for all the posts, but that requires hydrating hundreds of thousands of records, even though you only need a few hundred for your front page. What you want is some kind of GROUP BY with a LIMIT on each group — but that doesn’t exist, either in Activerecord nor even in postgres. Postgres has a different solution for this problem: the LATERAL JOIN.
    1. Beer.scoped.arel.class => Arel::SelectManager
    2. beer = Beer.arel_table union = Beer.where(name: "Oberon") \ .union(Beer.where(name: "Two Hearted")) Beer.from(beer.create_table_alias(union, :beers)).all
    1. Description of the problem: Select all users from a DB with their parents which have the association by parent_id column. Possible solution: Recursive Common Table Expression.
    1. join = Arel::Nodes::NamedFunction.new('json_b_array_elements', [Arel::Nodes::SqlLiteral.new("subscriptions")]) .as(Arel::Nodes::NamedFunction.new('sd', [Arel::Nodes::SqlLiteral.new("subscription_data")]).to_sql) p = e.project( Arel::Nodes::SqlLiteral.new( Arel::Nodes::Grouping.new( Arel::Nodes::InfixOperation.new('->>', sd[:subscription_data], Arel::Nodes::SqlLiteral.new("'id'"))).to_sql) << '::uuid' ).where( Arel::Nodes::InfixOperation.new('->>', sd[:subscription_data], Arel::Nodes::SqlLiteral.new("'type'").eq( Arel::Nodes::SqlLiteral.new("'Company'") ) ).and(e[:slug].eq(event_slug))) p.join_sources << Arel::Nodes::StringJoin.new( Arel::Nodes::SqlLiteral.new('CROSS JOIN LATERAL')) << join
    1. SELECT "users".* FROM "users" wHERE 'admin' = ANY("users"."roles")
    2. any_role = Arel::Nodes::NamedFunction.new("ANY", [User[:roles]])

      any

    1. c2 = Comment.arel_table.alias s1 = Comment.arel_table. project(c2[:user_id], c2[:created_at].maximum.as('max_created_at')). from(c2).group('user_id').as('s1') puts s1.to_sql # (SELECT "comments_2"."user_id", MAX("comments_2"."created_at") AS max_created_at # FROM "comments" "comments_2" GROUP BY user_id) s1

      as() to give subselect an alias

    1. Generates the following sql in sqlite3: "SELECT \"patients\".* FROM \"patients\" INNER JOIN \"users\" ON \"users\".\"id\" = \"patients\".\"user_id\" WHERE (\"users\".\"name\" LIKE '%query%')" And the following sql in postgres (notice the ILIKE): "SELECT \"patients\".* FROM \"patients\" INNER JOIN \"users\" ON \"users\".\"id\" = \"patients\".\"user_id\" WHERE (\"users\".\"name\" ILIKE '%query%')" This allows you to join with simplicity, but still get the abstraction of the ARel matcher to your RDBMS.
    1. def self.current_table_name current_table = current_scope.arel.source.left case current_table when Arel::Table current_table.name when Arel::Nodes::TableAlias current_table.right else fail end end
    1. Product. joins(Arel::Nodes::InnerJoin.new(subquery, Arel::Nodes::On.new( t[:version_id].eq(subquery[:version_id]).and( t[:date].eq(subquery[:max_date])))))
    1. It’ll fill the area by default, but it doesn’t have to. It could be smaller or bigger. It could be aligned into any of the corners or centered.
    2. Perhaps the most interesting limitation is that you can’t target the grid area itself.
    3. So you can’t apply a background and know it will cover that whole grid area anymore.
    1. A major issue with G Suite legacy free accounts is that they act as Google accounts for the whole Google ecosystem. In addition to emails, calendar events and contacts, some users with G Suite legacy free accounts have been using those accounts with YouTube, Google Maps, purchases on Google Play, Google Drive and more.

      free not free

    1. I've hosted close friend's and family's email for a decade now on an old G Apps instance. We only ever used it for email on a custom domain.

      free no longer free

    1. where the balance is between optimal behavior and having to ship a whole bunch of attribute/property lookup information to the browser with the app whenever someone uses spread attributes.
    1. Taking a look at the ~20 svelte form solutions out there, this either means the market is now filled with good solutions, or, like with the many flutter state management libraries, all current solutions are not good enough.

      tautology?

    1. FWIW, I'm using triggers to get around AR's habit of sending NULL instead of DEFAULT: create function medias_insert_make_uuid() returns trigger as $$ begin NEW.uuid := random_characters(12); return NEW; end $$ language plpgsql; create trigger medias_insert_make_uuid before insert on medias for each row execute procedure medias_insert_make_uuid();
    2. If I create a model ActiveRecord sends NULL values for every field that is not defined. Postgres dutifully writes the NULL value into the field instead of the default value. Activerecord should either send nothing (preferable) or send DEFAULT.
    1. infer is there to say you know you are declaring a new type (in the conditional type's scope) - much like you have to write var, let or const to tell the compiler you know you're declaring a new variable.
    1. 4.3.9 undefined value primitive value used when a variable has not been assigned a value 4.3.11 null value primitive value that represents the intentional absence of any object value
    1. You are not allowed to automate the Gmail interface, whether to send, delete, or filter emails, in a manner that misleads or deceives users.

      key words: in a manner that misleads or deceives users.

      automation in itself is not bad

    2. Please keep in mind that your definition of “unsolicited” or “unwanted” mail may differ from your email recipients’ perception. Exercise judgment when sending email to a large number of recipients, even if the recipients elected to receive emails from you in the past.
    3. When Gmail users mark emails as spam, it increases the likelihood that future messages you send will also be classified as spam by our anti-abuse systems.

      .

    1. Calls initiated via the REST API are rate-limited to one per second. You can queue up as many calls as you like as fast as you want, but each call is popped off the queue at a rate of one per second.
    1. So no, nnn doesn't try to guess your environment and use-cases and per-decide workflows. It tries to remain generic with sane examples (in the form of plugins) to extend the functionality.

      generic

      extensible

      good design

    2. so the effort to make it work for every audio player on all user environments is futile.
    3. Let's say the user is in the process of selecting some files. The names don't indicate anything. So she has to listen and select.
    4. just because a tool does it on-the-fly on Enter doesn't mean it is the right behaviour.

      just because ... doesn't mean ...

    1. Setting "img max-width:100%" is a technique employed in responsive/fluid web site design so that images re-size proportionally when the browser is re-sized. Apparently some css grid systems have started setting this style by default. More info about fluid images here: http://www.alistapart.com/articles/fluid-images/
    1. Now, our img element will render at whatever size it wants, as long as it’s narrower than its containing element. But if it happens to be wider than its container, then the max-width: 100% directive forces the image’s width to match the width of its container.
    1. When setting up SAML SSO in your organization, you can test your implementation without affecting your organization members by leaving Require SAML SSO authentication for all members of the organization name organization unchecked.
    1. I know about the interpolation brackets method, but what if the selector is deeper in the three, for example three of four layers deep? I only want its parent selector to be duplicated, not the whole selector tree.

      nuanced problem

    1. In Rails, this is known as nested layouts, and it is a bit awkward to use. The standard Rails practice for nested layouts is complicated and involves these considerations:
    1. When a web page is viewed on a screen with a large physical size (assuming a maximised browser window), the author might wish to include some less relevant parts surrounding the critical part of the image. When the same web page is viewed on a screen with a small physical size, the author might wish to show only the critical part of the image.
    1. We tend to put images into flexible container elements, and the image inside is set to width: 100%;

      100% relative width of parent element

    2. There are ways to create aspect-ratio sized boxes in HTML/CSS today. None of the options are particularly elegant because they rely on the “hack” of setting a zero height and pushing the boxes height with padding. Wouldn’t it be nicer to have a platform feature to help us here?
    1. A type lockup is a typographic design where the words and characters are styled and arranged very specifically.

      .

    1. Danke! Danke! Danke! ich suche seit Tagen nach einer Lösung und das hier ist es!

      The only German comment on the page :)

    1. Assumes you're using screen 0 (if you didn't know that displays could have more than one screen, ignore this).

      if you didn't know that ..., ignore this :)

  2. Mar 2022
    1. # Allows you to just run "pry" inside a Rails app directory and get # everything loaded as rails c does. Inside a Bundler directory does # what bundle console does.
    1. The other one is xvkbd which sends keyboard events from a lower subsystem. You can pipe keystrokes into it on STDIN. Combined with xsel, you get something like this: $ xsel | xvkbd -xsendevent -file -
    2. The last note is that when binding commands to keyboard shortcuts it is often necessary to only have one command, not two commands connected with a pipe like we use above. You can accomplish this by invoking your piped command as a command string argumetn to a new shell like this:
    1. X clipboard The X window system has its own clipboard. It is also known as a cutbuffer. Any text or content you mark by highlighting with the mouse cursor is automatically copied to this clipboard. This is known as the PRIMARY selection or X Window selection or just selection in X jargon. When you middle-click the mouse cursor at the destination location, this copied content is pasted there.
    1. xdotool key --clearmodifiers ctrl+shift+v
    2. In 13.10, Shift+Insert pastes from the selection buffer (the thing that selecting text writes to). In Libre Office, Chrome, and Firefox, Shift+Insert pastes from the clipboard. I would thus like to configure gnome-terminal to do the same.
    1. "xclip -i /dev/null" b:2``
    2. xdotool search --onlyvisible . behave %@ focus exec xclip -i /dev/null
    3. The while(true) is not a problem because the loop contains sleep 0.5 which relinquishes half a second of CPU time in each of the loop's iterations. Because of that (and the lightweightness of the xsel command invocation which comprises the other part of the loop), the CPU resources taken up by the loop will be exceedingly tiny even on the slowest of Ubuntu machines.
    4. While this isn't a solution, hopefully this explanation will make it clear WHY. In Ubuntu there are two clipboards at work. One, which everyone is familiar with, the freedesktop.org clipboard (captures Ctrl+C command) The second is a clipboard manager that has been at play since before Ubuntu even existed - X11. The X Server (X11) manages three other clipboards: Primary Selection, Secondary Selection, and Clipboard. When you select text with your pointer it gets copied to a buffer in the XServer, the Primary Selection, and awaits pasting by means of the Mouse 3 button. The other two were designed to be used by other applications in a means to share a common clipboard between applications. In this case the freedesktop.org clipboard manager in Ubuntu already does this for us.
    5. I realize this isn't an ideal solution - but seems to be the truth to the issue. The only relevant solution I could muster is actually a hack, create a script that executes an infinite while loop that just replaces the Primary Selection with a null value.
    6. Not what you asked, but as this question is linked to from a few places I hope someone finds this answer useful.
    1. Its core theme - segregation. It's done in such an ingenious and innocent way - colour.

      new tag: not so much sneaky, but clever way of communicating an idea/message/theme

    1. particularly affecting users of Typekit, a web typography product from Adobe Systems.[1] Within 2 months, Adobe had changed the way in which their fonts were included into third-party websites in order to avoid the undesired rendering behaviour.

      forcing somebody to fix something by making the problem big enough that it's embarrasing

    1. Add a rule to /lib/udev/rules.d/69-libmtp.rules just after LABEL="libmtp_usb_rules": ATTR{idVendor}=="0bb4", ATTR{idProduct}=="0f91", RUN+="/bin/sh -c 'env >> /home/username/udev-phone-mtp_%E{SEQNUM}.log'"
    2. usb-devices
    3. lsusb -t
    1. Element is a realtime strategy space game for people who don't have time to play realtime strategy space games.

      .

    1. I believe your description of the proper mixture (add 24 oz to a gallon of water) is misleading. I have used Ortho Ground Clear concentrate for years with outstanding results; the way I mix it, I include the 20% of concentrate with the 80% of water and this has never failed me. Your recommended mixture is too thin/weak to work properly.

      .

    1. const aYearFromNow = new Date(); aYearFromNow.setFullYear(aYearFromNow.getFullYear() + 1); console.log(aYearFromNow);
    1. Don’t make the mistake of conflating Rails secrets with Rails credentials (like I did several times before learning better!).
    2. I found this counterintuitive because usually I try to make all my passwords, etc. different for each environment I have. I thought I would need to create a different master key for my production environment. No, I need to not create a different master key.
    1. This has cropped up in particular when trying to create a copy of a store object when the store changes (which is a common use case with forms where you don't want to mutate the global store until the form is saved).

      Exactly! This is more or less the same kind of use case I tend to have: intentionally having/wanting a stale/out-of-date copy of a (reactive) object.

    1. Purge the repository: sudo apt install ppa-purge sudo ppa-purge system76/pop This will remove all conflicts/depends/packages/changes done by the PPA.
    2. sudo dpkg -i --force-overwrite /var/cache/apt/archives/pop-gnome-initial-setup_3.36.1~1612193315~20.04~4367c76_amd64.deb
    1. Reopening this as it does seem we have broken compatibility with the oldest GPUs. Even if NVIDIA no longer support them, if they used to work it should still work.
    2. NVIDIA periodically drops older cards off of its support matrix for NVENC/NVDEC, even if they do have the required hardware. This makes it appear, at first glance to current information sources, that Kepler GPUs do not support NVENC, so we responded as such.
    1. level 1Fatal_Taco · 2 days ago · edited 2 days agoArch Linux, and likely most distros, are defined by these few things and are not limited to:The Linux Kernel, what type of config and modules it's been compiled with.The pre-packaged programs it comes with by default.The init.The package manager.The repositories it references.The slightly differing Linux Filesystem Hierarchy.The types of computers it runs on.
    2. Just like any other distribution, Arch Linux is just a collection of utilities strapped together running Linux kernel under the hood.
    1. Their dismissive attitude of, it's not an OBS bug is off-putting, how do they know? I was told I am not using their support version of Linux so they closed off my bug and told me to go on the forum.
    1. I believe this is partly due to a militant position on free software. Some advocates believe so strongly that users should be able to recompile their software that they force them to do so. They break libraries seemingly on purpose just to say, “Recompile! Oh you can’t? That’ll teach you to use binary software!” Of course users don’t want to recompile their software, but what users actually want is usually lost on GNOME developers.
    2. Today, on my machine, the KCalc Snap takes a full seven seconds to start up. Not just the first time after boot; every time, without fail. Seven seconds to start a calculator.
    3. Snap is the slowest of all, largely because it stores all its data in squashfs images. Snap mounts all registered snaps at startup instead of just extracting the metadata they need beforehand, possibly in an effort to mitigate this slowness. They’re just moving part of the slow startup time to the boot time of your computer. All sorts of snap crap now shows up in mount and fdisk -l. The more snaps you have installed, the slower your computer will start, even if you don’t use them.
    4. Software has gotten so much slower and more bloated that operating systems no longer run acceptably on spinning rust.
    5. They claim that they deduplicate runtimes. I question how much can really be shared between different branches when everything is recompiled. How much has /usr changed between releases of Ubuntu? I would guess just about all of it.
    6. Flatpak says this is so that apps can share runtimes. But the whole point of their runtime system is to let apps use different runtimes.
    1. Yeah, Ubuntu also seems to be getting as resource intensive as Windows
    2. I've been saying that Ubuntu is resource hungry for years.
    3. I used to maintain a small patch set of issues that affected me and were fixed on the GNOME bugzilla but ignored by main devs. This is was a motivating factor in my switch to to Unity years ago. Sad to hear this situation hasn't improved.
    4. I don't want to agree with you, but I tried to make a few polishing contributions to GNOME games and they got ignored after the first developer response (they told me what to fix, I fixed it). They've been stagnant for over 3 years now.
    5. Submitting changes and having them accepted by GNOME is an exercise in futility if you aren't a GNOME dev.
    1. Flatpak is built on top of a technology called OSTree, which is influenced by and very similar to the Git version control system. Like Git, OSTree allows versioned data to be tracked and to be distributed between different repositories. However, where Git is designed to track source files, OSTree is designed to track binary files and other large data.
    2. Storing applications in a local OSTree repository has other advantages. For example, it allows files that are stored on disk to be deduplicated, so the same file that belongs to multiple applications (or runtimes) is only stored once.
    3. Internally, Flatpak therefore works in a similar way to Git, and many Flatpak concepts are analogous to Git concepts. Like Git, Flatpak uses repositories to store data, and it tracks the differences between versions.
    1. The underlying architecture might be summarized as “git for operating system binaries”.
    1. GitLab self-monitoring gives administrators of self-hosted GitLab instances the tools to monitor the health of their instances. This feature is deprecated in GitLab 14.9, and is scheduled for removal in 15.0.

      motivated by profit?

    1. The reason for the new name is that the "dist-upgrade" name was itself extremely confusing for many users: while it was named that because it was something you needed when upgrading between distribution releases, it sounded too much as though it was only for use in that circumstance, whereas in fact it's much more broadly applicable.
    2. his serves as a good example of apt-gets stability. In apt, the name was changed to be more user friendly, while in apt-get the name remains unchanged so as not to break compatibility with old scripts.
    3. Use apt as a first choice, but if you're scripting use apt-get. Apt-get has more stable output (meaning that the output format is left alone as much as possible so as not to break scripts which parse that output automatically). Apt-get also has some low-level commands not available in apt.
    4. Yes they are the same command. This part of apt's cmdline/apt.cc source file proves it:
    1. Just let it expand inside an array declaration's right side: list=(../smth*/) # grab the list echo "${#list[@]}" # print array length echo "${list[@]}" # print array elements for file in "${list[@]}"; do echo "$file"; done # loop over the array
    1. Capybara can get us part of the way there. It allows us to work with an API rather than manipulating the HTML directly, but what it provides isn't an application specific API. It gives us low-level API methods like find, fill_in, and click_button, but it doesn't provide us with high-level methods to do things like "sign in to the app" or "click the Dashboard item in the navigation bar".
    2. A page object is a data structure that provides an interface to your web application for the purposes of test automation. For example, it could represent a single HTML page, or perhaps even a fragment of HTML on a page.
    3. A page object wraps an HTML page, or fragment, with an application-specific API, allowing you to manipulate page elements without digging around in the HTML.
    1. This is particularly useful in cases where you want to separate your data migrations from your schema migrations or where you have multiple steps in your migration process that must have other steps invoked throughout.
    1. In 1994, The Unix-Haters Handbook was published containing a long list of missives about the software—everything from overly-cryptic command names that were optimized for Teletype machines, to irreversible file deletion, to unintuitive programs with far too many options. Over twenty years later, an overwhelming majority of these complaints are still valid even across the dozens of modern derivatives. Unix had become so widely used that changing its behavior would have challenging implications. For better
    1. Pragma::Migration is an experiment at implementing Stripe-style API versioning.
    2. # Optionally, you can write a description for the migration, which you can use for # documentation and changelogs. describe 'The _id suffix has been removed from the author property in the Articles API.'
    3. apply_to '/api/v1/articles/:id'
    1. When we insert data into the comments table, we need it to route to be inserted into a partition instead of the actual table. For that, we can create a trigger: add_partition_trigger :comments, :comments_by_year, [ { if: 'NEW.year = 2016', insert: :comments_2016 }, { elsif: 'NEW.year = 2017', insert: :comments_2017 }, { else: "RAISE EXECEPTION 'comments_by_year recieived an unexpected value: %', NEW.year;" } ]
    1. systematize

      shuffling cards:

      is like how this combines/interleaves structure migrations and data migrations together

    2. If you want to organize said migrations in their purpose you'll probably have a folder for the struture ones and another for the data ones.
    3. Why does this even exist ? So you can seperate the data and structure migrations in different folders
    4. not as good/useful as some other gem options/approaches, such as the one that adds a data method per migration, or that lets you tag with :post_deploy, etc.