Off Topic Chit Chat - (Silliness factor 5)

looks like a dragon egg :sunglasses: its perfect for the newcomer edition :wink: dragon must grow up, its hatching right now

3 Likes

Try to think of something other than dragons all the time.

Hyperland's logo is a stylized water drop.
image

https://www.reddit.com/r/hyprland/comments/15msq4l/garuda_linux_login_wallpaper/

6 Likes

" is a stylized water drop."
Hmmm.
Onion. :+1: :stuck_out_tongue:

I beg to differ! :crazy_face: :dragon:

1 Like

Okay butā€¦

This is the craziest imagination :crazy_face: !!

1 Like

I think you use my "idea"
It is supposed to represent a drop, not an onion. :smiley:
from the reddit page.
:slight_smile:

1 Like

When I think of Hyperland in my mind I see a roadrunner logo.

rrrr

6 Likes

Rambling of a ~ 30 year old. Unrelated to previous conversations, mostly.

The more I develop myself, I realize that "ego" driven life is not a good way to go.

Its more about getting to a more blanced world view and inline with intuition rather than thought and thinking too much.

An interesting topic I touched on lately was the actual meaning of "presence" and being "here"

Since thought is often driven by ego or influenced by ego.. How do you know if most of your memories are even true? There's certain truth to them but are they even accurate? It's not like you can go back and check. The future? Highly unlikely that you are going predict future with accuracy and detail. So its all mind construct. Presence is all that is really. And I think for me, it's a reference to be more neutral, being aware and present.

I think it can be liberating to deteatch from ego and develop some form of higher you and awareness.

Now enter into good and bad which as well are relatively useless weights on what you like or do not like. Today rain is bad, but tomorrow is good? So is rain good or bad? Since it's too cold or too hot for you,, you can't enjoy the present. You are serving your ego which tells you stuff, everything mostly good or bad and sometimes even good is bad. What a shame, right?
It's cold outside.. Better not go outside.. Its warm outside.. too warm. What this implies that the person is totally shackled by the stories that the ego tells itself. Maybe there is something more to it than that.

This person is bad, because of A.. But then 10 days from now , in my heart of hearts I realise the same part thats inside me so I am bad too? What a conundrum. Now I must say a little white lie to say I dont have it to serve my shameless ego. Cause I must be better.

These are maybe simple and black and white examples but It starts from here.

So this is the start to the meaning behind "Free your mind" for me.

@aegir221 when I was a young man (not recently :wink:), we had a couple copies of this book that made the rounds in the dormitories and off-campus gathering spots:

It's been a long time since I had a copy, but I remember it being very meaningful and impactful when I read it. Your ramble above immediately reminded me of it. If you get a chance, check it out. You can probably find a copy at the library if you have one near you; it was a pretty famous book back in its day.

1 Like

I think eggo is great, perhaps youā€™re not doing it right.

ego

:crazy_face:

3 Likes

Its used differently in different "teachings" This is more of another guy explaining hes thought pattern.

People for example have "ego" death and yet still have zero awareness what happened. So my "right" way is that the "ego" is annoying chirper unless hes at the "stream" at the right place :smiley:

I am definitely interested in the topic, maybe I can pick up an audio book or something.

There's a good local teacher here too.

I find the usual lay down feel your body annyoing. It teaches me nothing but actually helping my intuition and thought process. Why not :smiley:

I don't think an audio book will do it justice. The brown pages in the middle are very artistically done--you kind of have to see it to get the full effect.

This website has a couple photos so you can see what I mean:

3 Likes

Wherever you're at, be there.
:slight_smile:

4 Likes

Militant cycling is a lot more fun in Utrecht than in Amsterdam.

1 Like

Sounds like I should try that some time.

1 Like

Yes, do that. But remember that you must always monitor the traffic, including that behind you, and estimate speeds and distances well. If a drunk German stands on the fietspad, he has to recon with a bump. But what do I tell to a Nederlandser... :grinning:

Don't mind me just here to rant...

Anyone here ever felt like code is hypnotizing? I had been watching linus torvalds tech talk video about good taste in programming for prolly 4th time and then the code to remove linked list entry showed up. I kept starting at it and still couldn't understand how the heck it worked. I tried googling and all I got was "the code" on a website with an explanation that didn't really register with me. So I did what any good programmer does, copied it and then set out to demistify it myself with the age old cout (or printf for the C folks) and when I finally understood it after 3 hours of staring at memory addresses I felt like my brain exploded at how incredibly simple the code was and how needlessly complex I was making it in my head. :exploding_head:.

And since then I have been revisiting the code every 5 minutes like it's a new toy in the house and I am child. I keep staring at it and keep falling in love with it's simplicity and keep adding more and more functions to it to make a complete code. Really love torvald's way of thinking. :smiling_face: I really hope I can reach even a fraction of his level someday.

The code for the curious
#include <iostream>
using namespace std;
struct node{
  int data;
  struct node* next;
};
struct head{
  struct node* head;
};
using node = struct node;
using head = struct head;
void traversal(head *h){
  node* i = h->head;
  while(i->next != NULL){
    cout << i->data << " -> ";
    i = i->next;
  }
  cout << i->data << endl;
  node* j = h->head;
  while(j->next != NULL){
    cout << j << " -> ";
    j = j->next;
  }
  cout << j << endl;
}
void garbage(head *h){
  while(h->head != NULL){
    node *tmp = h->head;
    h->head = tmp->next;
    delete tmp;
  }
}
void rm_lnk_list(node *entry, head *h){
  node** i = &h->head;
  //cout << h << " " << &h << " " << &h->head << endl;
  while((*i) != entry){ 
    //cout << (*i) << " " << i << endl;
    i = &(*i)->next;
  }
  *i = entry->next;
  delete entry;
  traversal(h);
}
void mk_lnk_list(head *h, int data){
  node *n = new node;
  n->data = data;
  n->next = NULL;
  node **i = &h->head;
  while(*i != NULL) i = &(*i)->next;
  *i = n;
}
void mk_lnk_list(head *h, int data, int pos){
  node *n = new node;
  n->data = data;
  n->next = NULL;
  node **i = &h->head;
  while(pos-- && *i != NULL) i = &(*i)->next;
  n->next = (*i)->next;
  (*i)->next = n;
}
node* ret_entry(head *h, int pos){
  node **i = &h->head;
  while(pos-- && *i != NULL) i = &(*i)->next;
  return (*i);
}

int main(){
  head h;
  h.head = NULL;
  for(int i=0; i<10; i++)
    mk_lnk_list(&h, i);
  traversal(&h); 
  mk_lnk_list(&h, 10, 3);
  traversal(&h);
  rm_lnk_list(ret_entry(&h,7), &h);
  garbage(&h);
  return 0;
}
5 Likes

Just another rantā€¦

The reason I fell in love with programming was the ability to converse with computers. It is so fun, fascinating and mystical when you type stuff on your system and actually replies to you. It might not always be a positive response, computers can be moody too after all and give cold responses like address boundary error and core dump our conversation. :sweat: But hey, they atleast give us hints to fix itā€¦ :eyes:.

I started my journey with C and during my school years I was taught many languages like qbasic, visual basic, java and more but my romance has always been with C. I have always been drawn to it. I never understood why people criticized it and one of the most common problems they pointed out with the language apart from garbage collection was it ability to handle strings. I never understood their view points, in fact I preferred to use C when handling strings over other languages but little did I know C still hadnā€™t fully bared itā€™s fangs to me yet. :skull:

Then came the fateful day where I actually faced the issue with strings the community was talking about. Document querying from user input stringā€¦ I still remember this hacker rank question, I naively thought this was marked wrong how could just querying document be ā€œhardā€. I went ahead with full gusto thinking I will be done in a jiffy, only to spend an entire day writing the code that didnā€™t even compileā€¦ :skull: But I didnā€™t give up how can I give up on the love my life like this so I copied what ever I had wrote along with all the test cases to be pass and decided to work with it on my local machine and like this spent 3 entire days just debugging the code after thisā€¦ At the end of this arduous journey I had reached the code that actually worked and passed all test cases. I was so happy I immediately thanked the C gods and felt the world was more colorful than ever for I had managed to save my romance. I felt proud, I kept revisiting my code and kept playing with it until I found a new bug with itā€¦ :skull:. At that point I decided to postpone it since today was a day of celebration this bug is for future me and as anyone can guess itā€™s been 6 months since I wrote that program and I havenā€™t fixed the said bug or more precisely I even forgot what that bug was in the first placeā€¦ :sweat_smile: But hey the good news is if you canā€™t see it, it doesnā€™t exist rightā€¦ :face_with_peeking_eye: rightā€¦? Yeah the bug solved itself, after all nothing can stand in the way of true love. :laughing:

Code for the curious
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#define MAX_CHARACTERS 1005
#define MAX_PARAGRAPHS 5

struct word {
    char* data;
};

struct sentence {
    struct word* data;
    int word_count;//denotes number of words in a sentence
};

struct paragraph {
    struct sentence* data  ;
    int sentence_count;//denotes number of sentences in a paragraph
};

struct document {
    struct paragraph* data;
    int paragraph_count;//denotes number of paragraphs in a document
};

/*-------------------------------------------------------------------
 * Update the Error has been resolved. 
 * It was as we suspected plus a bunch more.
 * ------------------------------------------------------------------
 *
 * Error is in the get_* functions we defined.
 * possibly in the start stop variables, look into it.
 *
 * ------------------------------------------------------------------
 * 			Expected Output:
 * ------------------------------------------------------------------
 *
 * 	Learning pointers is more fun.It is good to have pointers.
	Learning C is fun
   	Learning

 * ------------------------------------------------------------------
 * 		      Sample input with error:
 * ------------------------------------------------------------------
 *
 * 	2
	Learning C is fun.
	Learning pointers is more fun.It is good to have pointers.

	get_document: 2

	get_paragraph: 1

	get_sentence: 3

	get_word count: 9 | Learning

	get_word count: 2 | C

	get_word count: 3 | is
	3
	1 2

	Sentence count: 0

	2 1 1

	Word count: 3
	Learning  C  is
	3 1 1 1
	Learning
 * ------------------------------------------------------------------
 */

struct word get_word(char *text, int start, int stop){
    struct word w;
    int count = stop-start+1;

    // printf("\nget_word count: %d start: %d stop: %d |", count, start, stop);

    w.data=(char*)malloc((count+1)*sizeof(char));
    int j=0;
    for(int i=start; i<=stop; i++) w.data[j++] = text[i];
    w.data[j] = '\0';
    
    // printf(" %s\n", w.data);
    
    return w;
}
struct sentence get_sentence(char* text, int start, int stop){
    struct sentence sen;
    sen.word_count=1;
    
    for(int i=start; i<=stop; i++) if(text[i] == ' ') sen.word_count++;
    sen.data=(struct word*)malloc(sen.word_count*sizeof(struct word));
    
    // printf("\nget_sentence | wcount: %d start: %d stop: %d\n", sen.word_count, start, stop);
    
    int word_start=start, word_stop=start, j=0;
    for(int i=start; i<=stop; i++){
        word_stop=i-1;
        if(text[i] == ' '){
            sen.data[j++] = get_word(text, word_start, word_stop);
            word_start=i+1;
        }
    }
    sen.data[j] = get_word(text, word_start, word_stop+1);
    return sen;
}
struct paragraph get_paragraph(char* text, int start, int stop){
    struct paragraph para;
    para.sentence_count=0;
    
    for(int i=start; i<=stop; i++) if(text[i] == '.')para.sentence_count++;
    para.data=(struct sentence*)malloc(para.sentence_count*sizeof(struct sentence));
    
    // printf("\nget_paragraph | count: %d start:%d stop:%d\n", para.sentence_count, start, stop);
    
    int para_stop=start, para_start=start, j=0;
    for(int i=start; i<=stop; i++){
        if(text[i] == '.'){
            para_stop=i-1;
            para.data[j++] = get_sentence(text, para_start, para_stop);
            para_start = i+1;
        }
    }
    return para;    
}
struct document get_document(char* text) {
    struct document doc;
    doc.paragraph_count=1;
    
    for(int i=0; i<strlen(text); i++) if(text[i] == '\n') doc.paragraph_count++;
    doc.data = (struct paragraph*)malloc(doc.paragraph_count*sizeof(struct paragraph));
    
    // printf("\nget_document: %d\n", doc.paragraph_count);
    
    int start = 0, stop = 0, j=0;
    for(int i=0; i<strlen(text); i++){
        stop=i-1;
        if(text[i]=='\n'){            
            doc.data[j++] = get_paragraph(text, start, stop);
            start=i+1;
        }
    }
    doc.data[j] = get_paragraph(text, start, stop+1);
    return doc;

}
struct word kth_word_in_mth_sentence_of_nth_paragraph(struct document Doc, int k, int m, int n) {
    struct word w;
    struct paragraph p = Doc.data[n-1];
    struct sentence s = p.data[m-1];
    w = s.data[k-1];
    return w;
}

struct sentence kth_sentence_in_mth_paragraph(struct document Doc, int k, int m) {
       struct sentence s;
       struct paragraph p = Doc.data[m-1];
       s = p.data[k-1];
       s.word_count= p.data[k-1].word_count;
       
       return s;
}

struct paragraph kth_paragraph(struct document Doc, int k) {
    struct paragraph p;
    p = Doc.data[k-1];
    p.sentence_count = Doc.data[k-1].sentence_count;
    
    return p;
}





void print_word(struct word w) {
    printf("%s", w.data);
}

void print_sentence(struct sentence sen) {
	
	// printf("\nWord count: %d\n", sen.word_count);

    for(int i = 0; i < sen.word_count; i++) {
        print_word(sen.data[i]);
        if (i != sen.word_count - 1) {
            printf(" ");
        }
    }
}

void print_paragraph(struct paragraph para) {
	
	// printf("\nSentence count: %d\n", para.sentence_count);
	
    for(int i = 0; i < para.sentence_count; i++){
        print_sentence(para.data[i]);
        printf(".");
    }
}

void print_document(struct document doc) {
	
	// printf("\nParagraph count: %d\n", doc.paragraph_count);

    for(int i = 0; i < doc.paragraph_count; i++) {
        print_paragraph(doc.data[i]);
        if (i != doc.paragraph_count - 1)
            printf("\n");
    }
}

char* get_input_text() {	
    int paragraph_count;
    scanf("%d", &paragraph_count);

    char p[MAX_PARAGRAPHS][MAX_CHARACTERS], doc[MAX_CHARACTERS];
    memset(doc, 0, sizeof(doc));
    getchar();
    for (int i = 0; i < paragraph_count; i++) {
        scanf("%[^\n]%*c", p[i]);
        strcat(doc, p[i]);
        if (i != paragraph_count - 1)
            strcat(doc, "\n");
    }

    char* returnDoc = (char*)malloc((strlen (doc)+1) * (sizeof(char)));
    strcpy(returnDoc, doc);
    return returnDoc;
}

int main() 
{
    char* text = get_input_text();
    struct document Doc = get_document(text);

    int q;
    scanf("%d", &q);

    while (q--) {
        int type;
        scanf("%d", &type);

        if (type == 3){
            int k, m, n;
            scanf("%d %d %d", &k, &m, &n);
            struct word w = kth_word_in_mth_sentence_of_nth_paragraph(Doc, k, m, n);
            print_word(w);
        }

        else if (type == 2) {
            int k, m;
            scanf("%d %d", &k, &m);
            struct sentence sen= kth_sentence_in_mth_paragraph(Doc, k, m);
            print_sentence(sen);
        }

        else{
            int k;
            scanf("%d", &k);
            struct paragraph para = kth_paragraph(Doc, k);
            print_paragraph(para);
        }
        printf("\n");
    }     
}

PS: even if you manage to find what the bug was, please donā€™t report itā€¦ :stuck_out_tongue_winking_eye:, seriously it would haunt me until I fix it.

4 Likes

Be careful, this path leads to madness!!!

:crazy_face:

Good to see youā€™re having fun though.

:+1:

2 Likes