aral, to SmallWeb
@aral@mastodon.ar.al avatar

:kitten: 🎉

Kitten now has a lovely new multi-page Settings screen and… drumroll… a new 🐢 interactive shell (REPL) for you to play with the running state of your Small Web site/app/place and debug your app, inspect/manipulate its database, etc.

I plan on recording demos of each of them tomorrow but you can play with them now.

And here’s a little tutorial to get you started with the shell:

https://codeberg.org/kitten/app#kitten-s-interactive-shell

💕

#Kitten #SmallWeb #SmallTech #NodeJS #REPL #JavaScript #HTML #CSS #web #dev

Screenshot of Kitten running in terminal: 🌍 Domain https://localhost 📂 Source /var/home/aral/Projects/kitten/app/examples/file-uploads 💾 Databases /var/home/aral/.local/share/small-tech.org/kitten/databases 🐢 To launch an interactive shell, press the [s] key. Server is running and listening for connections… s 🐢 Launching interactive shell ctrl-d to exit; .help for assistance A good place to start is to run the .ls command to see the keys of the global kitten object: » 💡.ls is an alias for Object.keys(kitten) [ 'version', 'domain', 'port', 'app', 'databaseDirectory', 'projectIdentifier', 'deploy', 'WebSocket', 'html', 'libraries', 'page', 'events', 'css', 'js', 'markdown', 'md', 'safelyAddHtml', 'sanitise', 'uploadsDirectory', '_db', 'uploads', 'package', 'db' ] 🐱 💬 kitten.db.images[0] Proxy [ { path: '/uploads/1a6c2612-057d-435b-83c7-7157b4add982/', altText: 'Screenshot of Draw Together sketch that reads Free Gaza!' }, { get: [Function: bound getHandler], set: [Function: bound setHandler], defineProperty: [Function: bound definePropertyHandler], deleteProperty: [Function: bound deletePropertyHandler] } ] 🐱 💬

joe, to ai

LLaVA (Large Language-and-Vision Assistant) was updated to version 1.6 in February. I figured it was time to look at how to use it to describe an image in Node.js. LLaVA 1.6 is an advanced vision-language model created for multi-modal tasks, seamlessly integrating visual and textual data. Last month, we looked at how to use the official Ollama JavaScript Library. We are going to use the same library, today.

Basic CLI Example

Let’s start with a CLI app. For this example, I am using my remote Ollama server but if you don’t have one of those, you will want to install Ollama locally and replace const ollama = new Ollama({ host: 'http://100.74.30.25:11434' }); with const ollama = new Ollama({ host: 'http://localhost:11434' });.

To run it, first run npm i ollama and make sure that you have "type": "module" in your package.json. You can run it from the terminal by running node app.js <image filename>. Let’s take a look at the result.

Its ability to describe an image is pretty awesome.

Basic Web Service

So, what if we wanted to run it as a web service? Running Ollama locally is cool and all but it’s cooler if we can integrate it into an app. If you npm install express to install Express, you can run this as a web service.

The web service takes posts to http://localhost:4040/describe-image with a binary body that contains the image that you are trying to get a description of. It then returns a JSON object containing the description.

https://i0.wp.com/jws.news/wp-content/uploads/2024/05/Screenshot-2024-05-18-at-1.41.20%E2%80%AFPM.png?resize=1024%2C729&ssl=1

Have any questions, comments, etc? Feel free to drop a comment, below.

https://jws.news/2024/how-can-you-use-llava-and-node-js-to-describe-an-image/

ecmascript_news, to javascript
@ecmascript_news@mastodon.online avatar
thisismissem, to programming
@thisismissem@hachyderm.io avatar

Wrote my first programming related blog post in a little while: How to redirect the user back to the previously requested URL after login with Adonis.js:

https://medium.com/@thisismissem/adonis-js-returning-the-user-to-the-previously-requested-url-after-authentication-2b5199a19839

SocketSecurity, to programming
@SocketSecurity@fosstodon.org avatar

LDAPjs, an LDAP client and server API for Node.js, was decommissioned after its maintainer received an abusive email from a user, raising concerns about this form of abuse as a potential attack vector. https://socket.dev/blog/ldapjs-open-source-project-decommissioned-after-maintainer-receives-abusive-email

joelanman, to programming
@joelanman@hachyderm.io avatar

missing from native Node - write a file and create any necessary folders in the path

fs.writeFileSync('a/b/c.txt','hello', {recursive:true})  

#nodeJS

nurkiewicz, to AWS
@nurkiewicz@fosstodon.org avatar
thisismissem, to programming
@thisismissem@hachyderm.io avatar

It's fascinating how much things have changed in the node.js ecosystem over the years: How to set up a Node server with TypeScript in 2024

https://www.learnwithjason.dev/blog/modern-node-server-typescript-2024/

ecmascript_news, to javascript
@ecmascript_news@mastodon.online avatar

Node.js and its many, many new features with Matteo Collina [89-min. video]
@mcollina @jlengstorf
https://www.youtube.com/watch?v=evCnOaVaOTo

#ECMAScript #JavaScript #NodeJS

ecmascript_news, to javascript
@ecmascript_news@mastodon.online avatar
aral, to SmallWeb
@aral@mastodon.ar.al avatar

The Evergreen Web section in Kitten’s¹ settings now has its own page too (and uses Kitten’s new Streaming HTML² workflow).

If you have the previous version of your site up somewhere, you can use the 404-to-307 technique³ to forward missing pages to your old site so as not to break the Web.

I’ll add local static archive support later.

¹ https://codeberg.org/kitten/app
² https://ar.al/2024/03/08/streaming-html/
³ https://4042307.org

leanpub, to devops
@leanpub@mastodon.social avatar

Learn Kubernetes & Docker - .NET Core, Java, Node.JS, PHP or Python by Arnaud Weil is free with a Leanpub Reader membership! Or you can buy it for $11.99! http://leanpub.com/k8s

cuchaz, to random
@cuchaz@gladtech.social avatar

Once again I get foiled by switching languages. :blobcatfacepalm2:

In Javascript, you have to compare strings with ===, not ==, or else you'll run into type coercion problems, because Javascript thinks 1 == "1" is a totally fine thing to be true. (it's not)

But in Kotlin, === compares identity not equality for strings. But in the JVM, string values are aggressively cached, so === actually does what you want most of the time. Unless your strings come from weird places, like JNI code. Then you get awful non-deterministic behavior that's incredibly hard to debug, but it totally goes away when you use the correct comparison operator == for strings.

sigh I'm not really as good at this whole programming thing as I should be by now.

happyborg,
@happyborg@fosstodon.org avatar

@cuchaz
Programming is hard.

A skill is choosing systems and tools that make it easier and making meta choices to enable you to maximise your agency in those choices.

I remember the pain I endured learning a decade ago, then looking at [shudder] and hmm.

Then the pleasure that followed learning to use and . You'd have a hard time getting me to use anything else now. Not happening.

My debut Rust project is now part of debian / Ubuntu.

"===" 🤣

khalidabuhakmeh, to dotnet
@khalidabuhakmeh@mastodon.social avatar

Only a few years ago, there was a considerable effort in #dotnet to make interoperability with #nodejs a thing... now it seems like all those projects are gone or woefully behind. Bummer :(

ehmicky, to programming
@ehmicky@fosstodon.org avatar

We just released Execa 9, which is our biggest release so far.

If you're currently using Execa, you should check out the new features! Also, if you're currently using zx or Bun shell, you might be interesting in this alternative.

https://medium.com/@ehmicky/execa-9-release-d0d5daaa097f

#nodejs #node #javascript #js #cli #terminal #console #bash #shell

pawelgrzybek, to programming
@pawelgrzybek@mastodon.social avatar

Node.js 20.13 brought great improvements. My highlights:

► Watch mode is considered stable now
► The util.styleText now accepts an array of modifiers

Of course, I have articles about both of those features! I just updated both of them to reflect new announcements.

“TIL — Node v18.11.0 comes with a watch mode, so you might not need nodemon”
https://pawelgrzybek.com/til-node-v18-11-0-comes-with-a-watch-mode-so-you-might-not-need-nodemon/

“Node.js added utility for text formatting — you may not need chalk anymore”
https://pawelgrzybek.com/node-js-added-utility-for-text-formatting-you-may-not-need-chalk-anymore/

aral, (edited ) to programming
@aral@mastodon.ar.al avatar

This is a niche one but it might help someone in the future:

How to include multiple directories from different places in the file system hierarchy in an archive without including the whole directory structure for any of them.

https://codeberg.org/aral/gists/src/branch/main/how-to-include-multiple-directories-from-different-places-in-the-file-system-hierarchy-in-an-archive-without-including-the-whole-directory-structure-for-any-of-them.md

TL; DR: use symlinks.

#NodeTar #NodeJS #tar #prefixes #directory #hierarchy #flat #archive

aral, to javascript
@aral@mastodon.ar.al avatar

Just published a minor update (version 5.1.1) to JavaScript Database (JSDB) that optimises the custom data type¹ serialisation code by removing a redundant return statement:

https://www.npmjs.com/package/@small-tech/jsdb

This change is backwards compatible and shouldn’t require and updates to your projects, including the ones you have in Kitten (which uses JSDB internally).

¹ https://codeberg.org/small-tech/jsdb#custom-data-types
² https://codeberg.org/kitten/app

#JavaScriptDatabase #JavaScript #database #JSDB #Kitten #SmallWeb #NodeJS #web #dev

tanepiper, to programming
@tanepiper@tane.codes avatar

Anyone else seeing more segfaults with 22 and

Going to have to go back to LTS as pipeline keep failing now when installing dependencies when using caching.

ecmascript_news, to javascript
@ecmascript_news@mastodon.online avatar
joelanman, to programming
@joelanman@hachyderm.io avatar

any opinions on Node.js logging libraries like Winston or Pino? Or do you just write your own logging functions?

aral, to javascript
@aral@mastodon.ar.al avatar
stvfrnzl, to Astro
@stvfrnzl@mastodon.online avatar

Inspired by @matthiasott great newsletter: has anyone experience implementing #webmentions with @astro?

Here's his article: https://buttondown.email/ownyourweb/archive/issue-14/

And here's what I found but couldn't test yet: https://kld.dev/adding-webmentions/

#ssr #StaticSiteGenerator #astro #html #css #JavaScript #WebDev #Frontend #IndieWeb

stvfrnzl,
@stvfrnzl@mastodon.online avatar

Hey @marcuslindblom, do you have by any chance documented how to make #webmentions work with #astro?

I'm no #JavaScript and #NodeJS wizard so I'm currently stuck. Plenty of #11ty tutorials out there, but they're not helping me haha

andros, to emacs
@andros@hostux.social avatar

I publish a new article: «Creating desktop applications using the Emacs core»
https://programadorwebvalencia.com/creating-desktop-applications-using-the-emacs-core/

In summary, I can use Emacs to create GUIs with an Elisp backend.

mjgardner,
@mjgardner@social.sdf.org avatar

@andros @marcolas The point is your architecture is the same as #ElectronJs, replacing embedded #NodeJs and #Chromium running #JavaScript with embedded #Emacs running #Elisp.

So every app using it has all of #Electron’s disadvantages:
• lowest-common-denominator #GUI obviously foreign to the host OS
• non-portable shims to integrate with host OS features
• an individually bespoke runtime consuming storage, memory, and compute as if it were a separate virtual machine

mjgardner,
@mjgardner@social.sdf.org avatar

@boo_ @andros I didn’t foresee anyone turning Google’s #Chrome browser #JavaScript engine V8 (2008) into the server (#NodeJs, 2009) and desktop (#ElectronJs, 2013) runtimes that ate the world, but here we are.

And Electron was originally developed for #GitHub’s #Atom text editor (2008) before they were acquired by #Microsoft in 2018, subsequently discontinued in favor of #VSCode in 2022.

Don’t tell me what you can’t see happening if you don’t remember what already did

  • All
  • Subscribed
  • Moderated
  • Favorites
  • JUstTest
  • InstantRegret
  • rosin
  • modclub
  • Youngstown
  • khanakhh
  • Durango
  • slotface
  • mdbf
  • cubers
  • GTA5RPClips
  • kavyap
  • DreamBathrooms
  • ngwrru68w68
  • provamag3
  • magazineikmin
  • osvaldo12
  • tester
  • tacticalgear
  • ethstaker
  • Leos
  • thenastyranch
  • everett
  • normalnudes
  • anitta
  • megavids
  • cisconetworking
  • lostlight
  • All magazines