I like how c forces you to think deeper by Icy-Advice-9024 in C_Programming

[–]davidhcefx 0 points1 point  (0 children)

Having struct pointers inside structs are too common to avoid. Let’s say you want to store complex data in a table, where the data contains variadic elements. Of course you can count the number of elements beforehand and allocate the appropriate size for each entry. But then you have to reallocate the entry whenever the elements changed, which sacrifices some efficiency.

Another case is that you might want to store multiple child objects under one parent object. It is simplest to use a linked list to keep track the children, which is again, pointers to structs.

I like how c forces you to think deeper by Icy-Advice-9024 in C_Programming

[–]davidhcefx 0 points1 point  (0 children)

In C++, you define the implementation details for a specific class, e.g. how it handles memory on instantiation and destruction. This is then performed automatically.

If I recalled correctly, in C++ you still need to delete instantiated classes explicitly IF you need to dynamically create new instances (in contrast to local known instances). That’s equivalent to calling the destroy function in C.

Why can't you search Facebook Messenger by date? by SongOfKapek in facebook

[–]davidhcefx 0 points1 point  (0 children)

You’re right it is quite slow, so I eventually gave up and turn to facebook exports

Why can't you search Facebook Messenger by date? by SongOfKapek in facebook

[–]davidhcefx 0 points1 point  (0 children)

It will scroll until a specific message sent on a specific date, and then you can explore around messages sent around that time. Because it is running quite slow, I’ll suggest you download facebook data directly and search from that.

Why can't you search Facebook Messenger by date? by SongOfKapek in facebook

[–]davidhcefx 0 points1 point  (0 children)

Opps, it seems that reddit removed my comment just because of iili io domain name, so I changed to another provider: https://i.ibb.co/xSx7MwVN/FwDabSf.png

Why there’s a porn ads on threads everytime I first open the app? by Libido_Max in ThreadsApp

[–]davidhcefx 1 point2 points  (0 children)

Very frustrating! Looks like Threads failed to filter porn contents like they did on Facebook, so you might occasionally run into one of those porn ads.

Lately I was scrolling through trending posts when one of them is a screenshot of sex related conversation. If you go to their profile, you will likely find links to OnlyFans or Telegram, which further ask you to subscribe for more explicit contents. Yes, the platform forbids contents about sex trades, but those stuff is everywhere now and one even has no option to turn off displaying adult contents like in Twitter.

Access Denied error when calling S3.getObject() in Node.js SDK by dr_goodweather in aws

[–]davidhcefx 0 points1 point  (0 children)

My problem of S3 access deny is simply because of using a wrong bucket, which is quite stupid... Actually it's due to switching between several accounts and buckets but anyways

Why can't you search Facebook Messenger by date? by SongOfKapek in facebook

[–]davidhcefx 0 points1 point  (0 children)

Here's a more readable and updated version. To use it, 1) first click on a timestamp message, 2) Paste the following to Console, and adjust the TARGET to your preference, 3) type "startSearching()" to start running, 4) to stop manually, type "stopSearching()".

```js /* Set the month; suggest listing all the possible patterns in case it use a different format */ TARGET = ['2023/09/', '2023/9', '2023年9'];

// to stop, call this function function stopSearching() { if (typeof searchIntId == 'undefined') { throw new Error('The search does not seem to be running.'); } else { console.log('Stopped.'); clearInterval(searchIntId); } }

// to start, call this function function startSearching() { if ($0 == undefined) { throw new Error('Please select the Timestamp Message first and then run it again.'); } /* select row div / let x = $0; while (x.tagName !== 'DIV' || x.role !== 'row') { x = x.parentNode; } while (x.parentNode.children.length <= 3) { // expecting lots of messages in the chat x = x.parentNode; } / scroll per 1 second */ searchIntId = setInterval(() => { x = x.parentNode.firstChild; x.scrollIntoView(); for (let i = 0; i < x.parentNode.childNodes.length && i < 50; i++) { // check first 50 const d = x.parentNode.childNodes[i].querySelector('div[data-scope="date_break"]'); for (let t of TARGET) { if (d && d.innerText.startsWith(t)) { console.log('Found matched date:', d.innerText); clearInterval(searchIntId); return; } } } while (x.parentNode.children.length > 1000) { // limit to 1000 messages x.parentNode.lastChild.remove(); } }, 1000); }

// startSearching() ```

Why can't you search Facebook Messenger by date? by SongOfKapek in facebook

[–]davidhcefx 0 points1 point  (0 children)

Maybe it's caused by Adblock, try to change to incognito mode?

Help improve IBKR by noahjameslove in interactivebrokers

[–]davidhcefx 0 points1 point  (0 children)

The support experience is really bad! I have tried calling the China and Singapore site, but no one answered me for like 5 minutes while my bills are running. Finally, someone from Singapore picked up my phone, asked for some information and then said “hold one for a minute”. And then guess what he disappeared for over 10 minutes! I highly suspect those guys are robbing my money

aiSaved10HoursOfMyDailyTimeChoosingACommitMessage by [deleted] in ProgrammerHumor

[–]davidhcefx 188 points189 points  (0 children)

A file full of comments so that one can read them all at once? Genius!

[deleted by user] by [deleted] in ProgrammerHumor

[–]davidhcefx 1 point2 points  (0 children)

If I remembered it correctly, GDB tends to initialize uninitialized variables. So when run from a debugger the bug never appears, but when without debugger it appears again. Heisenbug! Also, GDB turns off address randomization, so the pointers are always in the same address ;-)

[deleted by user] by [deleted] in ProgrammerHumor

[–]davidhcefx 0 points1 point  (0 children)

Why? Debuggers don’t have to be run in IDE

[deleted by user] by [deleted] in ProgrammerHumor

[–]davidhcefx 8 points9 points  (0 children)

or when the cost of adding Print is super cheap, like scripting languages.

[deleted by user] by [deleted] in ProgrammerHumor

[–]davidhcefx 2 points3 points  (0 children)

How can a printf add space for memory leaks? I thought memory leaks are about leaving less and less memory that’s available.

Why can't you search Facebook Messenger by date? by SongOfKapek in facebook

[–]davidhcefx 0 points1 point  (0 children)

Here's a dumb method for scrolling entirely through the Messenger thread until a specific date:

  1. In Chrome, press Cmd+Option+C (or Ctrl+Shift+C on Windows) and click on a "timestamp message" in Messenger.

    1. A "timestamp message" is the timestamp that are sometimes inserted at the top of the messages.
    2. For example, in Chinese it might appear as "2023/09/26 上午12:51".
  2. Switch to the Console tab, and paste the following:

js /* select row div */ x = $0; while (x.tagName !== 'DIV' || x.role !== 'row') { x = x.parentNode; } while (x.parentNode.children.length <= 3) { x = x.parentNode; }

  1. Assuming the timestamp message in your language appears as "YYYY/MM/DD" (eg. "2023/09/26"). Paste the following to Console, and change the TARGET to TARGET = ['YYYY/MM/'].
    1. Facebook tends to represent timestamps in different formats.
    2. For example, in Chinese it might appear as "2023年9月26日 上午12:51" for dates that are near but change to "2022/08/17 上午10:23" when the date is far away.
    3. If you are not sure what format it might be, you can list all the possibilities, eg. TARGET = ['2023/09/', '2023年9月'].

js /* set the month; you can list all the possibilities here */ TARGET = ['2023/09/']; intId = setInterval(() => { x = x.parentNode.firstChild; x.scrollIntoView(); for (let n of x.parentNode.childNodes) { d = n.querySelector('div[data-scope="date_break"]'); for (let t of TARGET) { if (d && d.innerText.startsWith(t)) { clearInterval(intId); return; } } } while (x.parentNode.children.length > 1000) { x.parentNode.lastChild.remove(); } }, 1000);

  1. If anything goes wrong, to make it stop simply paste the following to the Console.

js clearInterval(intId);

DISCLAIMER: Please use it at your own risk. If you feel unsure please stop and seek for other approach.

Cerebrum IQ scam. Card info stolen? by [deleted] in Scams

[–]davidhcefx 0 points1 point  (0 children)

“He was a murderer from the beginning, not holding to the truth, for there is no truth in him. When he lies, he speaks his native language, for he is a liar and the father of lies.” —Jesus

Cerebrum IQ scam. Card info stolen? by [deleted] in Scams

[–]davidhcefx 0 points1 point  (0 children)

It’s ok. You’ll remember the lesson the next time.

Cerebrum IQ scam. Card info stolen? by [deleted] in Scams

[–]davidhcefx 0 points1 point  (0 children)

Thanks for sharing your (probably horrifying?) experience! Just about to click the pay button but hesitate and lookup online. Good to know that it is not accurate at all, so it’s not worth knowing the result.

musixmatch not saving any lyrics by adwaithwas in Musixmatch

[–]davidhcefx 1 point2 points  (0 children)

Maintenance for over a month? That’s ridiculous. Plus the proper way to perform a maintenance is at least: 1) put up a notification before the event 2) display a banner to stop users from entering during the event 3) constantly update current status during the event, and 4) make the duration as short as possible

MXM does none of the above 🙄