Learn Next.js - with locally running database

The Learn Next.js tutorial is quite instructive and fun to follow. I just did not want to use a remote database so I tried to use a local one. That’s not as easy as you may think.. That Github issue helped me getting it running locally while still using the @vercel/postgres Node module: vercel/storage#123. To summarize: Follow steps 1 to 4 in https://vercel.com/docs/storage/vercel-postgres/local-development. Save the db.ts (step 3) in app/lib/db.ts The sql function from @vercel/postgres doesn’t pick up the neonConfig. Add a sql implementation in db.ts based on db.connect() which uses the neonConfig: import { neonConfig, QueryResult, QueryResultRow, } from '@neondatabase/serverless'; import { db } from '@vercel/postgres'; neonConfig.wsProxy = (host) => `${host}:54330/v1`; neonConfig.useSecureWebSocket = false; neonConfig.pipelineTLS = false; neonConfig.pipelineConnect = false; type Primitive = string | number | boolean | undefined | null; const client = await db.connect(); export function sql<O extends QueryResultRow>( strings: TemplateStringsArray, ...values: Primitive[] ): Promise<QueryResult<O>> { return client.sql(strings, ...values); } Make sure the same version of @neondatabase/serverless will be used across all packages. Add to package.json: "overrides": { "@neondatabase/serverless": "0.10.4" } Remove node_modules and pnpm-lock.json - and re-run pnpm install Replace imports from @vercel/postgres with @/app/lib/db in both route.ts. Load our sql implementation in app/lib/data.ts: // import { sql } from '@vercel/postgres'; import { sql } from '@/app/lib/db'; More notes ...

5. Januar 2025 · 2 Minuten · Bernhard Fürst

VSCode Helper at 100 percent CPU usage

Working on a big Angular/Typescript monorepo lately I got one VSCode Helper process constantly staying at 100% CPU usage. Watching the Process Explorer (Help > Open Process Explorer) identified it as a fileWatcher process. Excluding the node_modules directory from file watching by adding **/node_modules/** to the files.watcherExclude key in the VSCode Settings put it down to 0% most of the time. Reason for that is a bug in the @parcel/watcher module VSCode uses. See https://github.com/microsoft/vscode/issues/226050 for details. ...

29. Dezember 2024 · 1 Minute · Bernhard Fürst

Proxy IMAP/POP traffic and SMTP authentication

Motivation I’m currently moving virtual servers from an old Virtualmin hosting instance to a new one. Because I do not have time for moving all virtual servers at once I need to make sure the commonly used server name for accessing IMAP, POP and SMTP will work for both - users already moved and users still using the old server. Since I did not find an easy to follow How-To for a scenario like this I just want to share here what worked for me. ...

30. Juli 2021 · 5 Minuten · Bernhard Fürst

Wireless printing with HP LaserJet 1020 and Apple Macintosh

I got an used HP LaserJet 1020 printer recently which prints mostly well when connected to a Macbook Pro. From time to time it is not printing instantly but switching it off an on resolves that usually. It also seems to need some minutes after page 1 or 2 to think about the job and to go on with following pages. Not good but enough for a small (mostly digital) home office. Tested it with OS X 10.7 (Lion) and 10.8 (Mountain Lion) using the HP printer driver for the LaserJet 1022. That’s because there is no OS X driver for the 1020. I used the HP variant, not the one provided by the Gutenberg suite. ...

7. März 2013 · 2 Minuten · Bernhard Fürst

Upgrade Crucial m4 SSD firmware on Mac without CD drive

Upgrading the Crucial m4 SSD firmware on the Mac without CD drive can be challenging. Easiest way I found is to use rEFIt Syslinux and an USB flash drive (USB stick). You also shouldn’t be fainthearted to fire some Terminal commands which easily can destroy your data when used wrong. Here is a list of what to do: Download the Manual Boot File for Windows and Mac® m4 firmware ISO file, unzip and mount it. For the 040H firmware the mounted disk name is CDROM. Copy the file BOOT/ISOLINUX/BOOT2880.IMG from the mounted ISO image somewhere to your hard disk. Eject the ISO image Download rEFIt-Syslinux, unzip and mount the DMG file. You get 2 disk devices: SYSLINUX and rEFIt Start Terminal.app on your Mac Unmount (not eject) the 2 disks: diskutil unmount /Volumes/SYSLINUX diskutil unmount /Volumes/rEFIt Insert the USB flash drive. Backup any data on the flash drive because you are going to overwrite it completely. Unmount the Flash drive either by using the Terminal as above if you know at which mount point it was mounted or by using the Disk Utility.app which allows you to identifiy and unmount it using the Mouse Identify the disk devices: diskutil list The rEFIt-Syslinux looks like this. At your machine it may be mounted using another disk device like disk3: /dev/disk2 #: TYPE NAME SIZE IDENTIFIER 0: FDisk_partition_scheme *32.6 MB disk2 1: DOS_FAT_32 SYSLINUX 8.2 MB disk2s1 2: Apple_HFS rEFIt 23.2 MB disk2s2 The flash drive is probably below it. Compare the disk size with the flash drive size to identify the right device. You now are going to copy the content from the rEFIt-Syslinux image to the USB flash drive. That’s the tricky part because you easily can destroy the wrong disk when entering wrong device paths. The device path is something like /dev/disk2. The following is an exampel, you need to enter the correct paths as identified by you: dd if=/dev/rdisk2 of=/dev/rdiskX bs=1m Source disk (or input): /dev/rdisk2 (rdisk is the raw variant of disk which is usually faster when using dd) Destination disk (or output): /dev/rdiskX. Make absolutely sure your Destination disk is the flash drive and not any other disk. The new partitions from the flash drive are mounted now. If not remove the USB flash drive and reinsert it. Copy the file BOOT2880.IMG you saved in step 2. above to SYSLINUX Open the file syslinux.cfg in a text editor and change the last line from append initrd=/AN-SD25.ima to append initrd=/BOOT2880.IMG. Save the file. Reboot your Mac and hold the alt key when it starts. Choose rEFit from the list of startup disks. In the rEFit menu choose Boot Legacy OS from SYSLINUX In the UNetbootin menu choose SeaFlash. You now boot into the firmware upgrade utility. Follow the firmware upgrade instructions/manual from now on. Note: The article Make a bootable USB flash drive/memory stick for Intel MacBook Pro at io101.org was very helpful in developing the procedure described above. ...

23. Februar 2013 · 3 Minuten · Bernhard Fürst

Disable spell checking on Mac OS X

It drove me nuts to disable the automatic spell checking on text input fields in Mac OS X again and again to make that red lines going away on technical terms or other stuff not known by the spell checker. Thankfully I found a post at http://dryfish.livejournal.com/8148.html which describes how to permanently disable automatic spell checking on Mac OS X. I was going one step further and disabled all languages by renaming the whole Resources directory: ...

17. März 2009 · 1 Minute · Bernhard Fürst

Lastschriften mit CiviCRM und Drupal

Update 2012-09-19: Wir entwickeln derzeit nicht für CiviCRM. Wenden Sie sich z.B. an den Verein Software für Engagierte bei Fragen zum Einsatz von CiviCRM im deutschsprachigen Raum. Im folgenden der ursprüngliche Text von civicrm.org zum Thema Lastschriften und CiviCRM: Die elektronische Lastschrift - kurz ELV - ist eine im deutschen Online-Markt beliebte und unkomplizierte Zahlvariante (eCommerce Leitfaden 2008, Uni Regensburg). Grund genug für uns, daß in diesen Belangen auf den angloamerikanischen Markt ausgerichtete CiviCRM um das Zahlverfahren ELV zu erweitern. CiviCRM hat damit für den Einsatz im deutschen Markt eine wichtige Hürde überwunden. ...

23. Februar 2009 · 3 Minuten · Bernhard Fürst

Partition Map wiederherstellen

Problem: Die (einzige) Partition einer externen Festplatte (HFS+) wurde nicht mehr erkannt. Mac OS X meldet in einer Dialogbox: “Laufwerk ist nicht formatiert.” Man hat anschließend 3 Möglichkeiten: das Laufwerk formatieren, ignorieren oder auswerfen. Lösung: testdisk ab Version 6.9 kann mit dem bei Intel Macs eingesetzten Partition Map Format umgehen. Im Testdisk Wiki wird im Detail beschrieben, wie die Partition Map wiederhergestellt werden kann. Ergänzung dazu: Für auf PowerPC-Macs formatierte Festplatten verwendet man den partition type [Mac], für auf Intel-Macs formatierte Festplatten ist es [EFI GPT]. ...

20. Dezember 2007 · 1 Minute · Bernhard Fürst

Drupal upgrade the easy way

2021-09-29: Updated patch files to Drupal 7.82 Please note: Email notification may be disabled in the future because I plan to replace this site by static pages. The standard procedure to upgrade Drupal to the latest release is to download it from drupal.org and follow the included UPGRADE.txt. For administrators using the UNIX shell it may be easier using the attached patch files below instead of downloading and installing the newest complete Drupal release. ...

7. Dezember 2007 · 7 Minuten · Bernhard Fürst

FTP/SSH Bundle for TextMate

Since you are reading this you probably know there is no build-in FTP/SSH support in TextMate. This bundle tries to work around this a little bit. Not satisfied by the perfomance of solutions like Macfusion or Expandrive I choosed to develop my own solution. Using the FTP/SSH bundle you may be able to download (reload) and upload files to a remote host using FTP or SSH. You always work on a local copy of the remote files. Remote files must be downloaded first by another method and manually added to your TextMate Project file. You may use the FTP/SSH bundle for TextMate Projects or just single files. ...

15. November 2007 · 4 Minuten · Bernhard Fürst