Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Programmers' lounge. (Programming-related discussions only)
New Posts  All Forums:Forum Nav:

Programmers' lounge. (Programming-related discussions only) - Page 102

post #1011 of 1018
The largest? Hmm...
Code:
max('mammal eaten')

It's 't'

Apparently that's bigger than an antelope.
post #1012 of 1018
Does anyone in here know SNMP well? I want to replace all my little apps and batch files I have with a script or process that runs on a schedule via Task Scheduler. I want it to run a ping test on every IP and poll what is there if there is a response. Going to make that my next little project.
Ever Evolving
(18 items)
 
   
CPUMotherboardGraphicsRAM
Phenom II 1090T Black Edition Gigabyte GA-890FXA-UD5 Diamond R9 280X Crucial Ballistix Sport 16GB VLP DDR3 1600 CL9 ... 
Hard DriveHard DriveHard DriveOptical Drive
Vertex 3 120GB SSD  2x WD 1TB Caviar Black SATA3 WD Caviar Black 640GB SATA2 HP DVD-RW 1170i 
CoolingCoolingCoolingOS
Prolimatech Megahalem 2x Delta AFB1212SHE  7x Cooler Master SickleFlow R4 fans Windows 7 Professional 64bit 
MonitorKeyboardPowerCase
2x Samsung SyncMaster E2420 23.6" 1920x1080 Logitech G15 Corsair HX1000W Cooler Master HAF932 (Fan Mod) 
MouseMouse Pad
Logitech G400 Generic 
CPUMotherboardGraphicsRAM
3.0GHz P4 w/HT Asus P5GDC-V deluxe ATI HD 3450 2GB DDR400 
Hard DriveOptical DriveOSMonitor
1x WD 360GB 1x WD 120GB 3xDead LiteOn DVDROM LiteON DVDRW XP SP3 x86 AG Neovo 17" (Sceptre 21" 1080p died) 
PowerCaseMouse Pad
Ultra 550W oldschool MGE case what mouse pad? 
  hide details  
Reply
Ever Evolving
(18 items)
 
   
CPUMotherboardGraphicsRAM
Phenom II 1090T Black Edition Gigabyte GA-890FXA-UD5 Diamond R9 280X Crucial Ballistix Sport 16GB VLP DDR3 1600 CL9 ... 
Hard DriveHard DriveHard DriveOptical Drive
Vertex 3 120GB SSD  2x WD 1TB Caviar Black SATA3 WD Caviar Black 640GB SATA2 HP DVD-RW 1170i 
CoolingCoolingCoolingOS
Prolimatech Megahalem 2x Delta AFB1212SHE  7x Cooler Master SickleFlow R4 fans Windows 7 Professional 64bit 
MonitorKeyboardPowerCase
2x Samsung SyncMaster E2420 23.6" 1920x1080 Logitech G15 Corsair HX1000W Cooler Master HAF932 (Fan Mod) 
MouseMouse Pad
Logitech G400 Generic 
CPUMotherboardGraphicsRAM
3.0GHz P4 w/HT Asus P5GDC-V deluxe ATI HD 3450 2GB DDR400 
Hard DriveOptical DriveOSMonitor
1x WD 360GB 1x WD 120GB 3xDead LiteOn DVDROM LiteON DVDRW XP SP3 x86 AG Neovo 17" (Sceptre 21" 1080p died) 
PowerCaseMouse Pad
Ultra 550W oldschool MGE case what mouse pad? 
  hide details  
Reply
post #1013 of 1018
Hopefully someone can help me with this I have been looking for an answer for a long time, and I haven't found the answer I am looking for OR I have given the correct answer, and thought it wasn't what I expect.

I am wanting to make android app that uses tcp between two android phones. Basically client / server where my tablet is the server and my phone is the client.

I am wanting to have my tablet to be "command" server, I want to prank my friends by putting client app on their phone and make their phones go off whenever I "command" it from my tablet, or make it vibrate or ring. Now, all I have seen is these tutorials here

http://systembash.com/content/a-simple-java-tcp-server-and-tcp-client/

basically it closes the connection as soon as it connects, BUT I have to removing the "close socket" command to keep the connection alive.

I have it to where I can list them with listview, but whenever I click on the row idk how I can send "commands" to the phone like


incoming pseudo code

Tablet send command "vibrate"
android phone receive command "vibrate"

Hopefully someone can help me out all the tutorials out there haven't helped me achieve what I want.
    
CPUMotherboardGraphicsRAM
E8400 3.0ghz OC @ 3.8GHz @ 1.36v DFI BLood Iron P35 ECS 8800GTS 512MB G.Skill 2x 1gb DDR2 800 CAS @ 5-6-6-21 
Hard DriveOptical DriveOSMonitor
Seagate Barracuda 7200rpm 250GB + 1TB 7200rpm HDD Lite On DVD burner Windows 7 32 bit 21.5 inch Samsung monitor full HD 1080p :D 
KeyboardPowerCaseMouse
microsoft wireless Corsair 650 watts Cooler Master 690 Logitech mx518 
Mouse Pad
fryz mousepad 
  hide details  
Reply
    
CPUMotherboardGraphicsRAM
E8400 3.0ghz OC @ 3.8GHz @ 1.36v DFI BLood Iron P35 ECS 8800GTS 512MB G.Skill 2x 1gb DDR2 800 CAS @ 5-6-6-21 
Hard DriveOptical DriveOSMonitor
Seagate Barracuda 7200rpm 250GB + 1TB 7200rpm HDD Lite On DVD burner Windows 7 32 bit 21.5 inch Samsung monitor full HD 1080p :D 
KeyboardPowerCaseMouse
microsoft wireless Corsair 650 watts Cooler Master 690 Logitech mx518 
Mouse Pad
fryz mousepad 
  hide details  
Reply
post #1014 of 1018
So I'm getting a "Error 2 error C2676: binary '*' : 'matrix' does not define this operator or a conversion to a type acceptable to the predefined operator" in this line:
Code:
return (aMatrix * (*this));

In this function:
Code:
Vector operator *(matrix &aMatrix) {
                return (aMatrix * (*this));
        }

In the beginning I thought maybe something was wrong with the "*" operator function but I couldn't find any problems with it,here it is:
Code:
Vector operator *(Vector &aVector) {
                if (aVector.Size() != cols)
                        return NULL;
                Vector result;
                for (int i = 0; i < cols; ++i)
                        result.push_back(theMatrix.at(i) * aVector);
                return result;
        }

Here's the whole thing if you want to see it:
Warning: Spoiler! (Click to show)
Code:
#include <iostream>
#include <vector>

using namespace std;

struct matrix;

struct Vector{
private:
        vector <float> rows;
        int size;
public:
        Vector() : size(0) {}
        Vector(int theSize) : size(theSize) { append(theSize); }
        void append(int theSize) {
                size = theSize;
                for (int i = 0; i < theSize; ++i){
                        float currIndex;
                        cin >> currIndex;
                        rows.push_back(currIndex);
                }
        }
        void push_back(float num) { rows.push_back(num); ++size; }
        int Size() { return size; }
        void operator =(Vector &aVector) {
                rows = aVector.theVector();
        }
        float at(int index) {
                if (index >= size)
                        return NULL;
                return rows.at(index);
        }
        float operator *(Vector &aVector) {
                if (aVector.Size() != size)
                        return NULL;
                float result = 0;
                for (int i = 0; i < size; ++i)
                        result += (rows.at(i) * aVector.at(i));
                return result;
        }
        Vector operator *(float factor) {
                Vector result;
                for (int i = 0; i < rows.size(); ++i)
                        result.push_back(rows.at(i) * factor);
                return result;
        }
        Vector operator *(matrix &aMatrix) {
                return (aMatrix * (*this));
        }
        Vector operator +(Vector &aVector) {
                if (aVector.Size() != size)
                        return NULL;
                Vector result;
                for (int i = 0; i < size; ++i)
                        result.push_back(rows.at(i) + aVector.at(i));
                return result;
        }
        Vector operator -(Vector &aVector) {
                if (aVector.Size() != size)
                        return NULL;
                Vector result;
                for (int i = 0; i < size; ++i)
                        result.push_back(rows.at(i) - aVector.at(i));
                return result;
        }
        Vector operator /(float divisor) {
                Vector result;
                for (int i = 0; i < rows.size(); ++i)
                        result.push_back(rows.at(i) / divisor);
                return result;
        }
        vector <float> theVector() {
                return rows;
        }
        void clear() {
                rows.clear();
        }
};

struct matrix{
private:
        int cols, rows;
        vector <Vector> theMatrix;
public:
        matrix() : cols(0), rows(0) {}
        matrix(int num1, int num2) { append(num1, num2); }
        void append(int num1, int num2) {
                theMatrix.clear();
                rows = num1;
                cols = num2;
                for (int i = 0; i < rows; ++i){
                        Vector currRow;
                        currRow.append(cols);
                        theMatrix.push_back(currRow);
                        currRow.clear();
                }
        }
        void interchange(int row1, int row2) {
                if (row1 > rows && row2 > rows)
                        return;
                swap(theMatrix.at(row1 - 1), theMatrix.at(row2 - 1));
        }
        Vector operator *(Vector &aVector) {
                if (aVector.Size() != cols)
                        return NULL;
                Vector result;
                for (int i = 0; i < cols; ++i)
                        result.push_back(theMatrix.at(i) * aVector);
                return result;
        }
        void operator *(float factor) {
                for (int i = 0; i < rows; ++i)
                        theMatrix.at(i) = theMatrix.at(i) * factor;
        }
        float at(int row, int col) {
                if (row >= rows || col >= cols)
                        return NULL;
                return theMatrix.at(row).at(col);
        }
        Vector at(int row) {
                if (row >= rows)
                        return NULL;
                return theMatrix.at(row);
        }
        void clear() { theMatrix.clear(); }
        int Rows() { return rows; }
        int Cols() { return cols; }
};

Can anyone see the problem?

Edit:I fixed it.turns out the matrix's 'operator *' needs to be at least declared before I use it,so I declared the Vector's 'operator *' function in the class definition and then defined it AFTER the matrix class difinition.Hope.Hope this helps. smile.gif
Edited by ABD EL HAMEED - 1/10/15 at 7:18am
My First
(9 items)
 
My dream
(7 items)
 
 
CPUMotherboardGraphicsGraphics
i7 4960x ASUS Rampage IV Extreme Black Edition GTX 780 ti GTX 780 ti 
GraphicsRAMHard Drive
GTX 780 ti  64 GB corsair dominator Samsung 840 pro 256GB SSD 
  hide details  
Reply
My First
(9 items)
 
My dream
(7 items)
 
 
CPUMotherboardGraphicsGraphics
i7 4960x ASUS Rampage IV Extreme Black Edition GTX 780 ti GTX 780 ti 
GraphicsRAMHard Drive
GTX 780 ti  64 GB corsair dominator Samsung 840 pro 256GB SSD 
  hide details  
Reply
post #1015 of 1018
Hey guys, I've got a bit stuck with Java... I created a new thread because it would be a bit much for here.
http://www.overclock.net/t/1534026/beginner-java-programmer-need-help-debugging/0_100

If any gurus want to help it would be greatly appreciated.
Workstation
(22 items)
 
   
CPUMotherboardGraphicsGraphics
[Intel] Core i7-4790K [Asus] Z97-WS [Asus] GTX 970 Strix 4GB [Asus] GTX 970 Strix 4GB 
RAMHard DriveCoolingCooling
[G.Skill] 2x8GB Sniper 2133 MHz [Samsung] 850 Pro 512GB [Noctua] NH-U14S [Noctua] NF-A14 PWM 
CoolingCoolingOSMonitor
[Noctua] NF-A14 PWM [Noctua] NF-A14 PWM [Microsoft] Windows 7 Professional 64-bit [Dell] U2715H 
MonitorMonitorPowerCase
[Dell] U2415 [Dell] U2415 [Seasonic] Platinum 660W [Fractal Design] Define R5 
MouseAudioAudioAudio
[Zowie] AM-FG [JDS Labs] ODAC [JDS Labs] Objective2 [SMSL] SA-50 
AudioAudio
[beyerdynamic] DT 880 Premium 600 ohm [Wharfedale] Diamond 220 
CPUMotherboardGraphicsRAM
[Intel] Core i7-4710MQ @ 3.5GHz [Intel] HM87 Express Chipset [Nvidia] GTX 860M [Crucial] 2x4GB Crucial Ballistix Sport @ 1600MHz 
Hard DriveCoolingOSMonitor
[Crucial] MX100 512GB [Arctic] MX-2 [Microsoft] Windows 7 Professional 64-bit  [Innolux] N133HSE-EA1 
  hide details  
Reply
Workstation
(22 items)
 
   
CPUMotherboardGraphicsGraphics
[Intel] Core i7-4790K [Asus] Z97-WS [Asus] GTX 970 Strix 4GB [Asus] GTX 970 Strix 4GB 
RAMHard DriveCoolingCooling
[G.Skill] 2x8GB Sniper 2133 MHz [Samsung] 850 Pro 512GB [Noctua] NH-U14S [Noctua] NF-A14 PWM 
CoolingCoolingOSMonitor
[Noctua] NF-A14 PWM [Noctua] NF-A14 PWM [Microsoft] Windows 7 Professional 64-bit [Dell] U2715H 
MonitorMonitorPowerCase
[Dell] U2415 [Dell] U2415 [Seasonic] Platinum 660W [Fractal Design] Define R5 
MouseAudioAudioAudio
[Zowie] AM-FG [JDS Labs] ODAC [JDS Labs] Objective2 [SMSL] SA-50 
AudioAudio
[beyerdynamic] DT 880 Premium 600 ohm [Wharfedale] Diamond 220 
CPUMotherboardGraphicsRAM
[Intel] Core i7-4710MQ @ 3.5GHz [Intel] HM87 Express Chipset [Nvidia] GTX 860M [Crucial] 2x4GB Crucial Ballistix Sport @ 1600MHz 
Hard DriveCoolingOSMonitor
[Crucial] MX100 512GB [Arctic] MX-2 [Microsoft] Windows 7 Professional 64-bit  [Innolux] N133HSE-EA1 
  hide details  
Reply
post #1016 of 1018
Quote:
Originally Posted by ABD EL HAMEED View Post


Edit:I fixed it.turns out the matrix's 'operator *' needs to be at least defined before I use it,so I defined the Vector's 'operator *' function in the class deceleration and then declared it AFTER the matrix class deceleration.Hope this helps. smile.gif

to nitpick but you have the words backwards, you have to declare the operator* before it's used, and you can define it later in the compilation unit.
post #1017 of 1018
Quote:
Originally Posted by dBlisse View Post

to nitpick but you have the words backwards, you have to declare the operator* before it's used, and you can define it later in the compilation unit.

Sorry lol,sometimes I just can't think straight tongue.gif
My First
(9 items)
 
My dream
(7 items)
 
 
CPUMotherboardGraphicsGraphics
i7 4960x ASUS Rampage IV Extreme Black Edition GTX 780 ti GTX 780 ti 
GraphicsRAMHard Drive
GTX 780 ti  64 GB corsair dominator Samsung 840 pro 256GB SSD 
  hide details  
Reply
My First
(9 items)
 
My dream
(7 items)
 
 
CPUMotherboardGraphicsGraphics
i7 4960x ASUS Rampage IV Extreme Black Edition GTX 780 ti GTX 780 ti 
GraphicsRAMHard Drive
GTX 780 ti  64 GB corsair dominator Samsung 840 pro 256GB SSD 
  hide details  
Reply
post #1018 of 1018
np, that's like every other week for me tongue.gif
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Coding and Programming
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Programmers' lounge. (Programming-related discussions only)