Re: Absent's Code Thread / Tech Blog

In order to avoid the template issues we had, my professor fucking included .cpp files instead of putting everything in headers. Fuck. I had forgotten about that...

Make sure you do

delete array;

at the end of the heap destructor to delete the array itself.

The ArrayObject class should be easy, just store the KEYTYPE and VALTYPE. It will use a copy constructor to store the passed-in objects (if objects) into the ArrayObject class, because you're not using pointers and references to pass them in.

for writing if not empty, it'd be if (!isEmpty()) or if (isEmpty() == false), and you need braces.

Why is amount a const int in the heap class? And initialized? You could make it const int and initialize it with an initialization list.

For getting the maximum size, you'd just store the maxSize variable passed in on the constructor, on a private instance variable... the amount variable would make sense. like, putting : amount(maxSize) on the constructor. but rename amount to maxSize.

Last used seems like it'd also be a private instance variable.

lines 95 and 96 should be made into

if (heap[current]< heap[LargestChild])
    swap(current, largestChild);

ugh, this shit is so slow. I should get a new vps, but then it'd cost money :|

sloth wrote:

Comfy does not provide challenge, challenge provides success, success provides happiness. Our world is not comfy, although we tried to make it so. Slaves of our own inventions, yada, yada. Not only on a technological level, also on a social and political level. Nothing more but apes. Apes with psychosomatic disorders.

Re: Absent's Code Thread / Tech Blog

Like it deletes all the units in it, so delete array; removes the array? Mk.


Why is amount a const int in the heap class? And initialized? You could make it const int and initialize it with an initialization list.

Idk, in your outline program it had const int shit that isn't initaliazed. How would I initalize a list if I don't even know what's supposed to be in there? Like for portability I guess it should be some variable or something? I don't even know what values to be using in this piece of shit lol, I don't think it really matters tbh. Not even sure what the size should be. Wiu. Could cin it or something retarded, but it has to be dynamic. Like grow the array twice it's size if necessary. IIRC maybe I forget lol. FUck my memory.

Last used seems like it'd also be a private instance variable.

Like keep track of it as private variable in heap?


The ArrayObject class should be easy, just store the KEYTYPE and VALTYPE. It will use a copy constructor to store the passed-in objects (if objects) into the ArrayObject class, because you're not using pointers and references to pass them in.

The fuck is a copy constructor. Like make a constructor for ArrayObject that copies objects to... to what? I have an array of pointers, and I think objects get instantiated with insert, so I guess with the ArrayObject constructor I point the pointers to the instantiated objects? I'm confuz. And store KEYTYPE and VALTYPE within the class? Like,

 ArrayObject(KEYTYPE key; VALTYPE val;)
{
   key = 390u4; 
   val = ;aldskjf; 
}

Or some such shit?

Edit:


This is what I have atm, via pastebin because I don't think hastebin or other alts allow you to set a timelimit on it's expiration
pastebin.com/91ELL2Fm

Re: Absent's Code Thread / Tech Blog

Idk, in your outline program it had const int shit that isn't initaliazed. How would I initalize a list if I don't even know what's supposed to be in there? Like for portability I guess it should be some variable or something? I don't even know what values to be using in this piece of shit lol, I don't think it really matters tbh. Not even sure what the size should be. Wiu. Could cin it or something retarded, but it has to be dynamic. Like grow the array twice it's size if necessary. IIRC maybe I forget lol. FUck my memory

It was a fixed size given in the constructor, see how it takes maxSize? You set amount (should rename to maxSize) to the maximumSize passed on the constructor. const int can be initialized once in an initialization list for a constructor.

Like keep track of it as private variable in heap?

Yeah.

The fuck is a copy constructor. Like make a constructor for ArrayObject that copies objects to... to what? I have an array of pointers, and I think objects get instantiated with insert, so I guess with the ArrayObject constructor I point the pointers to the instantiated objects? I'm confuz. And store KEYTYPE and VALTYPE within the class? Like,

Nah, if you do this:

class ArrayObject {
    KEYTYPE myKey;
    VALTYPE myVal;
    
    ArrayObject(KEYTYPE Key, VALTYPE val)
    {
        myKey = Key;
        myVal = val;
    }
};

The = operator can be over... you know, fuck it. Forget that shit about the copy constructor. This should work. You don't have to write any copy constructor, that would be for the key and value types.

I don't know if you have to use double pointers. I don't think you do, but it'll work, so whatever. Thus the destructor and constructor look fine and done, except wtf is with the indentation lol

LastUsed() would just be return lastUsed; ?

Seems like getSize would be return current - 1 and getMaximumSize would be return maxSize.

sloth wrote:

Comfy does not provide challenge, challenge provides success, success provides happiness. Our world is not comfy, although we tried to make it so. Slaves of our own inventions, yada, yada. Not only on a technological level, also on a social and political level. Nothing more but apes. Apes with psychosomatic disorders.

Re: Absent's Code Thread / Tech Blog

w0w, thanks. I have most of it done, I think. It's still throwing a few errors and there's some stuff to finish up on it though. Idk. wiu
Here's what I have atm.


http://pastebin.com/a8QVgHd1


I'm getting 4 errors.


>> blah blah maxsize must be initialized in instructor base / member initialized list ????
>> Cannot conver ArrayObject** to ArrayObject<KEYTYPE, VALTYPE>** // wtf
>> division illegal


fukin ghey

Re: Absent's Code Thread / Tech Blog

Baby's first java program.


/*
 * This program takes random numbers generated by java's 
 * Random class and checks weather they are even or odd.
 * It then counts how many after 100 iterations are odd, 
 * and how many are even.
 * 
 * Written by absentinsomniac. 
 * I guess GNU Public license as if anyone would ever fucking care 
 * to use this shitty blip of code lol. Wat.
 * This is literally my first java program.
*/

import java.util.Random;
public class untitled {
    public static void main (String args[]) {
        int x = 0;
        int even = 0;
        int odd = 0; 
        
        while (x != 100)
        {
            Random rand = new Random(); 
            int a = rand.nextInt(100);
            a = a % 2; 
            
            if (a == 0)
            {
                System.out.println("Even."); 
                even++;
                x++; 
            }
            else 
            {
                System.out.println("Odd.");
                odd++;
                x++;
            }
        }
        System.out.println(" ");
        System.out.println("Number of even: " + even); 
        System.out.print(" ");
        System.out.println("Number of Odd: " + odd);
    }
}

Re: Absent's Code Thread / Tech Blog

wwow you wrote a weather checker???
i always wanted a weather checker
why are your class braces java style but your code shits allman ugheignaerg

this also wercs. very minor modifications.

/*
 * This program takes random numbers generated by java's 
 * Random class and checks weather they are even or odd.
 * It then counts how many after 100 iterations are odd, 
 * and how many are even.
 * 
 * Written by absentinsomniac. 
 * I guess GNU Public license as if anyone would ever fucking care 
 * to use this shitty blip of code lol. Wat.
 * This is literally my first java program.
*/

import java.util.Random;
public class untitled {
    public static void main (String args[]) {
        int even = 0;
        int odd = 0; 
        Random rand = new Random(); // Moved outside, only need to
                                    // instantiate once.
 
        for (int i = 0; i < 100; i++) // valid in C99, C++, Java, NOT C89
        {
            int a = rand.nextInt(100);
            a = a % 2; 
            
            if (a == 0)
            {
                System.out.println("Even."); 
                even++;
            }
            else 
            {
                System.out.println("Odd.");
                odd++;
            }
        }
        System.out.println(" ");
        System.out.println("Number of even: " + even); 
        System.out.print(" ");
        System.out.println("Number of Odd: " + odd);
    }
}

allahu akbar license is best license

sloth wrote:

Comfy does not provide challenge, challenge provides success, success provides happiness. Our world is not comfy, although we tried to make it so. Slaves of our own inventions, yada, yada. Not only on a technological level, also on a social and political level. Nothing more but apes. Apes with psychosomatic disorders.

Re: Absent's Code Thread / Tech Blog

Idk I'm using geany and it's not great with dealing with indentation and shit, it's more of like a text editor with IDE features and I'm lazy.


But yeah that's more efficient it seems like, doesn't have to go into a while and an if inside of that. I haven't studied if and while statement complexity though lol. Huha what am I talking about go to bed I have work soon.


I should rewrite a bigger program in java soon-ish. Or better yet find a more complicated "programming challenge" and do it.

Re: Absent's Code Thread / Tech Blog

ummm
uhh
euler
project euler
yh
or some GUI shits, that's what'd make you... good... at java.
or write an android app.
or implement a binary tree recursively with java.

Good night.

sloth wrote:

Comfy does not provide challenge, challenge provides success, success provides happiness. Our world is not comfy, although we tried to make it so. Slaves of our own inventions, yada, yada. Not only on a technological level, also on a social and political level. Nothing more but apes. Apes with psychosomatic disorders.

Re: Absent's Code Thread / Tech Blog

A couple of ass programs I shitted togeather:


public class untitled {

        public static void main (String args[]) {
                int x = 0; 
                while (x != 5){
                                x--; 
                                System.out.println(x);
                        }

        }
}
class Example2 {

        public static void main(String args[]){

                int var1 = 0; 
                int var2 = 0; 

                var1 = 20; 
                var2 = 21; 

                if (var1 != var2){
                        var2--;
                        System.out.println(var2);       
                }
        }

}
class Queue {
    private int q[]; // Holds the queue. 
    private int  putloc, getloc; // Put & Get.
    
    Queue(int size){
        q = new int[size]; // memory for queue
        putloc = getloc = 0; 
    }
    
    void put(int wat){
        if(putloc == q.length){
            System.out.println(" --Queue is full.");
            return; 
        }
        
        q[putloc++] = wat;
    }
    
    int get(){
        if(getloc == putloc){
            System.out.println();
            System.out.println(" --Queue is Empty.");
            return (int) 0; 
        }
        
        return q[getloc++]; 
        
    }
}


class QDemo {
    public static void main(String args[]){
        Queue bigQ = new Queue(100);
        Queue smallQ = new Queue(4); 
        int wat; 
        int i; 
                
        for (i=0; i < 26; i++)
            bigQ.put((int) (i)); 
        
        System.out.println("Contents of bQ:");
        System.out.println();
        for(i=0; i < 26; i++){
            wat = bigQ.get(); 
            if(wat != (int) 0) System.out.print(" " + wat + " " );
        }
        
        System.out.println("\n");
        
        System.out.println("Using smallQ to generate errors: ");
        System.out.println();
        for(i=0; i < 5; i++) {
            System.out.println("Attempting to store " + (int) (26 - i));
            
            smallQ.put((int) (26 - i)); 
            System.out.println(); 
        }
        
        System.out.println();
        System.out.println("Contents of smallQ: ");
        System.out.println();
        for(i=0; i < 5; i++) {
            wat = smallQ.get(); 
            
            if(wat != (int) 0) { 
                System.out.print(" " + wat + " ");
            }
        }
    }
}

^ That one I plan on making extensive changes to and adding a fuckload more to make it more like the C++ queue from hell.


public class quickLoop  {

        public static void main (String args[]) 
                throws java.io.IOException {

                int x = 0;
                int usrNum;
                System.out.println("Enter dis: ");
                usrNum = (int) System.in.read();
                while (x != usrNum){
                                x++; 
                                System.out.println(x);
                                System.out.println("This was first");
                        }

                for  (int y = 0; y < 3; y++){
                        System.out.println(y);
                        System.out.println("That was second.");
                }

                char wat = 'b'; 
                double i; 
                i = (double) wat; 
                System.out.println(i);

        }
}
class Vehicle {
        int passengers; 
        int fuelcap;
        int mpg;

        int range() {
                return fuelcap * mpg; 
        } 
}

class minivan {
        public static void main (String args[])
                throws java.io.IOException {

                Vehicle minivan = new Vehicle(); 


                System.out.println("Miles Per Galon: ");
                minivan.mpg = System.in.read(); 

                System.out.println("Fuelcap: "); 
                minivan.fuelcap = System.in.read(); 

                System.out.println("Passengers: "); 
                minivan.passengers = System.in.read(); 

                System.out.println("Minivan can carry " + minivan.passengers + " with a range of " + minivan.range()); 

        }
}

I think a couple of these are mostly out of the book though, so I can't really say *I* created them. I don't know that they're ver-batim out of the book but meh.

Re: Absent's Code Thread / Tech Blog

Oh my god so far this class is incredibly easy :)

Re: Absent's Code Thread / Tech Blog

I think a lot of the time I get super overwhelmed with the complexity of a project, like I break something and there's so many possible reasons for it being borken and I end up feeling like I do not know what I'm doing so I get this sinking feeling like "you'll never finish it" and "you're just not smart enough for this stuff" and "your design is probably totally wrong and you don't know what you're doing" and shit like that.


Which is how I just felt, and then I tried one more thing and the method works now :|


So, moral of the story is, just keep hacking at it and you'll get it eventually, don't worry about how complex it is, just keep doing one thing at a time. It'll get done eventually.

Re: Absent's Code Thread / Tech Blog

How to keep your server from overheating:


http://static.darknedgy.net:8080/imagehost/up/35a9037178b3353b5da4f147542596b7.jpg

Re: Absent's Code Thread / Tech Blog

>not having completely submerged pc

>being this casul
http://i.ytimg.com/vi/Eub39NaC4rc/hqdefault.jpg

http://i1.kym-cdn.com/photos/images/newsfeed/000/813/215/366.gif
my youtube: https://www.youtube.com/channel/UCmcMLs … CNoiL7eX1g
my deviantart: http://purpledrank666.deviantart.com/

SS official oldfaf.
fuck SS
"A friend with weed is a friend indeed" -Sharpie

"Honestly censorship Is good though it protects women and children" -Absent

"Not everybody think the free market be like it does, but it do." -white economics man

Re: Absent's Code Thread / Tech Blog

that pictures is hosted on the machine it depicts

Re: Absent's Code Thread / Tech Blog

I'm gonna go ahead and write my own pubsubhubbub subscriber implementation in python instead of relying on a library or using someone elses, because it seems like a pretty simple task in and of itself and basically none of the current implementations do quite what I want them to, and some of them have shitty licenses and shit.

Re: Absent's Code Thread / Tech Blog

yay

sloth wrote:

Comfy does not provide challenge, challenge provides success, success provides happiness. Our world is not comfy, although we tried to make it so. Slaves of our own inventions, yada, yada. Not only on a technological level, also on a social and political level. Nothing more but apes. Apes with psychosomatic disorders.

Re: Absent's Code Thread / Tech Blog

Have you checked out the fifodir concept? It's by far the simplest method to implement pubsub.

http://skarnet.org/software/s6/ftrig.html
http://skarnet.org/software/s6/fifodir.html

"Humanity Is Overrated" - Shrek

Re: Absent's Code Thread / Tech Blog

That's definitely interesting. Basically I don't really need to implement anything regarding pubsub except a simple subscriber, then I just need to save and parse info from the updates and simply post to the FF thread using the URL of the new vid of the channel. All the actual work gets done by google's https://pubsubhubbub.appspot.com/ server. It would be interesting to keep track of new pings and shit with a fifodir though, I just don't know if that'd be necessary yet since all it needs to do is get the new shit and create a POST request on the forums immediately every time there's an upload. Of course, it also has to stay subscribed and deal with all that shit but that's still pretty basic using a simple webhook script.


I'll see if it's gonna be useful to use the fifo stuff pretty soon I imagine but as of now it doesn't seem like it'd be a necessary step. Not sure yet.

Re: Absent's Code Thread / Tech Blog

This is some god damn fucking bullshit. I built this whole damn subscriber in python and wrote a little python http server based on pythons http.server, and all said and done, YOUTUBES FUCKING API IS BROKEN:


https://code.google.com/p/gdata-issues/ … il?id=7138
https://code.google.com/p/gdata-issues/ … il?id=5602
https://stackoverflow.com/questions/296 … ifications


God damnit. Output from my god damn subscriber:

Hub did not return 204 or 202 Status code is: 403 Text Value: Restricted topic


So you can't fucking subscribe to youtube push notifications and there's no easily accessible fucking RSS feed, you just have to poll like a shithead. God's script is the only working way to do this until (and IF) they fix this.

Re: Absent's Code Thread / Tech Blog

holy shit :(
poll scrape the fags maybe

sloth wrote:

Comfy does not provide challenge, challenge provides success, success provides happiness. Our world is not comfy, although we tried to make it so. Slaves of our own inventions, yada, yada. Not only on a technological level, also on a social and political level. Nothing more but apes. Apes with psychosomatic disorders.

Re: Absent's Code Thread / Tech Blog

lmao ikr


Oh well. Whatever I guess. I just stuck my bullshit unpolished script up on github if anyone wants to look but meh. If they ever get around to fixing their shit or if I end up wanting to use pubsubhubbub for anything else then it'll be there to work on.

Re: Absent's Code Thread / Tech Blog

Very basic password management script.

Re: Absent's Code Thread / Tech Blog

>licensing some tiny ass script
>licensing it under GPL2 and not WTFPL or AAPL
well at least it's not gpl3

sloth wrote:

Comfy does not provide challenge, challenge provides success, success provides happiness. Our world is not comfy, although we tried to make it so. Slaves of our own inventions, yada, yada. Not only on a technological level, also on a social and political level. Nothing more but apes. Apes with psychosomatic disorders.

Re: Absent's Code Thread / Tech Blog

loon wrote:

Fuck what you did.

Fuck you too.

Re: Absent's Code Thread / Tech Blog

<3

i couldn't even understand the script because i'm a lazy stupid fuck but from the readme it seems pretty damn decent\

YOU TOOK IT DOWN HAHAFJBewfnoaw wut

sloth wrote:

Comfy does not provide challenge, challenge provides success, success provides happiness. Our world is not comfy, although we tried to make it so. Slaves of our own inventions, yada, yada. Not only on a technological level, also on a social and political level. Nothing more but apes. Apes with psychosomatic disorders.