• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 05:52
CEST 11:52
KST 18:52
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
Code S Season 1 - RO8 Preview3[ASL21] Ro8 Preview Pt2: Progenitors8Code S Season 1 - RO12 Group A: Rogue, Percival, Solar, Zoun13[ASL21] Ro8 Preview Pt1: Inheritors16[ASL21] Ro16 Preview Pt2: All Star10
Community News
Maestros of The Game 2 announcement and schedule !7Weekly Cups (April 27-May 4): Clem takes triple0RSL Revival: Season 5 - Qualifiers and Main Event12Code S Season 1 (2026) - RO12 Results12026 GSL Season 1 Qualifiers25
StarCraft 2
General
Code S Season 1 - RO8 Preview Behind the Blue - Team Liquid History Book Weekly Cups (April 27-May 4): Clem takes triple Blizzard Classic Cup @ BlizzCon 2026 - $100k prize pool Code S Season 1 (2026) - RO12 Results
Tourneys
Maestros of The Game 2 announcement and schedule ! GSL Code S Season 1 (2026) Sea Duckling Open (Global, Bronze-Diamond) RSL Revival: Season 5 - Qualifiers and Main Event Sparkling Tuna Cup - Weekly Open Tournament
Strategy
Custom Maps
[D]RTS in all its shapes and glory <3 [A] Nemrods 1/4 players
External Content
Mutation # 524 Death and Taxes The PondCast: SC2 News & Results Mutation # 523 Firewall Mutation # 522 Flip My Base
Brood War
General
Do we have a pimpest plays list? BGH Auto Balance -> http://bghmmr.eu/ (Spoiler) Asl ro8 D winner interview BW General Discussion AI Question
Tourneys
[ASL21] Ro8 Day 4 Escore Tournament StarCraft Season 2 Small VOD Thread 2.0 [BSL22] RO16 Group Stage - 02 - 10 May
Strategy
Simple Questions, Simple Answers Fighting Spirit mining rates What's the deal with APM & what's its true value Any training maps people recommend?
Other Games
General Games
Stormgate/Frost Giant Megathread Path of Exile Nintendo Switch Thread OutLive 25 (RTS Game) Dawn of War IV
Dota 2
The Story of Wings Gaming
League of Legends
G2 just beat GenG in First stand
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
Vanilla Mini Mafia Mafia Game Mode Feedback/Ideas TL Mafia Community Thread Five o'clock TL Mafia
Community
General
European Politico-economics QA Mega-thread US Politics Mega-thread The Letting Off Steam Thread Russo-Ukrainian War Thread 3D technology/software discussion
Fan Clubs
The IdrA Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece [Req][Books] Good Fantasy/SciFi books
Sports
2024 - 2026 Football Thread McBoner: A hockey love story Formula 1 Discussion
World Cup 2022
Tech Support
streaming software Strange computer issues (software) [G] How to Block Livestream Ads
TL Community
The Automated Ban List
Blogs
How EEG Data Can Predict Gam…
TrAiDoS
ramps on octagon
StaticNine
Funny Nicknames
LUCKY_NOOB
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1708 users

The Big Programming Thread - Page 84

Forum Index > General Forum
Post a Reply
Prev 1 82 83 84 85 86 1032 Next
Thread Rules
1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution.
2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20)
3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible.
4. Use [code] tags to format code blocks.
kollin
Profile Blog Joined March 2011
United Kingdom8380 Posts
October 09 2011 16:55 GMT
#1661
On September 12 2011 11:07 f0rzaa wrote:
I think this was the first example of the class(C++) intro:


#include <iostream>

using namespace std;

int main()
{
cout << "Hello world!" << endl;
return 0;
}

I realize this might be extremely simple but I was playing around with Codeblocks and I seem to get the same thing with or without the return 0;. Hello world! is printed either way.

So basically my question is why's it work with and without it if it's needed?


I don't know if this has been said already (was just browsing through old posts), but with the brand new shiny c++ you actually don't need to put return 0;.
EvanED
Profile Joined October 2009
United States111 Posts
Last Edited: 2011-10-10 01:09:07
October 10 2011 01:08 GMT
#1662
On October 10 2011 01:55 kollin wrote:
I don't know if this has been said already (was just browsing through old posts), but with the brand new shiny c++ you actually don't need to put return 0;.

You didn't need to in the '98 C++ standard either. However, it's not harmful, and it might be a decent habit to get into (putting it there) both for explicitness's sake and because it is required in C.
BottleAbuser
Profile Blog Joined December 2007
Korea (South)1888 Posts
October 10 2011 01:29 GMT
#1663
@Frigo if your NodeVector and EdgeVector classes are implementations of Vectors, you're already in n^2 time. You can go to linear time by turning them into, say, a HashMap.
Compilers are like boyfriends, you miss a period and they go crazy on you.
Frigo
Profile Joined August 2009
Hungary1023 Posts
Last Edited: 2011-10-10 01:50:22
October 10 2011 01:44 GMT
#1664
HAHA!

Managed to create an observer pattern in Java that does not require the user to manually unsubscribe each observer from the observable object, and does not leak memory either.

http://frigocoder.dyndns.org/svn/jfrigo/util/Observable.java
http://frigocoder.dyndns.org/svn/jfrigo/util/Observer.java
http://frigocoder.dyndns.org/svn/jfrigo/util/ComparableWeakReference.java

On October 10 2011 10:29 BottleAbuser wrote:
@Frigo if your NodeVector and EdgeVector classes are implementations of Vectors, you're already in n^2 time. You can go to linear time by turning them into, say, a HashMap.


I thought Vectors have amortized constant insertion time? Both are based on Vector and its add method.

As for the Observer set, I plan on creating a HashTreeSet which is just basically a hash table with a self-balancing binary tree in each bucket instead of a list. O(1) average access, O(log n) worst case access with poor hash functions. Too difficult at the moment though, I'm still a noobie java progger.
http://www.fimfiction.net/user/Treasure_Chest
SRBNikola
Profile Blog Joined July 2011
Serbia191 Posts
Last Edited: 2011-10-11 17:02:08
October 11 2011 17:00 GMT
#1665
Could someone recommend goods books for Software Engineering(I know about Code Completed), Computer Science(math side, machine code, ai) and hardware books(hardware construction or w/e, just want to get good picture), if possible books that are used in university, i am fairly experienced .NET and C++ developer. Thanks a lot!

~ P.S. Awesome thread!
Zocat
Profile Joined April 2010
Germany2229 Posts
Last Edited: 2011-10-11 17:13:34
October 11 2011 17:12 GMT
#1666
On October 12 2011 02:00 LionKiNG wrote:
Could someone recommend goods books for Software Engineering(I know about Code Completed), Computer Science(math side, machine code, ai) and hardware books(hardware construction or w/e, just want to get good picture), if possible books that are used in university, i am fairly experienced .NET and C++ developer. Thanks a lot!

~ P.S. Awesome thread!


AI:
Artificial Intelligence: A Modern Approach by Stuart Russell and Peter Norvig

It's _the_ basic AI book we use in all lectures in university. Keep in mind: only pseudocode.

About math: What kind of math, try to be more specific
SRBNikola
Profile Blog Joined July 2011
Serbia191 Posts
October 11 2011 17:17 GMT
#1667
On October 12 2011 02:12 Zocat wrote:
Show nested quote +
On October 12 2011 02:00 LionKiNG wrote:
Could someone recommend goods books for Software Engineering(I know about Code Completed), Computer Science(math side, machine code, ai) and hardware books(hardware construction or w/e, just want to get good picture), if possible books that are used in university, i am fairly experienced .NET and C++ developer. Thanks a lot!

~ P.S. Awesome thread!


AI:
Artificial Intelligence: A Modern Approach by Stuart Russell and Peter Norvig

It's _the_ basic AI book we use in all lectures in university. Keep in mind: only pseudocode.

About math: What kind of math, try to be more specific


Thanks a lot, i will check that book out and maybe order it, as for math, well mostly math that is used in "Computer Science" courses.

Also another question is W3School certification worth its money or complete b/s?
delHospital
Profile Blog Joined December 2010
Poland261 Posts
October 11 2011 19:15 GMT
#1668
On October 12 2011 02:17 LionKiNG wrote:
Show nested quote +
On October 12 2011 02:12 Zocat wrote:
On October 12 2011 02:00 LionKiNG wrote:
Could someone recommend goods books for Software Engineering(I know about Code Completed), Computer Science(math side, machine code, ai) and hardware books(hardware construction or w/e, just want to get good picture), if possible books that are used in university, i am fairly experienced .NET and C++ developer. Thanks a lot!

~ P.S. Awesome thread!


AI:
Artificial Intelligence: A Modern Approach by Stuart Russell and Peter Norvig

It's _the_ basic AI book we use in all lectures in university. Keep in mind: only pseudocode.

About math: What kind of math, try to be more specific


Thanks a lot, i will check that book out and maybe order it, as for math, well mostly math that is used in "Computer Science" courses.

There are many math courses that you take during CS studies. Mathematical analysis, geometry, linear algebra, probability, statistics, discrete mathematics and also several algorithm courses (I guess this is theoretical computer science and not math, though). This isn't high school, you can't just buy a "math book" :>

If you don't have any knowledge about algorithms, I'd suggest focusing on that first. Cormen's book seems to be something that's recommended by every professor/lecturer.

Also another question is W3School certification worth its money or complete b/s?

I doubt it's worth it. W3schools seems to be just a random website with html documentation (incorrect in many places, too).
SRBNikola
Profile Blog Joined July 2011
Serbia191 Posts
October 11 2011 19:24 GMT
#1669
On October 12 2011 04:15 delHospital wrote:
Show nested quote +
On October 12 2011 02:17 LionKiNG wrote:
On October 12 2011 02:12 Zocat wrote:
On October 12 2011 02:00 LionKiNG wrote:
Could someone recommend goods books for Software Engineering(I know about Code Completed), Computer Science(math side, machine code, ai) and hardware books(hardware construction or w/e, just want to get good picture), if possible books that are used in university, i am fairly experienced .NET and C++ developer. Thanks a lot!

~ P.S. Awesome thread!


AI:
Artificial Intelligence: A Modern Approach by Stuart Russell and Peter Norvig

It's _the_ basic AI book we use in all lectures in university. Keep in mind: only pseudocode.

About math: What kind of math, try to be more specific


Thanks a lot, i will check that book out and maybe order it, as for math, well mostly math that is used in "Computer Science" courses.

There are many math courses that you take during CS studies. Mathematical analysis, geometry, linear algebra, probability, statistics, discrete mathematics and also several algorithm courses (I guess this is theoretical computer science and not math, though). This isn't high school, you can't just buy a "math book" :>

If you don't have any knowledge about algorithms, I'd suggest focusing on that first. Cormen's book seems to be something that's recommended by every professor/lecturer.

Show nested quote +
Also another question is W3School certification worth its money or complete b/s?

I doubt it's worth it. W3schools seems to be just a random website with html documentation (incorrect in many places, too).


I got knowledge in both algorithms and most of those math parts( Probability and statistics left, i am high school), thanks tho.
renox
Profile Joined June 2011
United States48 Posts
October 11 2011 19:24 GMT
#1670
Hey guys, same question from me in spoiler. Was wondering if anyone had any ideas because I'm still looking

+ Show Spoiler +
On October 05 2011 06:43 renox wrote:
Hey guys,

I'm currently a first year computer science student and I am in need of a job. What would you guys suggest I look for to benefit me in this field? Is there anything that I would even qualify for just being a first year student? Any and all advice would be lovely, share personal experiences of working during school etc.


On October 05 2011 08:05 renox wrote:
Show nested quote +
On October 05 2011 07:18 tofucake wrote:
Almost any work you'll get as a first year student will be bitch work and there's no way around it.

Is this going to be a job you do for school (co-op program) or just something you'll do in your spare time?

Well I need a job just to have money and for my expenses, but I was wondering if there was something I could do that would later be useful to me in some way in regards to this field. So I was wondering if you guys have had some luck like this or experience with it. I mean I could get some random job like most college students but I figured if I could tie it into the field I want to study somehow it would benefit me because I may find it interesting but also be an asset to my career down the road.

Thorakh
Profile Joined April 2011
Netherlands1788 Posts
October 11 2011 19:31 GMT
#1671
On October 04 2011 09:24 Millitron wrote:
Show nested quote +
On October 04 2011 05:12 Thorakh wrote:
95% of all programmers couldn't write maintainable code if their life depended on it
I always hear people talking about this, but what do you exactly mean by that? Can you give any examples?

Most people are bad about commenting there work, and even when they do, the comments aren't very explanatory. Further, maintainable code needs commonly used variables defined globally, rather than each time its needed, so you can update it in only one spot and be done with it. Last, variables should be well-named. Unless it's some loop-control variable you'll never use again, you should never name things with a single character. Always use more descriptive names.
Well lucky me, I hate writing code that doesn't do all those things

A question, I'm currently steering my CS study in the direction of lowlevel code+hardware design, how is the job availability in this field? I'm planning to do my minor in electrical engineering. I'd imagine that I'll have a better job prospect in this field than in software design (based on seeing the overwhelming majority of other students choose the highlevel route).
Slaytilost
Profile Joined October 2010
Netherlands968 Posts
Last Edited: 2011-10-11 19:35:42
October 11 2011 19:34 GMT
#1672
On October 12 2011 02:17 LionKiNG wrote:
Also another question is W3School certification worth its money or complete b/s?


Absolutely NOT. Although W3schools has its usefulness for beginners, its full of errors and is quite outdated. I dont believe their certification has any value at all.

See also: http://w3fools.com/
SRBNikola
Profile Blog Joined July 2011
Serbia191 Posts
October 11 2011 20:19 GMT
#1673
Another questions, what books would u recommend for mufti-platform C++ programming?
Quasimomo
Profile Joined October 2011
Netherlands4 Posts
Last Edited: 2011-10-11 21:00:44
October 11 2011 20:59 GMT
#1674
Hey guys

I've been busy with a project for school, and I've stumbled upon an error and was wondering how I could get rid of it.

Error message:

Exception in thread "main" java.lang.NullPointerException
at businessunits.BusinessUnitsApp.readSensorValue(BusinessUnitsApp.java:225)


(I'm working with Java in Netbeans)
SRBNikola
Profile Blog Joined July 2011
Serbia191 Posts
Last Edited: 2011-10-11 21:27:42
October 11 2011 21:25 GMT
#1675
On October 12 2011 05:59 Quasimomo wrote:
Hey guys

I've been busy with a project for school, and I've stumbled upon an error and was wondering how I could get rid of it.

Error message:

Exception in thread "main" java.lang.NullPointerException
at businessunits.BusinessUnitsApp.readSensorValue(BusinessUnitsApp.java:225)


(I'm working with Java in Netbeans)


I believe BusinessUnitsApp has null value in that case, and that is causing a problem, adding check before code will fix error however, not problem, you should try debugging and see why BusinessUnitsApp gets null value passed.

EDIT: Also sharing peace of code with us would greatly help us solve your problem
StockTheFridge
Profile Joined November 2010
United States12 Posts
Last Edited: 2011-10-11 21:54:38
October 11 2011 21:53 GMT
#1676
On October 12 2011 04:24 renox wrote:
Hey guys, same question from me in spoiler. Was wondering if anyone had any ideas because I'm still looking

+ Show Spoiler +
On October 05 2011 06:43 renox wrote:
Hey guys,

I'm currently a first year computer science student and I am in need of a job. What would you guys suggest I look for to benefit me in this field? Is there anything that I would even qualify for just being a first year student? Any and all advice would be lovely, share personal experiences of working during school etc.


On October 05 2011 08:05 renox wrote:
Show nested quote +
On October 05 2011 07:18 tofucake wrote:
Almost any work you'll get as a first year student will be bitch work and there's no way around it.

Is this going to be a job you do for school (co-op program) or just something you'll do in your spare time?

Well I need a job just to have money and for my expenses, but I was wondering if there was something I could do that would later be useful to me in some way in regards to this field. So I was wondering if you guys have had some luck like this or experience with it. I mean I could get some random job like most college students but I figured if I could tie it into the field I want to study somehow it would benefit me because I may find it interesting but also be an asset to my career down the road.



Your best bet might be a research position at the university. I worked in a lab that did posture prediction when I was in school and they hired a lot of undergrads for the user interfaces and testing because CS/Engineering students are smart and you can pay them much less than a grad student or professional. And its good for you because you get professional programming experience.
Quasimomo
Profile Joined October 2011
Netherlands4 Posts
Last Edited: 2011-10-11 22:04:51
October 11 2011 22:04 GMT
#1677
On October 12 2011 06:25 LionKiNG wrote:
Show nested quote +
On October 12 2011 05:59 Quasimomo wrote:
Hey guys

I've been busy with a project for school, and I've stumbled upon an error and was wondering how I could get rid of it.

Error message:

Exception in thread "main" java.lang.NullPointerException
at businessunits.BusinessUnitsApp.readSensorValue(BusinessUnitsApp.java:225)


(I'm working with Java in Netbeans)


I believe BusinessUnitsApp has null value in that case, and that is causing a problem, adding check before code will fix error however, not problem, you should try debugging and see why BusinessUnitsApp gets null value passed.

EDIT: Also sharing peace of code with us would greatly help us solve your problem


Hmmm... There is quite a bit of code. and the OP said I wasn't supposed to post a wall of text. Is there maybe another way to show you?

Maybe if I give some extra information about it:
I'm working with a GUI that launches when running and it's controlled by using several phidgets.
It's also linked with VLC player to start a movie at the start.
And the debug didn't help/work
SRBNikola
Profile Blog Joined July 2011
Serbia191 Posts
October 11 2011 22:06 GMT
#1678
On October 12 2011 07:04 Quasimomo wrote:
Show nested quote +
On October 12 2011 06:25 LionKiNG wrote:
On October 12 2011 05:59 Quasimomo wrote:
Hey guys

I've been busy with a project for school, and I've stumbled upon an error and was wondering how I could get rid of it.

Error message:

Exception in thread "main" java.lang.NullPointerException
at businessunits.BusinessUnitsApp.readSensorValue(BusinessUnitsApp.java:225)


(I'm working with Java in Netbeans)


I believe BusinessUnitsApp has null value in that case, and that is causing a problem, adding check before code will fix error however, not problem, you should try debugging and see why BusinessUnitsApp gets null value passed.

EDIT: Also sharing peace of code with us would greatly help us solve your problem


Hmmm... There is quite a bit of code. and the OP said I wasn't supposed to post a wall of text. Is there maybe another way to show you?

Maybe if I give some extra information about it:
I'm working with a GUI that launches when running and it's controlled by using several phidgets.
It's also linked with VLC player to start a movie at the start.
And the debug didn't help/work


Try putting it in spoilers
Quasimomo
Profile Joined October 2011
Netherlands4 Posts
October 11 2011 22:17 GMT
#1679
Derp! Of course hahaha xD

Here is the whole code that's causing the problems ( I think )
I'm working with a few other .java files. These include the GUI file and the file that takes care of linking vlc to java.

+ Show Spoiler +

package businessunits;

import com.phidgets.*;

import java.awt.AWTException;
import java.awt.Robot;
import java.awt.event.InputEvent;
import org.jdesktop.application.Application;
import org.jdesktop.application.SingleFrameApplication;



public class BusinessUnitsApp extends SingleFrameApplication {

@Override protected void startup() {
show(new BusinessUnitsView(this));
}

/**
* This method is to initialize the specified window by injecting resources.
* Windows shown in our application come fully initialized from the GUI
* builder, so this additional configuration is not needed.
*/
@Override protected void configureWindow(java.awt.Window root) {
}

/**
* A convenient static getter for the application instance.
* @return the instance of BusinessUnitsApp
*/
public static BusinessUnitsApp getApplication() {
return Application.getInstance(BusinessUnitsApp.class);
}

/**
* Main method launching the application.
*/

VLCv2 vlc = new VLCv2("localhost", 1234);
private Phidget phidget;
private BusinessUnitsView guiobj;
private InterfaceKitPhidget interf;

/**
* constructor van deze Main klasse, maak GUI aan en
* maak verbinding met VLC
*/


public long getsensor(int a) {
long sensor = readSensorValue(a);

return sensor;
}

public boolean getdeurbel() {
boolean deurbel = Inputstate(0);
return deurbel;

}

//Vanaf 120
public long StartMove() {

long sensor7 = readSensorValue(7);
return sensor7;

}

public boolean deurbel() {
while (true) {
try {
boolean deurbel = Inputstate(0);
Thread.sleep(250);
System.out.println(deurbel);
if (deurbel) {
return deurbel;
}
} catch (Exception e) {
e.printStackTrace();
}
}
}

public static void main(String[] args) throws InterruptedException {

launch(BusinessUnitsApp.class, args);

BusinessUnitsApp m = new BusinessUnitsApp();
VLCv2 vlc = new VLCv2("localhost", 1234);

vlc.connect();
vlc.rc.fullscreen();
vlc.rc.play();
vlc.rc.pause();

while (true) {
try {

Robot rob = new Robot();
Thread.sleep(250);
long sensor7 = m.StartMove();


if (sensor7 >= 70) {
vlc.rc.play();

for (int i = 0; i <= 110; i++) {
Thread.sleep(1000);
System.out.println(i);
if (i == 110) {
vlc.rc.pause();
}
}
}

if (m.getsensor(0) < 100) {
rob.mouseMove(1550, 340);
rob.mousePress(InputEvent.BUTTON1_MASK);
rob.mouseRelease(InputEvent.BUTTON1_MASK);

}

if (m.getsensor(1) < 100) {
rob.mouseMove(1550, 410);
rob.mousePress(InputEvent.BUTTON1_MASK);
rob.mouseRelease(InputEvent.BUTTON1_MASK);

}

if (m.getsensor(2) < 100) {
rob.mouseMove(1550, 470);
rob.mousePress(InputEvent.BUTTON1_MASK);
rob.mouseRelease(InputEvent.BUTTON1_MASK);

}

if (m.getsensor(3) < 100) {
rob.mouseMove(1550, 535);
rob.mousePress(InputEvent.BUTTON1_MASK);
rob.mouseRelease(InputEvent.BUTTON1_MASK);

}

if (m.getsensor(4) < 100) {
rob.mouseMove(1550, 600);
rob.mousePress(InputEvent.BUTTON1_MASK);
rob.mouseRelease(InputEvent.BUTTON1_MASK);

}

if (m.getsensor(5) < 100) {
rob.mouseMove(1550, 650);
rob.mousePress(InputEvent.BUTTON1_MASK);
rob.mouseRelease(InputEvent.BUTTON1_MASK);

}

if (m.getdeurbel()) {
vlc.rc.play();

for (int a = 0; a <= 126; a++) {
Thread.sleep(1000);
System.out.print(a + " ");

if (a == 44) {
vlc.rc.pause();
while (true) {
try {
boolean deurbel = m.deurbel();
if (deurbel == true) {
vlc.rc.play();
break;
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
if (a == 126){
vlc.rc.pause();
}
}

}

} catch (AWTException e) {
e.printStackTrace();
}
}
}


public void makeConnection() {

try {
//interf.openAny("localhost", 5001); // alleen voor webservice-versie
interf.openAny(); // werkt ook zonder webservice
interf.waitForAttachment(1000); // 1 sec, anders exception
} catch (PhidgetException e) {
e.printStackTrace();
}
}// end of phidgetmakeConnection()
//public native boolean getInputState(int i) throws PhidgetException;

public boolean Inputstate(int nr) {
boolean value = false;
try {
value = interf.getInputState(nr);
} catch (PhidgetException e) {
e.printStackTrace();
}
return value;

}

public long readSensorValue(int nr) {
long value = -1;
try {
value = interf.getSensorValue(nr);
} catch (PhidgetException e) {
e.printStackTrace();
}
return value;
}

public void setOutputValue(int nr, Boolean state) {
try {
interf.setOutputState(nr, state);
} catch (PhidgetException e) {
e.printStackTrace();
}
}
}


Ripense
Profile Joined August 2010
Austria23 Posts
October 11 2011 22:47 GMT
#1680
On October 12 2011 07:17 Quasimomo wrote:
Derp! Of course hahaha xD

Here is the whole code that's causing the problems ( I think )
I'm working with a few other .java files. These include the GUI file and the file that takes care of linking vlc to java.

+ Show Spoiler +

package businessunits;

import com.phidgets.*;

import java.awt.AWTException;
import java.awt.Robot;
import java.awt.event.InputEvent;
import org.jdesktop.application.Application;
import org.jdesktop.application.SingleFrameApplication;



public class BusinessUnitsApp extends SingleFrameApplication {

@Override protected void startup() {
show(new BusinessUnitsView(this));
}

/**
* This method is to initialize the specified window by injecting resources.
* Windows shown in our application come fully initialized from the GUI
* builder, so this additional configuration is not needed.
*/
@Override protected void configureWindow(java.awt.Window root) {
}

/**
* A convenient static getter for the application instance.
* @return the instance of BusinessUnitsApp
*/
public static BusinessUnitsApp getApplication() {
return Application.getInstance(BusinessUnitsApp.class);
}

/**
* Main method launching the application.
*/

VLCv2 vlc = new VLCv2("localhost", 1234);
private Phidget phidget;
private BusinessUnitsView guiobj;
private InterfaceKitPhidget interf;

/**
* constructor van deze Main klasse, maak GUI aan en
* maak verbinding met VLC
*/


public long getsensor(int a) {
long sensor = readSensorValue(a);

return sensor;
}

public boolean getdeurbel() {
boolean deurbel = Inputstate(0);
return deurbel;

}

//Vanaf 120
public long StartMove() {

long sensor7 = readSensorValue(7);
return sensor7;

}

public boolean deurbel() {
while (true) {
try {
boolean deurbel = Inputstate(0);
Thread.sleep(250);
System.out.println(deurbel);
if (deurbel) {
return deurbel;
}
} catch (Exception e) {
e.printStackTrace();
}
}
}

public static void main(String[] args) throws InterruptedException {

launch(BusinessUnitsApp.class, args);

BusinessUnitsApp m = new BusinessUnitsApp();
VLCv2 vlc = new VLCv2("localhost", 1234);

vlc.connect();
vlc.rc.fullscreen();
vlc.rc.play();
vlc.rc.pause();

while (true) {
try {

Robot rob = new Robot();
Thread.sleep(250);
long sensor7 = m.StartMove();


if (sensor7 >= 70) {
vlc.rc.play();

for (int i = 0; i <= 110; i++) {
Thread.sleep(1000);
System.out.println(i);
if (i == 110) {
vlc.rc.pause();
}
}
}

if (m.getsensor(0) < 100) {
rob.mouseMove(1550, 340);
rob.mousePress(InputEvent.BUTTON1_MASK);
rob.mouseRelease(InputEvent.BUTTON1_MASK);

}

if (m.getsensor(1) < 100) {
rob.mouseMove(1550, 410);
rob.mousePress(InputEvent.BUTTON1_MASK);
rob.mouseRelease(InputEvent.BUTTON1_MASK);

}

if (m.getsensor(2) < 100) {
rob.mouseMove(1550, 470);
rob.mousePress(InputEvent.BUTTON1_MASK);
rob.mouseRelease(InputEvent.BUTTON1_MASK);

}

if (m.getsensor(3) < 100) {
rob.mouseMove(1550, 535);
rob.mousePress(InputEvent.BUTTON1_MASK);
rob.mouseRelease(InputEvent.BUTTON1_MASK);

}

if (m.getsensor(4) < 100) {
rob.mouseMove(1550, 600);
rob.mousePress(InputEvent.BUTTON1_MASK);
rob.mouseRelease(InputEvent.BUTTON1_MASK);

}

if (m.getsensor(5) < 100) {
rob.mouseMove(1550, 650);
rob.mousePress(InputEvent.BUTTON1_MASK);
rob.mouseRelease(InputEvent.BUTTON1_MASK);

}

if (m.getdeurbel()) {
vlc.rc.play();

for (int a = 0; a <= 126; a++) {
Thread.sleep(1000);
System.out.print(a + " ");

if (a == 44) {
vlc.rc.pause();
while (true) {
try {
boolean deurbel = m.deurbel();
if (deurbel == true) {
vlc.rc.play();
break;
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
if (a == 126){
vlc.rc.pause();
}
}

}

} catch (AWTException e) {
e.printStackTrace();
}
}
}


public void makeConnection() {

try {
//interf.openAny("localhost", 5001); // alleen voor webservice-versie
interf.openAny(); // werkt ook zonder webservice
interf.waitForAttachment(1000); // 1 sec, anders exception
} catch (PhidgetException e) {
e.printStackTrace();
}
}// end of phidgetmakeConnection()
//public native boolean getInputState(int i) throws PhidgetException;

public boolean Inputstate(int nr) {
boolean value = false;
try {
value = interf.getInputState(nr);
} catch (PhidgetException e) {
e.printStackTrace();
}
return value;

}

public long readSensorValue(int nr) {
long value = -1;
try {
value = interf.getSensorValue(nr);
} catch (PhidgetException e) {
e.printStackTrace();
}
return value;
}

public void setOutputValue(int nr, Boolean state) {
try {
interf.setOutputState(nr, state);
} catch (PhidgetException e) {
e.printStackTrace();
}
}
}




As far as I can see you call the method getSensorValue on the interf variable which is no initialized and therefore throws a NullpointerException. You need to do something like inter = new InterfaceKitPhidget(); before calling methods on it.
Prev 1 82 83 84 85 86 1032 Next
Please log in or register to reply.
Live Events Refresh
Next event in 8m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
ProTech130
StarCraft: Brood War
Calm 1888
Light 204
Killer 199
Zeus 157
BeSt 126
Hyuk 117
Soulkey 92
Dewaltoss 75
Mong 73
ToSsGirL 65
[ Show more ]
ggaemo 54
Hyun 53
910 43
ZerO 42
Backho 39
Hm[arnc] 36
Rush 36
Sharp 36
Liquid`Ret 32
hero 28
Shinee 24
sorry 21
soO 18
Bale 14
Free 13
Sacsri 9
Terrorterran 9
NotJumperer 9
GoRush 7
Dota 2
monkeys_forever192
NeuroSwarm94
Counter-Strike
zeus595
allub233
edward79
Other Games
gofns20868
singsing1394
ceh9640
WinterStarcraft307
DeMusliM181
KnowMe118
Mew2King90
B2W.Neo37
ZerO(Twitch)6
Organizations
Other Games
gamesdonequick1085
StarCraft: Brood War
lovetv 4
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
[ Show 17 non-featured ]
StarCraft 2
• LUISG 42
• Adnapsc2 3
• Kozan
• AfreecaTV YouTube
• sooper7s
• intothetv
• Migwel
• IndyKCrew
• LaughNgamezSOOP
StarCraft: Brood War
• iopq 2
• escodisco1
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
League of Legends
• TFBlade907
• Stunt597
Other Games
• WagamamaTV111
Upcoming Events
Escore
8m
The PondCast
8m
WardiTV Invitational
1h 8m
Zoun vs Ryung
Lambo vs ShoWTimE
Big Brain Bouts
6h 8m
Fjant vs Bly
Serral vs Shameless
OSC
12h 8m
The PiG Daily
13h 8m
Maru vs Rogue
TBD vs Classic
herO vs Solar
ByuN vs Solar
Replay Cast
14h 8m
CranKy Ducklings
1d
RSL Revival
1d
SHIN vs Bunny
ByuN vs Shameless
WardiTV Invitational
1d 1h
Krystianer vs TriGGeR
Cure vs Rogue
[ Show More ]
SC Evo League
1d 3h
uThermal 2v2 Circuit
1d 5h
BSL
1d 9h
Artosis vs TerrOr
spx vs StRyKeR
Replay Cast
1d 14h
Sparkling Tuna Cup
2 days
RSL Revival
2 days
Cure vs Zoun
Clem vs Lambo
WardiTV Invitational
2 days
BSL
2 days
Dewalt vs DragOn
Aether vs Jimin
GSL
2 days
Afreeca Starleague
3 days
Soma vs Leta
Wardi Open
3 days
Monday Night Weeklies
3 days
OSC
3 days
CranKy Ducklings
4 days
Afreeca Starleague
4 days
Light vs Flash
Replay Cast
4 days
Replay Cast
5 days
The PondCast
6 days
Replay Cast
6 days
Liquipedia Results

Completed

Proleague 2026-05-05
WardiTV TLMC #16
Nations Cup 2026

Ongoing

BSL Season 22
ASL Season 21
CSL 2026 SPRING (S20)
IPSL Spring 2026
KCM Race Survival 2026 Season 2
Acropolis #4
Escore Tournament S2: W6
SCTL 2026 Spring
RSL Revival: Season 5
2026 GSL S1
BLAST Rivals Spring 2026
IEM Rio 2026
PGL Bucharest 2026
Stake Ranked Episode 1
BLAST Open Spring 2026
ESL Pro League S23 Finals
ESL Pro League S23 Stage 1&2

Upcoming

KK 2v2 League Season 1
BSL 22 Non-Korean Championship
YSL S3
Escore Tournament S2: W7
Escore Tournament S2: W8
CSLAN 4
Kung Fu Cup 2026 Grand Finals
HSC XXIX
uThermal 2v2 2026 Main Event
Maestros of the Game 2
2026 GSL S2
BLAST Bounty Summer 2026: Closed Qualifier
Stake Ranked Episode 3
XSE Pro League 2026
IEM Cologne Major 2026
Stake Ranked Episode 2
CS Asia Championships 2026
IEM Atlanta 2026
Asian Champions League 2026
PGL Astana 2026
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2026 TLnet. All Rights Reserved.