C Admitting my AI usage

And here's another little tip, if you want to learn programming. Try to work with other people, especially people who are better at it than you; show them your working, and never be afraid to make mistakes or ask questions. No matter how many decades you do this job, you are going to make mistakes, trust me, so you may as well get used to it. :-) There are no mistakes, just learning opportunities (as long as you make the effort to actually learn from them, that is; you have to do your homework). You will find that by showing your work to other people, they will enjoy mercilessly pointing out where you screwed up, just as you will do for them, and you will all have fun finding each others mistakes and arriving at a good solution. In a group of people working together like that, "the whole is more than the sum of the parts" applies; the 'group mind' achieves more than a single mind working alone, and it adds a lot of fun and enjoyment to the job. Having a sense of humour helps, too. 😁
 
I refuse to code with AI.

I do use it as a search engine mostly for firearm reloading specs and pressures.

It really is quite useful for this.
Why, tho?
It is like refusing to use excavator.
Sure, you don't use it to zip up your fly (analogy to letting some AI in your private or production systems) but it can move huge amounts of dirt for you at the very least.

On the other hand, trusting it with gun powder volumes?
382-46950035.jpg
 
And here's another little tip, if you want to learn programming. Try to work with other people, show them your working, and never be afraid to make mistakes or ask questions. No matter how many decades you do this job, you are going to make mistakes, trust me, so you may as well get used to it. There are no mistakes, just learning opportunities (as long as you make the effort to actually learn from them, that is!). You will find that by showing your work to other people, they will enjoy mercilessly pointing out where you screwed up, as you will do to them, and you will all have fun finding each others mistakes and arriving at a good solution. In a group of people working together like that, "the whole is more than the sum of the parts" applies; the 'group mind' achieves more than a single mind working alone, and it adds a lot of fun and enjoyment to the job, Having a sense of humour helps too. 😁
Very true. Especially the No Fear [of looking stupid] outlook...important for eveything in life.

But my dude, Ai is precisely perfect for that. Always on call, infinite time and patience. Custom level of explanations. Taught on the best. And the worst, so be vigilant. But it goes for people too. Sometimes even the best teachers make mistakes confidently.
 
Well, I guess AI might make a good sparring partner, if it actually knows what it's talking about (it sounds like it screwed up in bgavin's assembler example). But you're not going to get the interpersonal interplay with a machine that you get with other humans, I think. You have to actually be able to relate to and perhaps (shockingly) even like and enjoy the company of the people you're working with (in some cases, anyway 😂 ). I've briefly mentioned this before elsewhere, but this is where the western indivdualistic, adversarial culture wins out, versus the eastern consensus culture. I think it's no accident that computer technlogy and software all arose in the west, it's a product of western culture as much as anything. That doesn't mean the other guys can't learn to do what we do though.
 
Well, I guess AI might make a good sparring partner, if it actually knows what it's talking about (it sounds like it screwed up in your assembler example). But you're not going to get the interpersonal interplay with a machine that you get with other humans, I think. You have to actually be able to relate to and perhaps even like and enjoy the company of the guys you're working with (in some cases, anyway 😂 ), shocking, I know. I've briefly mentioned ths before elsewhere, but this is where the western indivdualistic, adversarial culture wins out, versus the eastern consensus culture. I think it's no accident that computer technlogy and software all arose in the west, it's a product of western culture as much as anything. That doesn't mean the other guys can't learn to do what we do though.
Agreed on all points.
The trouble is that is an ideal state of things. In the meantime, until you find job or club to revel in the company of like minded humans, Ai can at least simulate the teaching/reviewing part. Not perfect but it can do it 24/7.
Actually I worry, that thanks to that availability people will not develop patience and manners needed for human interactions. And you need them the most in the end - to survive this planet you need effective/harmonious hunting party.
Speaking of hunting. Interesting hypothesis why Europeans evolved to be be more 'individual honor' oriented as opposed to Eastern 'saving face' culture. Possibly due to Europeans being hunters/warriors more than being farmer communities.
 
Interesting. I've worked with both groups, westerners (obviously) and also people from Japan, China, India, and been amazed by how large the cultural differences can be. I don't know about the hunting versus farming hypothesis, if you look back in time, the archaeological record shows farming arose roughly around the same time in both the west and the east (around 7000 years ago), and asia had just as many hunter-gatherers in the pre-agriculture period as we did here, and they also had just as many warriors and wars (genghis khan!). One thing's for sure, the roots of the different cultures are very old, it goes back a long way.
 
Interesting. I've worked with both groups, westerners (obviously) and also people from Japan, China, India, and been amazed by how large the cultural differences can be. I don't know about the hunting versus farming hypothesis, if you look back in time, the archaeological record shows farming arose roughly around the same time in both the west and the east (around 7000 years ago), and asia had just as many hunter-gatherers in the pre-agriculture period as we did here, and they also had just as many warriors and wars (genghis khan!). One thing's for sure, the roots of the different cultures are very old, it goes back a long way.
[edit> not so] Quick points:
Farming in northern hemisphere was not as prevalent.
Phenotype specific traits were evolved over millennia most likely, not in a "few" years of known history.
Europe is special because it has many defend-able regions prohibiting centralization and huge empires promoting farming and conformity.
Mongols were hunters and pastoral. Exactly as early Europeans. So called Aryans domesticated horse among other animals (cows certainly given lactose tolerance genetic spread, wolves maybe), invented wheel and conquered most of the Northern hemisphere as far as Iran, certainly NW India and maybe even NW China (if China allows exploration of the most ancient pyramids there) and as South as today Palestine and maybe Egypt, given the red haired pharaohs (not speaking of Cleopatra - she was obviously of Macedonian origin; Tutanchamon genetic trace was mapped to Czech Republic of all places).

Mongols and Aryans had very important distinction compared to others. Warrior caste had the prim for longer. Not so with Sumerian priests, or Chinese bureaucrats or Levant merchants or Hindu cows.
Europeans had Aristocracy (derived from word Aryan). Emperors and kings were more dependent on elite warriors in Northern terrain than any other civilization.
And I would argue Warrior spirit necessitates, for survival through camarradarie, developing the sense of personal honor. Doing right in the eyes of gods (the best self) instead of doing right in the eyes of your fellow merchants, farmers or priests - saving face in front of the collective while still being in fact a cvnt.

One might argue, and I often do lol, that Protestant reformation was the result of this cultural preference setting for individual responsibility manifested in one on one relationship with the deity.
 
I asked claude with one or two lines to make a program with a specific functionality and got the below lines, I made only aesthetic changes.

You may ask claude or google what it does, how to compile it.

Claude took less that 30 seconds. How much time would you have taken for writing it, specially if you have first to learn / review the jim and sqlite3 API?


C:
#include <sqlite3ext.h>
SQLITE_EXTENSION_INIT1

#include <jim.h>

static void jim2sql_res(sqlite3_context *ctx) {
 Jim_Interp *interp = (Jim_Interp *)sqlite3_user_data(ctx);
 jim_wide iv; double dv;
 Jim_Obj *resObj = Jim_GetResult(interp);
 Jim_IncrRefCount(resObj);
 if (Jim_GetWide(interp, resObj, &iv) == JIM_OK)
  sqlite3_result_int64(ctx, iv);
 else if (Jim_GetDouble(interp, resObj, &dv) == JIM_OK)
  sqlite3_result_double(ctx, dv);
 else
  sqlite3_result_text(ctx, Jim_String(resObj), -1, SQLITE_TRANSIENT);
 Jim_DecrRefCount(interp, resObj);
}

static void exprFunc(sqlite3_context *ctx, int argc, sqlite3_value **argv) {
 Jim_Interp *interp = (Jim_Interp *)sqlite3_user_data(ctx);
 const char *ex = (const char *)sqlite3_value_text(argv[0]);
 Jim_Obj *exprObj;
 if (ex==NULL) {sqlite3_result_null(ctx); return; }
 exprObj = Jim_NewStringObj(interp, ex, -1);
 Jim_IncrRefCount(exprObj);
 if (Jim_EvalExpression(interp, exprObj) == JIM_OK) jim2sql_res(ctx);
  else sqlite3_result_error(ctx, Jim_String(Jim_GetResult(interp)), -1);
 Jim_DecrRefCount(interp, exprObj);
}

static void jimFunc(sqlite3_context *ctx, int argc, sqlite3_value **argv) {
 Jim_Interp *interp = (Jim_Interp *)sqlite3_user_data(ctx);
 const char *code = (const char *)sqlite3_value_text(argv[0]);
 if (code==NULL) { sqlite3_result_null(ctx); return; }
 if (Jim_Eval(interp, code) == JIM_OK) jim2sql_res(ctx);
  else sqlite3_result_error(ctx, Jim_String(Jim_GetResult(interp)), -1);
}

static void jimvFunc(sqlite3_context *ctx, int argc, sqlite3_value **argv) {
 Jim_Interp *interp = (Jim_Interp *)sqlite3_user_data(ctx);
 Jim_Obj **objv; int ix; const unsigned char *t;
 if (argc < 1) {sqlite3_result_null(ctx); return;}
 for (ix = 0; ix < argc; ix++)
  if (sqlite3_value_type(argv[ix]) == SQLITE_NULL) {
   sqlite3_result_null(ctx); return;}
 objv = (Jim_Obj **)Jim_Alloc(sizeof(Jim_Obj *) * argc);
 for (ix = 0; ix < argc; ix++) {
  t = sqlite3_value_text(argv[ix]);
  objv[ix] = Jim_NewStringObj(interp, (const char *)t, -1);
  Jim_IncrRefCount(objv[ix]);}
 if (Jim_EvalObjVector(interp, argc, objv)== JIM_OK) jim2sql_res(ctx);
  else sqlite3_result_error(ctx, Jim_String(Jim_GetResult(interp)), -1);
 while (ix--) Jim_DecrRefCount(interp, objv[ix]);
 Jim_Free(objv);
}

static void JimInterpDestroy(void *pApp) {
 Jim_FreeInterp((Jim_Interp *)pApp);
}

#ifdef _WIN32
__declspec(dllexport)
#endif
int sqlite3_extension_init(sqlite3 *db, char **pzErrMsg,
                             const sqlite3_api_routines *pApi) {
 Jim_Interp *interp;
 SQLITE_EXTENSION_INIT2(pApi)
 interp = Jim_CreateInterp();
 Jim_RegisterCoreCommands(interp);
 if (sqlite3_create_function_v2(db, "expr", 1, SQLITE_UTF8, interp, exprFunc,
  NULL, NULL, NULL) != SQLITE_OK) return SQLITE_ERROR;
 if (sqlite3_create_function_v2(db, "jim", 1, SQLITE_UTF8, interp, jimFunc,
  NULL, NULL, NULL) != SQLITE_OK) return SQLITE_ERROR;
 if (sqlite3_create_function_v2(db, "jimv", -1, SQLITE_UTF8, interp, jimvFunc,
  NULL, NULL, JimInterpDestroy) != SQLITE_OK) return SQLITE_ERROR;
 return SQLITE_OK;
}
 
[edit> not so] Quick points:
Farming in northern hemisphere was not as prevalent.
Phenotype specific traits were evolved over millennia most likely, not in a "few" years of known history.
Europe is special because it has many defend-able regions prohibiting centralization and huge empires promoting farming and conformity.
Mongols were hunters and pastoral. Exactly as early Europeans. So called Aryans domesticated horse among other animals (cows certainly given lactose tolerance genetic spread, wolves maybe), invented wheel and conquered most of the Northern hemisphere as far as Iran, certainly NW India and maybe even NW China (if China allows exploration of the most ancient pyramids there) and as South as today Palestine and maybe Egypt, given the red haired pharaohs (not speaking of Cleopatra - she was obviously of Macedonian origin; Tutanchamon genetic trace was mapped to Czech Republic of all places).

Mongols and Aryans had very important distinction compared to others. Warrior caste had the prim for longer. Not so with Sumerian priests, or Chinese bureaucrats or Levant merchants or Hindu cows.
Europeans had Aristocracy (derived from word Aryan). Emperors and kings were more dependent on elite warriors in Northern terrain than any other civilization.
And I would argue Warrior spirit necessitates, for survival through camarradarie, developing the sense of personal honor. Doing right in the eyes of gods (the best self) instead of doing right in the eyes of your fellow merchants, farmers or priests - saving face in front of the collective while still being in fact a cvnt.

One might argue, and I often do lol, that Protestant reformation was the result of this cultural preference setting for individual responsibility manifested in one on one relationship with the deity.
Some interesting points. :-)
 
Well, does it work? It looks like our job is dead then... don't go into computer programming, kids...
Yes, it works as expected. You can copy and paste it in claude / google, then ask:

what it does,
how to compile it,
how to use it with the sqlite3 command line, how to load it, how to use it,
ask for examples,
explain the program line for line,
etc.

In reality, it is a simple program, but to see it, you need to understand both APIs.
 
Sure, it's fairly simple, and doing sql ops in C is always pretty verbose. If you used a higher level language like Perl you could probably get it quite a lot shorter. Then again, I expect Claude can chuck out the Perl code to do the same thing in 30 seconds as well. Hard to see any human competing with that. The only catch is... how much do you have to pay Claude to do it, and how much power did it burn? If it's free, then just forget it for the humans, its game over, at least, for this type of code.

Now wait till the AI's start writing the next generation of AI's by themselves, without any human input or assistance. I wonder how close we are to that now. That's when it goes exponential.

Right, I'm off to sign up for the intergalactic Wrarth Warrior training course... perhaps that's a career with some job security. Constable Zrieg will put me right, I'm sure.
1790441449482.png
 
Sure, it's fairly simple, and doing sql ops in C is always pretty verbose. If you used a higher level language like Perl you could probably get it quite a lot shorter.
You did not understand / ask google or claude, what the program does.

It is not writing SQL in C, it is extending sqlite3's SQL with three new functions:
expr, jim, jimv.
 
Back
Top