Computer Engineer from Brazil
1902 stories
·
42 followers

Photo

1 Share








Read the whole story
gabrielgeraldo
15 days ago
reply
São Paulo
Share this story
Delete

Photo

1 Share






Read the whole story
gabrielgeraldo
34 days ago
reply
São Paulo
Share this story
Delete

NO COMMENTS

1 Share

Não falo nada, desses caras da Ilha de Man.

Read the whole story
gabrielgeraldo
44 days ago
reply
São Paulo
Share this story
Delete

mercurial changegroup application

2 Shares

Mercurial (sometimes called “hg”, the name of its command-line tool, named after the elemental symbol for mercury) is a distributed version-control system.

When applying a “change group” (a group of changes applied as a unit, e.g. in a single hg push), Mercurial tracks the heads before and after the changeset. Previously, it stored the “oldheads” list of pre-changeset heads as a Python list, and computed the newly-created heads post-changeset with:

newheads = [h for h in repo.heads() if h not in oldheads]

Since h not in oldheads is O(n) on a list, a large repository would incur an O(N²) cost with respect to the number of heads in the repository.

What’s perhaps remarkable about this change is the size of the fix, which I think is the smallest diff in Accidentally Quadratic’s history: Wrapping a simple set(…) around the instantiation of the list.

In my judgment this fix is notable for a few reasons:

  • It’s a testament to Python’s expressiveness and consistency of APIs, that swapping out a set for a list can very often be a 5-character change.
  • It’s a vote in favor of all languages having a readily-available set type in their standard libraries along side lists and mapping types, so that fixes of this type are easy, and also hopefully less-often necessary in the first place.
  • My first point notwithstanding, it’s an argument against having a polymorphic in or contains method that silently degrades to O(n) behavior on lists or similar containers. Wherever practical, asymptotics should be clear from the call site!
Read the whole story
vitormazzi
48 days ago
reply
Brasil
gabrielgeraldo
57 days ago
reply
São Paulo
Share this story
Delete

Client: Are you the one who manages the online store?Me: Yes, that’s me.Client: Well, you’re going...

1 Share

Client: Are you the one who manages the online store?

Me: Yes, that’s me.

Client: Well, you’re going to have to fix the website. I’m trying to order some metallic varnish but every time I click the ‘Buy’ button I get an annoying pop-up and it won’t let me place the product in my basket.

Me: What does the pop-up say?

Client: It says ‘Product out of stock’.

Me: Yes, this product IS indeed out of stock, that’s why you can’t order it.

Client: Well then get rid of the pop-up so that I can order it.

Me: We can’t get rid of it, because we don’t have that product in the store.

Client: Ugh, fine, I’ll place my order for the other items, but send me the metallic varnish, too. 

Me: … 

The conversation went on for about 20 minutes after that.

Read the whole story
gabrielgeraldo
63 days ago
reply
São Paulo
Share this story
Delete

I’ll be clear up front: this is NOT a client, but I think you’ll relate. Mom: My friend was...

1 Share

I’ll be clear up front: this is NOT a client, but I think you’ll relate.

Mom: My friend was wondering if you’d make a website for her daughter’s girlfriend’s fundraising campaign for free as a favor. Also, she says they need graphics and a really eye-grabbing layout. And advertising. She said I should tell you that “they need all your tricks to get the word out.”

Me: Mom, no. Besides, I don’t do web design. I’m a System Administrator.

My mom relayed this message back. This was the response:

Mom’s friend: Oh, that’s okay! She still knows more about computers than we do. Tell her we need it by next week, and any time is fine for her to come over and take photos.

I feel like I should mention both the friend’s daughter and I are 46 years old.

Read the whole story
gabrielgeraldo
65 days ago
reply
São Paulo
Share this story
Delete
Next Page of Stories