Hacker Newsnew | past | comments | ask | show | jobs | submit | ricg's commentslogin

How do you handle primary keys? Wouldn't auto-incrementing integers lead to duplicate keys since clients are not aware of each other?

For the To Do app example, let's say two clients start with an empty database and each creates a new todo:

Client A creates [id:1, todo:"Buy milk"]

Client B creates [id:1, todo:"Buy cheese"]


Hi ricg thanks for the great question! We have a docs page that speaks to this https://docs.powersync.com/usage/sync-rules/client-id:

"PowerSync does not perform any validation that IDs are unique. Duplicate IDs on a client could occur in any of these scenarios:

- A non-unique column is used for the ID.

- Multiple table partitions are used, with the same ID present in different partitions.

- Multiple data queries returning the same record. This is typically not an issue if the queries return the same values (same transformations used in each query)."


To expand on what prawnstar said - it's exactly because of this that we recommend using uuids as the primary key (uuid v4 specifically). While you can use integer ids, you need some workarounds such as pre-generating sets of unique ids per device.


About your MacBook fans squealing: I had the same problem with my 2012 MacBook Pro. It turned out that the grilles through which the fans blow out the hot air were completely clogged up with dust and the Macbook would overheat.

I cleaned both and now the fans rarely spin up to full speed, because the hot air can actually leave the case again.

See this guide (the guide does not show cleaning the grille, but that is the important part).

https://www.ifixit.com/Guide/How+to+clean+your+MacBooks+fan+...


A potential downside here could be running out of file descriptors if you use one database file per client. Linux has a limit of 1024 open files per process.

Did you ever run into this problem?


Did you ever run into the problem of the system running out of file descriptors? If each client gets its own database file, each connection will require a file descriptor.

For example, Linux limits the number of file descriptors to 1024 per process to each process can open up to 1024 files at any point in time.

I ran into this problem in the past in another project (the system ran out of file descriptors for another reason).


Quite a few. Some I use regularly:

- Text snippet app to reply to support request emails. Use this to reply to about a dozen emails each day. I have over 300 snippets.

- App to got through a folder with my bank statement PDFs and produce a number of transaction and investment reports (calculates IRR and other metrics).

- An app to simulate all possible portfolio combinations for a given set of assets (this was before https://portfoliocharts.com)

- An egg timer that you can start before you set the time right after you put the eggs into the water. Those seconds are precious. Wrote this as a gift for somebody.

- App to generate monthly invoices for my app sales.

- A nice frontend to manipulate csv files.

While I was looking for an apartment, an app to look for new listings and notify me right away (often the nice apartments would already be gone by the time the daily email reached my inbox).

A workout timer. Simple app that tells me the time every 15 seconds. Throws in the occasional Tony Horton quote for motivation.

Oh, and a personal notes app, of course!


Which mail providers support this? I'd like to set up something like this. Thanks!


StartMail supports a form of this called as "aliases" with the StartMail domain.

https://www.startmail.com/

(Disclosure: I work at StartMail.)


I do this with ProtonMail. I have it set on a subdomain, though: my regular email is email@example.com, while my account email is hackernews@email.example.com. This avoids the spam sent to asdf@everydomain.


Fastmail, can't recall if assuming you want to achieve something like name+tag@domain it would be name@tag.domain or tag@name.domain (IIRC the latter)


You can do this with Fastmail by going to Settings => Domains => Edit => Routing.


Thanks a lot! I'll give it a try.


> NEED HIERARCHY? Use directories — also known as folders.

I really wish I could define a custom order for files in a directory. A folder hierarchy is almost an outline, but not quite.

Yes I could prefix with "01", "02", and sort alphabetically, but those are cumbersome workarounds and reordering is a pain.

Are there file systems that allow for a custom order of files/folders?


> Yes I could prefix with "01", "02", and sort alphabetically, but those are cumbersome workarounds and reordering is a pain.

BASIC line numbering:

  010_...

  020_...

  030_...


I was just thinking about this at the weekend. One approach is to use a tool that supports [[Wiki-style Linking]], and have a kind of index/table of contents/home page for your notes.


That's what I do today in my own app. I have a "table of contents" file in each folder. Ideally the file system would support that out of the box, but maybe a first step could be to standardize such a TOC file...?


I suppose the question is where you want the sorted version to appear. In the output of `ls`? You could write a wrapper to `ls`, maybe?


In the system's file explorer (Finder/Windows File Explorer).

This would give me a visual outline and the ability to open any file with its corresponding app.

Imagine writing a book and using folders as chapters. You could then write individual pages with different apps, say some plain text, some Word documents, a few spreadsheets, images, videos, etc.


Would it be better to have something like a plain text page to hold the outline, with links to individual files?


For those who scan and file digitally:

Are you worried about data security/malware at all? How do you protect your data?

Maybe I listened to too many Darknet Diaries episodes, but recently I've been thinking more about how to protect my personal digital documents. All it takes is one bad link or fishing email. Once a virus/trojan/ransomware is on the system, the attacker has a lot of leverage with everything scanned and neatly filed.

My idea is to use a separate laptop for archiving digital documents that is never connected to the Internet. Still a thought experiment at this point so I can't speak to the practicality (backups, etc.) of this yet.


> Are you worried about data security/malware at all?

Not really. I scan everything I get on paper, and put everything on Google Drive.

But it would be quite a lot of effort to dig through my hundreds (thousands?) of PDF documents that I have on that drive, and to find something that can actually be exploited and is worth more than what an attacker could get by just having access to my computer. An attacker can get my credit card numbers when I shop online, access to bank accounts when I am using online banking, get all my tax data when I file income taxes... I think that's far worse than anything that can be found on my Google Drive.

So I think having a separate laptop is overkill, unless you have something that's really more at risk than the data on the internet-connected computer.


> what an attacker could get by just having access to my computer

That's what I was referring to. Let's assume you store your scanned PDFs on your personal laptop and that gets compromised. Now the attacker has your medical history, tax and bank statements, contracts, ... your whole life to pick and choose the ransom amount.

I'm getting more and more to the conclusion that if you do not want something to be published on the Internet, do not put it on an Internet-connected device, smartphone or laptop -- or put the other way around: "expect anything that you keep on an Internet connected device (or cloud) to be potentially stolen from you". Too paranoid?


> Now the attacker has your medical history, tax and bank statements, contracts, ... your whole life to pick and choose the ransom amount.

But can't the attacker get most of that even without your PDFs? If the attacker can get access to my computer, the attacker can directly log into my bank account, access my insurance contracts... there is no need to access the PDFs, you can get most of the stuff directly by logging into the right site (or intercepting the session while I am logging in).


If an attacker has access to your computer, he should not be able to directly log into your bank account or insurance contracts. For me, both of those logins require the attacker having access to my 1Password account AND somehow have access to my phone (2fa). Please rethink your strategy if an attacker having access to your computer equals having access to your digital life.


If the attacker is on your computer, he can access your bank account while you are being logged in (and possibly after that, if he disabled the logoff). He just needs to copy your session cookies and use your computer as proxy to use your IP address. 2FA doesn't really help in that scenario.

2FA 'only' prevents attackers from breaking in without having access to your computer, and you being logged in. If an action needs to be confirmed using 2FA (like a transfer of money), it can prevent this as well.


Well, the alternative would be to either not scan the documents at all and keep them in the basement as hardcopies or to scan them and protect them somehow (for example by keeping them on a device that is not connected to the Internet).


VeraCrypt


One


I see. Do you know about how many page views you got? If I may ask. The interest seemed higher than one subscriber


1. Thank you :)

2. iOS with iCloud support is planned.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: