• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 00:20
CEST 06:20
KST 13:20
  • 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 Preview4[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
Quality of life changes in BW that you will like ? Tulbo's ASL S21 Ro8 Post-Review Why there arent any 256x256 pro maps? Do we have a pimpest plays list? BGH Auto Balance -> http://bghmmr.eu/
Tourneys
[ASL21] Ro8 Day 4 [Megathread] Daily Proleagues Escore Tournament StarCraft Season 2 Small VOD Thread 2.0
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 Daigo vs Menard Best of 10 Path of Exile Nintendo Switch Thread OutLive 25 (RTS Game)
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
US Politics Mega-thread European Politico-economics QA Mega-thread UK Politics Mega-thread The Letting Off Steam Thread Canadian Politics Mega-thread
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: 1509 users

The Big Programming Thread - Page 613

Forum Index > General Forum
Post a Reply
Prev 1 611 612 613 614 615 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.
FFGenerations
Profile Blog Joined April 2011
7088 Posts
Last Edited: 2015-04-14 23:49:04
April 14 2015 22:42 GMT
#12241
hi guys

got like 5 days to do my project now

i'm momentarily stuck trying to figure out this:
+ Show Spoiler +

long version
+ Show Spoiler +

i make a get request for movie information and store the response in an object

the response might contain multiple movies, coz if you search for "alien" you'll get several movies returned in the xml

so my movie (actually anime) class is autogenerated by jaxb from an xsd (xml) schema that i got just by making a search and saving the xml response

i want to be able to say


make the search request to the anime API

save the response into an object

extract each anime title from the object and print them to screen


this is REALLY simple but i don't know how to get the anime titles from the object .

the data is it is saved as a LIST so saying printscreen (getanime.name) doesnt work

short/detail version
+ Show Spoiler +

my object class has this
public List<Object> getAnimeOrManga() {
if (animeOrManga == null) {
animeOrManga = new ArrayList<Object>();
}
return this.animeOrManga;
}


and this

public String getName() {
return name;
}


i want to do something like:

for each animeOrManga
print the name of that animeormanga



i'll keep trying to read about lists

update: i changed it to + Show Spoiler +


for (Iterator<Object> i = gt.fetchMovie().getAnimeOrManga().iterator(); i.hasNext();){
String name = i.getClass().getName();
System.out.println(name);
System.out.println("Hello, World");

}

all the red shit went away but nothing happens when it runs

+ Show Spoiler +


System.out.println (gt.fetchMovie().getAnimeOrManga().getClass().getName());

and getting run:
java.util.ArrayList
BUILD SUCCESSFUL (total time: 2 seconds)

which looks like progress. actually the getClass().getName() is rubbish


ok so the structure of the Ann class contains

public class Ann {

protected List<Object> animeOrManga;

public List<Object> getAnimeOrManga() {
if (animeOrManga == null) {
animeOrManga = new ArrayList<Object>();
}
return this.animeOrManga;
}

public String getName() {
return name;
}


i need to find out how to access the getName()

i found i can write List<Ann.Anime.Info.Img> images; without it going red....
Cool BW Music Vid - youtube.com/watch?v=W54nlqJ-Nx8 ~~~~~ ᕤ OYSTERS ᕤ CLAMS ᕤ AND ᕤ CUCKOLDS ᕤ ~~~~~~ ༼ ᕤ◕◡◕ ༽ᕤ PUNCH HIM ༼ ᕤ◕◡◕ ༽ᕤ
zzdd
Profile Joined December 2010
United States484 Posts
April 14 2015 22:59 GMT
#12242
On April 15 2015 07:42 FFGenerations wrote:
hi guys

got like 5 days to do my project now

i'm momentarily stuck trying to figure out this:

long version
+ Show Spoiler +

i make a get request for movie information and store the response in an object

the response might contain multiple movies, coz if you search for "alien" you'll get several movies returned in the xml

so my movie (actually anime) class is autogenerated by jaxb from an xsd (xml) schema that i got just by making a search and saving the xml response

i want to be able to say


make the search request to the anime API

save the response into an object

extract each anime title from the object and print them to screen


this is REALLY simple but i don't know how to get the anime titles from the object .

the data is it is saved as a LIST so saying printscreen (getanime.name) doesnt work

short/detail version
+ Show Spoiler +

my object class has this
public List<Object> getAnimeOrManga() {
if (animeOrManga == null) {
animeOrManga = new ArrayList<Object>();
}
return this.animeOrManga;
}


and this

public String getName() {
return name;
}


i want to do something like:

for each animeOrManga
print the name of that animeormanga



i'll keep trying to read about lists

https://docs.oracle.com/javase/7/docs/api/java/util/ListIterator.html
Shield
Profile Blog Joined August 2009
Bulgaria4824 Posts
Last Edited: 2015-04-15 00:20:20
April 15 2015 00:18 GMT
#12243
On April 15 2015 07:42 FFGenerations wrote:
hi guys

got like 5 days to do my project now

i'm momentarily stuck trying to figure out this:
+ Show Spoiler +

long version
+ Show Spoiler +

i make a get request for movie information and store the response in an object

the response might contain multiple movies, coz if you search for "alien" you'll get several movies returned in the xml

so my movie (actually anime) class is autogenerated by jaxb from an xsd (xml) schema that i got just by making a search and saving the xml response

i want to be able to say


make the search request to the anime API

save the response into an object

extract each anime title from the object and print them to screen


this is REALLY simple but i don't know how to get the anime titles from the object .

the data is it is saved as a LIST so saying printscreen (getanime.name) doesnt work

short/detail version
+ Show Spoiler +

my object class has this
public List<Object> getAnimeOrManga() {
if (animeOrManga == null) {
animeOrManga = new ArrayList<Object>();
}
return this.animeOrManga;
}


and this

public String getName() {
return name;
}


i want to do something like:

for each animeOrManga
print the name of that animeormanga



i'll keep trying to read about lists

update: i changed it to + Show Spoiler +


for (Iterator<Object> i = gt.fetchMovie().getAnimeOrManga().iterator(); i.hasNext(){
String name = i.getClass().getName();
System.out.println(name);
System.out.println("Hello, World");

}

all the red shit went away but nothing happens when it runs

+ Show Spoiler +


System.out.println (gt.fetchMovie().getAnimeOrManga().getClass().getName());

and getting run:
java.util.ArrayList
BUILD SUCCESSFUL (total time: 2 seconds)

which looks like progress. actually the getClass().getName() is rubbish


ok so the structure of the Ann class contains

public class Ann {

protected List<Object> animeOrManga;

public List<Object> getAnimeOrManga() {
if (animeOrManga == null) {
animeOrManga = new ArrayList<Object>();
}
return this.animeOrManga;
}

public String getName() {
return name;
}


i need to find out how to access the getName()

i found i can write List<Ann.Anime.Info.Img> images; without it going red....


Just use neat syntax instead of iterators.


for (Class obj : list)
{
obj.method(); // or whatever thing you need to do with obj
}


Thoughts:

1. List<Object> is incredibly stupid. You should use a common interface/base class instead.
2. Don't abuse lazy initialisation pattern. It doesn't help you here.
FFGenerations
Profile Blog Joined April 2011
7088 Posts
Last Edited: 2015-04-15 00:43:13
April 15 2015 00:33 GMT
#12244
thanks dude

1. the Ann class is autogenerated by jaxb xml binder which turned the xml into a java class automatically .

the generated Ann class is literally 4000 lines

if i knew how to take an xml file and just parse and extract just the values i want from it (i only want anime title and the url to the anime image) that might simplify things. right now i just done it by autogenerating it with the tool. the xml response gets put into the Ann class and i can access the properties of it from there , however now i am trying to access them through lists since i changed it to receive multiple animes instead of just 1

for example take an xml file with a ton of different elements. i want to extract data from only 2!!! of those elements. do i parse the whole thing into an object and access the elements i want? it sounds simple that way but it leaves me with this problem of not knowing ....how to access data the data .... which also should be straight forward as shit

its just impossible to find any fucking examples of anything that i want to do , and i'm not bright enough to just "figure stuff out". i sit here 90 minutes now ? and all i've "discovered" is that you can write "List<Ann.Anime.Info.Img> anime = new ArrayList<>();" and it doesnt turn red (but says the collection is never added to). let alone try to make a for loop that reads it (for (int i = 0; i < Ann.Anime.Info.Img; i++) { = cannot find symbol). etc

2. no idea what that means i guess i'll google.

as far as i know all i want to do is print the getter of the members of the animeOrManga list contained in the Ann class that i have just fetched

will take a break and get back to it

edit: might get somewhere with
    Object[] animestuff = gt.fetchMovie().getAnimeOrManga().toArray();

System.out.println(animestuff);

taking abreak
Cool BW Music Vid - youtube.com/watch?v=W54nlqJ-Nx8 ~~~~~ ᕤ OYSTERS ᕤ CLAMS ᕤ AND ᕤ CUCKOLDS ᕤ ~~~~~~ ༼ ᕤ◕◡◕ ༽ᕤ PUNCH HIM ༼ ᕤ◕◡◕ ༽ᕤ
Shield
Profile Blog Joined August 2009
Bulgaria4824 Posts
Last Edited: 2015-04-15 00:47:41
April 15 2015 00:41 GMT
#12245
On April 15 2015 09:33 FFGenerations wrote:
thanks dude

1. the Ann class is autogenerated by jaxb xml binder which turned the xml into a java class automatically .

the generated Ann class is literally 4000 lines

if i knew how to take an xml file and just parse and extract just the values i want from it (i only want anime title and the url to the anime image) that might simplify things. right now i just done it by autogenerating it with the tool. the xml response gets put into the Ann class and i can access the properties of it from there , however now i am trying to access them through lists since i changed it to receive multiple animes instead of just 1

for example take an xml file with a ton of different elements. i want to extract data from only 2!!! of those elements. do i parse the whole thing into an object and access the elements i want? it sounds simple that way but it leaves me with this problem of not knowing ....how to access data the data .... which also should be straight forward as shit

its just impossible to find any fucking examples of anything that i want to do , and i'm not bright enough to just "figure stuff out". i sit here 90 minutes now ? and all i've "discovered" is that you can write "List<Ann.Anime.Info.Img> anime = new ArrayList<>();" and it doesnt turn red (but says the collection is never added to). let alone try to make a for loop that reads it (for (int i = 0; i < Ann.Anime.Info.Img; i++) { = cannot find symbol). etc

2. no idea what that means i guess i'll google.

as far as i know all i want to do is print the getter of the members of the animeOrManga list contained in the Ann class that i have just fetched

will take a break and get back to it


The reason it doesn't turn red is because List<?> expects a class. If you replace ? with a class, then it's fine. List is just an interface for Java containers such as ArrayList and LinkedList.

You have a few ways to access its data.

1. Iterators

2. For-ranged loop. Say you have:

List<Integer> list = new ArrayList<Integer>();



for (Integer entry : list)
{
System.out.println(entry);
}


3. Random access


for (int i = 0; i < list.size(); ++i)
{
Integer entry = list.get(i);
System.out.println(entry);
}


Lazy initialisation is what you're doing with list's initialisation. You only initialise it on demand, but you don't improve performance noticeably enough as it is a cheap enough operation anyway.


edit: might get somewhere with
    Object[] animestuff = gt.fetchMovie().getAnimeOrManga().toArray();

System.out.println(animestuff);

taking abreak


You can use the for-ranged loop approach.


for (Object entry : animestuff)
{
System.out.println("Useless object type as you can't use its methods.");
}
FFGenerations
Profile Blog Joined April 2011
7088 Posts
Last Edited: 2015-04-15 03:24:46
April 15 2015 03:19 GMT
#12246
how do i refer to it so that the methods are available?

so far i have....


Object[] list = gt.fetchMovie().getAnimeOrManga().toArray();
System.out.println(list);

this prints : [Ljava.lang.Object;@4b2c5e02



Object[] list = gt.fetchMovie().getAnimeOrManga().toArray();
// System.out.println(list);
for (Object item: list){
System.out.println(item);

this does nothing


List<Object> animeOrManga = gt.fetchMovie().getAnimeOrManga();

for (Object item: animeOrManga){
System.out.println(item);
}

this does nothing too

i want to be able to put item.getName(); somewhere, right? but this is never available or even come close to finding it....

i posted on stack overflow now http://stackoverflow.com/questions/29640606/accessing-a-list-in-a-java-object

someone said make another class and put in the name attribute there and someone said clone the list , the 3rd person said go read a book (great)
Cool BW Music Vid - youtube.com/watch?v=W54nlqJ-Nx8 ~~~~~ ᕤ OYSTERS ᕤ CLAMS ᕤ AND ᕤ CUCKOLDS ᕤ ~~~~~~ ༼ ᕤ◕◡◕ ༽ᕤ PUNCH HIM ༼ ᕤ◕◡◕ ༽ᕤ
WolfintheSheep
Profile Joined June 2011
Canada14127 Posts
April 15 2015 03:27 GMT
#12247
The List you're using is a collection of generic Object types. Object does not have a name variable, or a getName method.

You need to define a class (let's call it AnimeOrManga), give it a name variable, give it a public method getName() to return the name, and then declare your collection as List<AnimeOrManga>.
Average means I'm better than half of you.
FFGenerations
Profile Blog Joined April 2011
7088 Posts
Last Edited: 2015-04-15 03:38:48
April 15 2015 03:35 GMT
#12248
the class exists already...

gt().fetchMovie() saves the GET request data into the Ann class
public Ann fetchMovie() {

return target.queryParam("kon")
.request(MediaType.TEXT_HTML)
.header("Content-type", "text/html")//application_json or text_html or xml
.get(Ann.class);

this works so far.

the Ann class contains , from what i can gather, a list
 public List<Object> getAnimeOrManga() {
if (animeOrManga == null) {
animeOrManga = new ArrayList<Object>();
}
return this.animeOrManga;
}


the list can contains a class Anime and a class Manga


public static class Anime {


class Anime contains string name (and stuff like List Info) and the setters and getters

   public String getName() {
return name;
}


i just need some syntax to get to getName(); after i call gt.fetchMovie().something()

[image loading]

is this making more sense to you than it does to me?
Cool BW Music Vid - youtube.com/watch?v=W54nlqJ-Nx8 ~~~~~ ᕤ OYSTERS ᕤ CLAMS ᕤ AND ᕤ CUCKOLDS ᕤ ~~~~~~ ༼ ᕤ◕◡◕ ༽ᕤ PUNCH HIM ༼ ᕤ◕◡◕ ༽ᕤ
Blitzkrieg0
Profile Blog Joined August 2010
United States13132 Posts
Last Edited: 2015-04-15 03:47:26
April 15 2015 03:45 GMT
#12249
You want to use inheritance. You can read about it here

Anime and Manga should be a subclass of Ann I assume, but I have no idea what Ann actually is.
I'll always be your shadow and veil your eyes from states of ain soph aur.
WolfintheSheep
Profile Joined June 2011
Canada14127 Posts
April 15 2015 03:51 GMT
#12250
It makes...some sense.

One, I don't see where the List is being filled with classes. I'm assuming you just didn't post that part. If not...well, that's a major point right there.

The fact that there's an Anime class and a Manga class is rather critical, since now you have a List of two objects. If you want that, you need a parent class (let's call it Media) which Anime and Manga inherit from, and that parent class should have the "name" variable and "getName()" method. Then your List should be of type List<Media>.
Average means I'm better than half of you.
FFGenerations
Profile Blog Joined April 2011
7088 Posts
Last Edited: 2015-04-15 03:57:44
April 15 2015 03:54 GMT
#12251
Ann is the autogenerated .java class that stores the XML data as a java class

I took a sample XML response from making a search on the anime website , converted it to XSD then netbeans automatically created a java class from it

its just a huge fucking class that contains all the attributes of the XML file (anime name, type, info etc, some of these are lists)

this is Ann

http://pastebin.com/zzpbY6Sg

this is JavaApplication4 (the run file)

http://pastebin.com/SaGH3gdF

this is the web service gt/getservice

http://pastebin.com/5ePcZVi3
Cool BW Music Vid - youtube.com/watch?v=W54nlqJ-Nx8 ~~~~~ ᕤ OYSTERS ᕤ CLAMS ᕤ AND ᕤ CUCKOLDS ᕤ ~~~~~~ ༼ ᕤ◕◡◕ ༽ᕤ PUNCH HIM ༼ ᕤ◕◡◕ ༽ᕤ
WolfintheSheep
Profile Joined June 2011
Canada14127 Posts
April 15 2015 03:57 GMT
#12252
On April 15 2015 12:54 FFGenerations wrote:
Ann is the autogenerated .java class that stores the XML data as a java class

I took a sample XML response from making a search on the anime website , converted it to XSD then netbeans automatically created a java class from it

its just a huge fucking class that contains all the attributes of the XML file (anime name, type, info etc, some of these are lists)

Well, in that case it's basically glhf for you.

Autogenerated code is generally a mess to go through, so really the choices are to go through the documentation to get what you want out of it, or do it from scratch so that you know what you have.
Average means I'm better than half of you.
Blitzkrieg0
Profile Blog Joined August 2010
United States13132 Posts
April 15 2015 03:58 GMT
#12253
On April 15 2015 12:54 FFGenerations wrote:
Ann is the autogenerated .java class that stores the XML data as a java class

I took a sample XML response from making a search on the anime website , converted it to XSD then netbeans automatically created a java class from it

its just a huge fucking class that contains all the attributes of the XML file (anime name, type, info etc, some of these are lists)

this is Ann

http://pastebin.com/zzpbY6Sg

this is JavaApplication4 (the run file)

http://pastebin.com/SaGH3gdF

this is the web service gt/getservice

http://pastebin.com/5ePcZVi3


So you auto generated a bunch of code and you have no idea what it does. Good luck.
I'll always be your shadow and veil your eyes from states of ain soph aur.
FFGenerations
Profile Blog Joined April 2011
7088 Posts
Last Edited: 2015-04-15 04:13:03
April 15 2015 04:07 GMT
#12254
its simply a java class of an xml file, i just dont know the syntax to access the lists inside it . it shouldnt be particularly challenging thing to do theoretically

i'm gonna look at ways to custom parse the xml file so i'm only dealing with the data i want, although i fear that data would still be structured in the same way and i might end up with the same problem

if i can take the xml response and use a parser to only extract the <anime name> tag and <info type=Picture> portions then that would be just dandy ( i guess)
Cool BW Music Vid - youtube.com/watch?v=W54nlqJ-Nx8 ~~~~~ ᕤ OYSTERS ᕤ CLAMS ᕤ AND ᕤ CUCKOLDS ᕤ ~~~~~~ ༼ ᕤ◕◡◕ ༽ᕤ PUNCH HIM ༼ ᕤ◕◡◕ ༽ᕤ
Blitzkrieg0
Profile Blog Joined August 2010
United States13132 Posts
Last Edited: 2015-04-15 04:31:49
April 15 2015 04:14 GMT
#12255
On April 15 2015 13:07 FFGenerations wrote:
its simply a java class of an xml file, i just dont know the syntax to access the lists inside it . it shouldnt be particularly challenging thing to do theoretically


You have to go in and manually change a bunch of the code if you want it to work and this is going to be impossible since you have no idea what it generated. For example, it has an ArrayList of Objects. This needs to be an ArrayList of say Media as WolfInTheSheep suggested. Then you need to add the Media class and make the other classes subclasses of the Media class. Soon you're going to have an exponential cascade of bandaids to the point where you're better off just rewriting the class so it only has exactly what you need instead of fixing four thousand lines of auto generation.

Did you even read the code you're using? There is a comment in the code you pasted that tells you what to do already...
// List<Ann> list = new ArrayList<>(); // You want the list as specific as possible


The list being as specific as possible means changing the generic of the ArrayList. Even if your XML worked you'd still be printing garbage because of this.
I'll always be your shadow and veil your eyes from states of ain soph aur.
WolfintheSheep
Profile Joined June 2011
Canada14127 Posts
April 15 2015 04:20 GMT
#12256
On April 15 2015 13:07 FFGenerations wrote:
its simply a java class of an xml file, i just dont know the syntax to access the lists inside it . it shouldnt be particularly challenging thing to do theoretically

Well, your problem still comes down to the same thing. Your autogenerated code defines two completely separate classes, Anime and Manga, and it shoves it all into a single List that can contain any generic Object type.

So you either need to edit the code (which looks like it'll be a pain), try working from scratch (which is really advisable), or do something really ugly like:

for (Object item: animeOrManga){
if(item instanceof Anime){
Anime a = (Anime) item;
System.out.println(a.getName());
}elseif(item instanceof Manga){
Manga m = (Manga) item;
System.out.println(m.getName());
}
}


Do note that if you use the latter option, I will probably feel the need to punch you through your computer screen.
Average means I'm better than half of you.
FFGenerations
Profile Blog Joined April 2011
7088 Posts
Last Edited: 2015-04-15 05:52:50
April 15 2015 04:41 GMT
#12257
wow that actually fucking worked, after i figured out that my queryparamter for the get request was blank for some reason so nothings being returned this whole time anyway

ok so another method is :


Object[] list = gt.fetchMovie().getAnimeOrManga().toArray();

for (Object item: list){
System.out.println(item.toString());


and to override the toString() method in the class to make it do something different


public String getName() {
return name;
}
@Override
public String toString() {
return name;
}



edit:

ok well i've given up trying to make it work this way for now. i sort of understand what you've been saying earlier about the autogenerated thing being fucked up. what you wrote totally flew over my head before, but you kept railing on about it until i started to understand. thanks all, you've been brilliant!

will move on to trying to parse it myself instead
Cool BW Music Vid - youtube.com/watch?v=W54nlqJ-Nx8 ~~~~~ ᕤ OYSTERS ᕤ CLAMS ᕤ AND ᕤ CUCKOLDS ᕤ ~~~~~~ ༼ ᕤ◕◡◕ ༽ᕤ PUNCH HIM ༼ ᕤ◕◡◕ ༽ᕤ
sabas123
Profile Blog Joined December 2010
Netherlands3122 Posts
April 15 2015 07:32 GMT
#12258
On April 15 2015 06:25 Manit0u wrote:
You're calling $roomlist->getRoom(1) but you're not binding it to any variable, so every time you call $roomlist it creates a new room instance (At least that's what it looks like).

What you need to do is this:


$room = $roomlist->getRoom(1);

$room->setClients('some value');

$test = $room->getClients();
$test2 = $room->getClients();


Tell me if it works.

That code did work, So I geuss it has to do somethign with the getRoom function. sadly I don't understand why it would constantly give a new array. considering the new array should be stored in $system->getRoomList()
The harder it becomes, the more you should focus on the basics.
sabas123
Profile Blog Joined December 2010
Netherlands3122 Posts
April 15 2015 07:54 GMT
#12259
Ok I fixed it, I wrote a function that would check if the array had NULL, but something went wrong and always returned false. thus always making a new array.
The harder it becomes, the more you should focus on the basics.
Manit0u
Profile Blog Joined August 2004
Poland17743 Posts
April 15 2015 10:14 GMT
#12260
On April 15 2015 16:32 sabas123 wrote:
Show nested quote +
On April 15 2015 06:25 Manit0u wrote:
You're calling $roomlist->getRoom(1) but you're not binding it to any variable, so every time you call $roomlist it creates a new room instance (At least that's what it looks like).

What you need to do is this:


$room = $roomlist->getRoom(1);

$room->setClients('some value');

$test = $room->getClients();
$test2 = $room->getClients();


Tell me if it works.

That code did work, So I geuss it has to do somethign with the getRoom function. sadly I don't understand why it would constantly give a new array. considering the new array should be stored in $system->getRoomList()


There's nothing wrong with the getRoom function. What was wrong was calling it twice since each call to getRoom would create a new instance of the class. At least that's what I gather from the behaviour you described.
Time is precious. Waste it wisely.
Prev 1 611 612 613 614 615 1032 Next
Please log in or register to reply.
Live Events Refresh
Replay Cast
00:00
2026 GSL S1: Ro8 Group A
EnkiAlexander 79
Liquipedia
OSC
22:00
OSC Elite Rising Star #19
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
NeuroSwarm 377
RuFF_SC2 195
StarCraft: Brood War
Noble 12
Icarus 4
ZergMaN 3
Dota 2
monkeys_forever596
League of Legends
JimRising 589
Counter-Strike
Doublelift1852
Super Smash Bros
hungrybox1062
Other Games
summit1g6463
C9.Mang0548
WinterStarcraft404
ViBE109
Nina52
Organizations
Other Games
gamesdonequick2138
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
[ Show 13 non-featured ]
StarCraft 2
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• Azhi_Dahaki29
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Lourlo730
• Stunt272
Upcoming Events
CranKy Ducklings
5h 40m
RSL Revival
5h 40m
SHIN vs Bunny
ByuN vs Shameless
WardiTV Invitational
6h 40m
Krystianer vs TriGGeR
Cure vs Rogue
SC Evo League
8h 40m
uThermal 2v2 Circuit
10h 40m
BSL
14h 40m
Artosis vs TerrOr
spx vs StRyKeR
Replay Cast
19h 40m
Sparkling Tuna Cup
1d 5h
RSL Revival
1d 5h
Cure vs Zoun
Clem vs Lambo
WardiTV Invitational
1d 6h
[ Show More ]
BSL
1d 14h
Dewalt vs DragOn
Aether vs Jimin
GSL
2 days
Afreeca Starleague
2 days
Soma vs Leta
Wardi Open
2 days
Monday Night Weeklies
2 days
OSC
2 days
CranKy Ducklings
3 days
Afreeca Starleague
3 days
Light vs Flash
Replay Cast
4 days
Replay Cast
4 days
The PondCast
5 days
Replay Cast
5 days
RSL Revival
6 days
Korean StarCraft League
6 days
Liquipedia Results

Completed

Escore Tournament S2: W6
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
KK 2v2 League Season 1
SCTL 2026 Spring
RSL Revival: Season 5
2026 GSL S1
PGL Astana 2026
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

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
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.