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

So! Many! Kittens!

(Going to record a demo of the new interactive shell – REPL to some – and multi-page Settings this afternoon, just planning it out now.)

Oh and is that me creating and calling web routes interactively in the REPL on a live server? Why yes, yes it is.

:kitten:💕

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

:kitten: Kitten’s interactive shell (REPL) now saves session history scoped to your app so it will still be there when you next serve the same app.

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

I think I’m done with the REPL feature now.

Going to take a little break, step away from the computer, and make a plan for the next week of work on Kitten and Domain¹.

¹ https://codeberg.org/domain/app

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

Small update on Kitten’s new interactive shell (REPL). You can now access Kitten’s router via:

kitten.app.router

Also updated the section in the tutorial to fix typos in some of the code examples and use the new router key path:

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

:kitten:💕

virtulis, to programming
@virtulis@loud.computer avatar

Funsies: node-gyp is broken on latest kernel.

Likely some other libuv stuff as well. In case you're experiencing more weirdness than usual, consider a downgrade :blobcatthumbsup:​

https://github.com/nodejs/node/issues/53051

andrewfeeney,
@andrewfeeney@phpc.social avatar

@virtulis I’ve never really understood what node-gyp actually is or why I need to care about it, just that it occasionally pops up in build error messages and when I see it I get irrationally angry.

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

💕

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] } ] 🐱 💬

aral,
@aral@mastodon.ar.al avatar

PS. Since it’s not a common thing in ‘Big Web’ development, note that the Settings app is part of Kitten’s own internal web app that is available to all Small Web apps created using Kitten. So all those Small Web apps will be able to take advantage of data portability with backup/restore, Domain integration for managing your hosting account with your domain host, evergreen web, public-key encryption for e2ee peer-to-peer web apps (Small Web), etc.

It’s all slowly coming together :)

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})  

joelanman,
@joelanman@hachyderm.io avatar

@jscholes ah you're right! I was sure it threw an error but recursive: true doesnt, thanks!

joelanman,
@joelanman@hachyderm.io avatar

you can do this, thanks @jscholes

const filepath = 'a/b'  
fs.mkdirSync(filepath, { recursive: true })  
fs.writeFileSync(filepath + '/c.txt', 'hello')  
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_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

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