The programmer's corner.

Please post computer issues here. We will try to help you. Also for showing off your PC.
User avatar
axe_pidy
Gangsta Clucker
Posts: 1336
Joined: Tue May 15, 2012 1:55 pm
KCNR Username: axe_pidy
Location: Mumbai,India
Contact:

Tue Feb 17, 2015 6:49 am

9gag :D i've seen that post!
This is a Signature
User avatar
axe_pidy
Gangsta Clucker
Posts: 1336
Joined: Tue May 15, 2012 1:55 pm
KCNR Username: axe_pidy
Location: Mumbai,India
Contact:

Tue Feb 17, 2015 6:52 am

A simple program to Accept and Display name & roll no of a single student

Code: Select all

#include<iostream.h>
#include<conio.h>
class student{
int roll;
char name[15];
	public: void gd(){
	cout<<"Enter name & Roll no:";
	cin>>name>>roll;
	}
	void pd(){
	cout<<"\nName="<<name<<"\nRoll No="<<roll;
	}
};
void main(){
student s1;
clrscr();
s1.gd();
s1.pd();
getch();
}
This is a Signature
wasay0029
Clucker
Posts: 228
Joined: Wed Dec 25, 2013 10:12 am
KCNR Username: Jackman

Tue Feb 17, 2015 8:39 am

A reminder to everyone, kindly quote your language platform too so that we/I can learn something about other languages. Thank you.
User avatar
axe_pidy
Gangsta Clucker
Posts: 1336
Joined: Tue May 15, 2012 1:55 pm
KCNR Username: axe_pidy
Location: Mumbai,India
Contact:

Tue Feb 17, 2015 2:02 pm

that language is C++.
This is a Signature
Fuet
Gangsta Clucker
Posts: 1966
Joined: Sun Dec 18, 2011 3:04 pm
KCNR Username: Fuet

Tue Feb 24, 2015 2:34 pm

VS2010 folder
Spoiler!
Image

Some reverse engineering (C++ obviously)
Spoiler!
Image
Image
Image
Image
Image
Image
Image

Direct3D (DirectX) menu I made (also C++)
Spoiler!
Image

VC++
Image
Image
Image
Image
wasay0029
Clucker
Posts: 228
Joined: Wed Dec 25, 2013 10:12 am
KCNR Username: Jackman

Tue Feb 24, 2015 5:58 pm

This guy *_*, I've been waiting for you THIS long to respond on my thread. Thanks for everything, will you show more, please? :D
Fuet
Gangsta Clucker
Posts: 1966
Joined: Sun Dec 18, 2011 3:04 pm
KCNR Username: Fuet

Thu Mar 05, 2015 1:13 am

It depends, what do you want to see?
Image
User avatar
Kent
Gangsta Clucker
Posts: 2391
Joined: Mon Apr 22, 2013 4:27 pm
KCNR Username: kent_BoBo
Location: In an ice-cave blazing!

Thu Mar 05, 2015 2:01 am

I asked a friend of mine a couple of months to make me a program witch is my signature, would pop up at 04:20 at night saying ''Windows has detected you are stoned as fuck''

He never made it, anyone else wanna give it a shot?
I'm so stoned I don't remember what I said in the beginning of this sentence.
Image
Yezpahr wrote:You're a young, blind, antfucking, down syndrome faggot, fucked in the anus by your own uncle. Geez, grow the fuck up you boner biting bastard.
wasay0029
Clucker
Posts: 228
Joined: Wed Dec 25, 2013 10:12 am
KCNR Username: Jackman

Thu Mar 05, 2015 6:05 am

I just do small titty bitty programming, if that has to work with Visual Basic , then yes :D Otherwise Fuet or Peter. Fuet, there is nothing dependent, show all :D :D
Peter
The Cluckin' Godfather
Posts: 7052
Joined: Tue Aug 16, 2011 10:11 am
KCNR Username: Peter
Location: Hell

Wed Sep 09, 2015 9:51 pm

Java code, the first RMI application that I made.


pom.xml

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>nl.ica.oose.dea</groupId>
    <artifactId>oose_rmi_project</artifactId>
    <version>1.0-SNAPSHOT</version>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.11</version>
        </dependency></dependencies>
</project>
ITerugTeller.java

Code: Select all

import java.rmi.RemoteException;

/**
 * Created by Peter on 7-9-2015.
 */

interface ITerugTeller extends java.rmi.Remote {
    public void setValue(int value) throws java.rmi.RemoteException;
    public int getValue() throws java.rmi.RemoteException;
    public void decrement() throws java.rmi.RemoteException;
    public void addCallbackListener(ICallback icb) throws java.rmi.RemoteException;
}
TerugTellerServer.java

Code: Select all

/**
 * Created by Peter on 7-9-2015.
 */
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;


public class TerugTellerServer {
    public static void main(String[] args) {
        ITerugTeller teller;
        try {
            teller = new TerugTeller();
            Registry r = LocateRegistry.createRegistry(1099);
            r.bind("terugteller", teller);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
TerugTellerClient.java

Code: Select all

import java.rmi.NotBoundException;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.server.UnicastRemoteObject;

/**
 * Created by Peter on 7-9-2015.
 */
public class TerugTellerClient extends UnicastRemoteObject implements ICallback {
    private TerugTellerClient() throws RemoteException {
    }

    public static void main(String[] args) throws RemoteException, NotBoundException {
        TerugTellerClient tclient = new TerugTellerClient();
        tclient.start();
    }

    private void start() throws RemoteException, NotBoundException {
        ITerugTeller teller = (ITerugTeller) LocateRegistry.getRegistry().lookup("terugteller");

        teller.addCallbackListener(this);
        teller.setValue(200);

        for(int i = 100; i>0; i--) teller.decrement();
    }

    public void notifyChange(int svalue) {
        System.out.println("De value is een veelvoud van 25.  Namelijk "+svalue);
    }
}
ICallBack.java

Code: Select all

import java.rmi.Remote;
import java.rmi.RemoteException;

/**
 * Created by Peter on 7-9-2015.
 */
public interface ICallback extends Remote {
    public void notifyChange(int svalue) throws RemoteException;
}
TerugTeller.java

Code: Select all

import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
import java.util.ArrayList;
import java.util.List;

public class TerugTeller extends UnicastRemoteObject implements ITerugTeller {
    private int value;
    private List<ICallback> cblist = new ArrayList<ICallback>();

    protected TerugTeller() throws RemoteException {
    }

    public void setValue(int value) throws RemoteException {
        this.value = value;
    }

    public int getValue() throws RemoteException {
        return value;
    }

    public void decrement() throws RemoteException {
        value -=1;
        if (value % 25 == 0) for (ICallback cb : cblist) cb.notifyChange(value);
    }

    public void addCallbackListener(ICallback icb) throws RemoteException {
        cblist.add(icb);
    }
}
JUnit test file, which tests the script for mistakes

Code: Select all

import org.junit.*;

import java.rmi.RemoteException;
import static org.junit.Assert.assertEquals;

/**
 * Created by Peter on 8-9-2015.
 */
public class TerugTellerTest {
    private TerugTeller terugTeller;

    @Before
    public void setUp() throws Exception {
        terugTeller = new TerugTeller();
        terugTeller.setValue(200);
    }

    @Test
    public void testGetValue() throws RemoteException {
        terugTeller.getValue();
        assertEquals(200,terugTeller.getValue());
    }

    @Test
    public void testDecrement() throws RemoteException {
        terugTeller.decrement();
        assertEquals(terugTeller.getValue(),199);
    }
}

Please note, this code was written in the maven format.
Image

Want your own statistics counter? Look right here: viewtopic.php?f=25&t=1216
(Feature) introduction topic: viewtopic.php?f=25&t=28493
Post Reply