Skip to content

Instantly share code, notes, and snippets.

View conbrad's full-sized avatar
🤙

Conor Brady conbrad

🤙
View GitHub Profile
@conbrad
conbrad / chatgpt-nio-api.md
Last active February 21, 2023 18:30
ChatGPT doesn't know Java NIO API

You

write code in kotlin that adds objects to a mutable list

ChatGPT

Sure, here's an example code in Kotlin that creates a mutable list of objects and adds elements to it:

// Define a data class to represent the object
data class Person(val name: String, val age: Int)
struct cold_arc {
flow_t flow;
arc_p nextout;
arc_p nextin;
};
struct hot_arc {
cost_t cost;
node_p tail, head;
int ident;
In function 'int open(const char*, int, ...)',
inlined from 'static void AccessSender::initSocket()' at util/access-sender.cpp:30:63,
inlined from 'static void AccessSender::sendNonAccess(logentry*)' at util/access-sender.cpp:68:21:
/usr/include/x86_64-linux-gnu/bits/fcntl2.h:50:26: error: call to '__open_missing_mode' declared with attribute error: open with O_CREAT in second argument needs 3 arguments
__open_missing_mode ();
Start-Date: 2015-12-02 13:56:38
Commandline: aptdaemon role='role-commit-packages' sender=':1.62'
Upgrade: virtualbox-guest-dkms:amd64 (4.3.10-dfsg-1ubuntu5, 4.3.34-dfsg-1+deb8u1ubuntu1.14.04.1), openjdk-7-jdk:amd64 (7u85-2.6.1-5ubuntu0.14.04.1, 7u91-2.6.3-0ubuntu0.14.04.1), openjdk-7-jre-headless:amd64 (7u85-2.6.1-5ubuntu0.14.04.1, 7u91-2.6.3-0ubuntu0.14.04.1), openjdk-7-jre:amd64 (7u85-2.6.1-5ubuntu0.14.04.1, 7u91-2.6.3-0ubuntu0.14.04.1), virtualbox-guest-utils:amd64 (4.3.10-dfsg-1ubuntu5, 4.3.34-dfsg-1+deb8u1ubuntu1.14.04.1)
End-Date: 2015-12-02 14:06:12
Start-Date: 2015-12-21 13:46:25
Commandline: aptdaemon role='role-commit-packages' sender=':1.62'
Install: linux-headers-3.16.0-57:amd64 (3.16.0-57.77~14.04.1), linux-image-3.16.0-57-generic:amd64 (3.16.0-57.77~14.04.1), linux-headers-3.16.0-57-generic:amd64 (3.16.0-57.77~14.04.1), linux-image-extra-3.16.0-57-generic:amd64 (3.16.0-57.77~14.04.1)
Upgrade: bind9-host:amd64 (9.9.5.dfsg-3ubuntu0.5, 9.9.5.dfsg-3ubuntu0.6), oxideqt-codecs:amd64 (1.10.3-0ubu