This site requires JavaScript, please enable it in your browser!
Greenfoot back

Comments for User View Demo

Return to User View Demo

A new version of this scenario was uploaded on Mon Sep 16 22:28:18 UTC 2013
A new version of this scenario was uploaded on Mon Sep 16 22:33:34 UTC 2013
A new version of this scenario was uploaded on Mon Sep 16 22:43:36 UTC 2013
A new version of this scenario was uploaded on Mon Sep 16 22:46:13 UTC 2013
A new version of this scenario was uploaded on Mon Sep 16 22:57:28 UTC 2013
A new version of this scenario was uploaded on Mon Sep 16 22:58:22 UTC 2013
GreenHouseGreenHouse

2013/9/16

There it goes :D This scenario will display all Grennfoot.org users who have set a custom profile picture. Enjoy it :D
lordhersheylordhershey

2013/12/23

Might be cool to make it cough up a directory of users, but it would be slow to do through here.
shrucis1shrucis1

2013/12/23

Greenhouse, how do you tell if they have a default image? Also, does it show EVERY user, or just every user that runs the scenario?
bournebourne

2013/12/23

@shrucis1, looks like it must be pulling from the website somehow which case profile image data may have some indication that it is left default. Takes a while to get through the list of users, and is the screen suppose to flash sometimes?
shrucis1shrucis1

2013/12/23

Thanks bourne, the follow up to that answer would be HOW is he getting user data from the website? Not through UserInfo, if he's showing users that have never seen the scenario.
bournebourne

2013/12/23

Through unconventional methods I'm guessing. If you take a look at some of GreenHouse's other scenarios, you will see some of them deface the website page
tylerstylers

2013/12/23

it is done like this: public void act() { String name = UserManager.name(UserManager.get((new StringBuilder()).append("http://www.greenfoot.org/users/").append(index++).toString())); if(name.isEmpty()) { text.setTxt((new StringBuilder()).append("user ").append(index).append(": doesn't exist.").toString()); return; } GreenfootImage img = GreenfootUtil.getUserImage(name); if(img == null) { text.setTxt((new StringBuilder()).append("user ").append(index).append(" ").append(name).append(": no image found.").toString()); return; } Color first = img.getColorAt(0, 0); if(first.getRGB() == 0xffd4d4d4) { text.setTxt((new StringBuilder()).append("user ").append(index).append(" ").append(name).append(" has default image.").toString()); return; } else { addObject(new Face(img), (int)Math.round(Math.random() * 520D + 40D), (int)Math.round(Math.random() * 320D + 40D)); text.setTxt((new StringBuilder()).append("user ").append(index).append(" ").append(name).append(" added.").toString()); return; } }
tylerstylers

2013/12/23

and String answer; URL url = new URL(to); HttpURLConnection connection = (HttpURLConnection)url.openConnection(); connection.setRequestMethod("GET"); connection.setDoInput(true); connection.setDoOutput(true); connection.setUseCaches(false); connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); String line; for(answer = ""; (line = reader.readLine()) != null; answer = (new StringBuilder()).append(answer).append(line).toString()) { } return answer; IOException e; e; e.printStackTrace(); return "error";
shrucis1shrucis1

2013/12/24

Thanks for the code, tylers, I don't really understand some of the classes you're user, such as UserManager, I found some API here: http://docs.oracle.com/cd/E23943_01/apirefs.1111/e17334/oracle/iam/identity/usermgmt/api/UserManager.html But it doesn't seem to be the same. Nevertheless, thank you for the explanation using code, I now see he's just grabbing the information from greenfoot.org/users/##UserNumber## Also, just curious, but do you know whether the users that don't exist are users whose accounts were deleted, or does greenfoot just skip some usernumbers when it assigns you a usernumber?
GreenHouseGreenHouse

2013/12/24

Hey guys, sry i'm a home at christmas and didn't look at greenfoot.org :/ I will upload the source code later :) All in all you are right; i get the username by incrementing http://www.greenfoot.org/users/#id# download the website; the username is written inside the <title> inside the <head> tag (regex: "<head>.*?<title>(.*?)</title>.*?</head>") now i do GreenfootImage img = GreenfootUtil.getUserImage(name); to get the image, this can be null -> the user doesnt exist the default image -> user has default image otherwise a custom image Happy Christmas to everyone ;)
GreenHouseGreenHouse

2013/12/24

@shrucis1: deleted users ( i think the user data is stored inside a huge sql) are like the following: http://www.greenfoot.org/users/46 The users data is just deleted, nothing else...
GreenHouseGreenHouse

2013/12/24

@bourne: :D for the unconventional methods, see the DOM Attack scenarios http://www.greenfoot.org/collections/393 The DOM Attack is also basically implemented in Greenfoot 3D ;) You noticed that the screen flashes some times; i put the whole image-loading-process inside the world's act method, but the synchronized act method isn't very cool about handling the time for downloading the website, parsing the data and loading the image; thats why the redraw process get interrupted...
shrucis1shrucis1

2013/12/24

GreenHouse, I understand what you mean when you say a users data is deleted, but you didn't answer my question. I was asking if you know WHY some of them are deleted. Are they deleted because there was once a user with that number, but now there's not? Or is it something else?
GreenHouseGreenHouse

2013/12/25

Oh, okay. Let's ask user #4, he is the one who banns everyone :D
shrucis1shrucis1

2013/12/25

I'm pretty sure davmac's not going to respond to your comment if you just call him 'user #4'. So I take it that you're saying that the missing users were banned?
GreenHouseGreenHouse

2013/12/25

I think so; there is no reason to skip numbers, and because you cant delete your account....
A new version of this scenario was uploaded on Wed Dec 25 23:20:29 UTC 2013 Sourcecode added. Multithread. Updated to GF3D.
shrucis1shrucis1

2013/12/26

@GreenHouse, that would mean that there are exactly 100 banned users, according to my calculations. There are 932 pages of 20 users each, and one page of 9 users, which adds up to 18,649 Greenfoot Users (not banned). By making logical guesses, I've pretty much determined that the highest user number is 18749, making there 100 users numbers that don't exist (Not surprisingly, most seem to be lower numbers, meaning users that have been registered for longer have a higher chance of being banned).