« first day (1360 days earlier)      last day (3664 days later) » 

5:02 PM
o_o
 
5:25 PM
Have to make my PHP service send info back into the phone instead of the other way around :P
 
@hasherr take a sword!
 
I'm good
 
morning
 
I'll keep my pitchfork -----E
 
E + D + :P + S + W
= BULLSHIT
= B + U + L + L + S + H + I + T
:p
 
5:40 PM
Mods be a' lurkin'
 
some sweet song
 
Listening to this right now
 
oh that's sweet. I feel verry happy today somehow. The song goes well with my mood.
 
@BlueBug isn't the worst I have heard
@hasherr wtf?
 
?
 
5:42 PM
nvm
 
yeap. he's a pretty new. I guess he's still maturing as a singer.
 
but he doesn't really filter out from many other artists
 
Jon
5:54 PM
essentially a cookie clicker style game, made by notch
 
Anybody here good with PHP?
 
Jon
yeah
 
Okay, I'm trying to make a PHP value so that my Android app will request it, and the service will send it back to the android device
So I'm not sure how I should go about doing this, should I use a $_POST?
 
Jon
you want to what?
android app requests a value, from PHP server, and PHP server sends value?
 
Android app requests a value from the PHP webservice. PHP service sends it back.
Yes
 
Jon
5:58 PM
how are you creating the request?
javascript?
 
you make a GET or POST request to the server, and which ever type you are using you get the request parameters from $_GET or $_POST
 
Just using a HttpResponse
From the Android app itself
 
Jon
HttpRequest?
 
if you do url/index.php?help=1 then you'd get it from $_GET["help"]
 
Jon
HttpResponse would hold the data.
 
5:59 PM
Ohhh
Yeah, I'm dumb, hold on
God damn, this is so hard to google for
I don't know what I'm looking for
 
ask a question
 
Jon
124
Q: Make an HTTP request with android

Mats HofmanI have searched everywhere but I couldn't find my answer, is there a way to make an simple HTTP request? I want to request an PHP page / script on one of my website but I don't want to show the webpage. If possible I even want to do it in the background (in an BroadcastReceiver)

 
@hasherr You still working on this?
 
Jon
yup. he is
sup mick
 
Yeah
<?php
	$_GET["wow"] = "what";
?>
 
6:09 PM
sup jon
 
Just trying to figure out how to get that value in Android
 
just finished waking up, I made breakfast while still asleep :D
@hasherr Last time I had to do that I used JSON
<?php
$o = array();
$o["red"]="thing";
$o["cat"] = "hat";
echo json_encode($o);
?>
 
Yeah, I'm just trying to send that $_GET variable to my Android device
 
Never write to $_GET or $_POST
 
json_encode($_GET);
 
6:12 PM
It has no effect except maybe confusing you later if you need the real parameter again
 
that would send you back whatever you send to the server in get parameters
 
@Jon the game notch made is so sad ;(
 
Jon
I know.. LOL
I stopped after a while... I was like... damn this is real life.. not a game
 
I'm currently dead
 
Jon
oh lol
I could only click for so long before I got bored :)
 
6:13 PM
Now I am going to be forgotten!
 
Lol what's notch's new gimmick?
 
Jon
"I don't want to be a page is someone else's history book." -- Stanis
I linked it down here \/
 
I am now 50% forgotten
 
@Jon lol I was looking for it and I found this
to which I am super down, if I can work from linux :P
 
Jon
found what>
 
6:15 PM
now I'm 70% forgotten
 
@Lasse Wait, what?
Can you explain this in more depth?
 
@Jon XNA collab thing
 
Jon
ah
 
the $_GET variable is special variable filled with values you send to the server via GET paramaters in the url
 
Jon
yeah.. i was willing to start a project with some people in here, for fun
 
6:16 PM
I've been wanting to do that for a while
 
Jon
Let's do it
 
:D
 
I'm 90% forgotten oh no
 
Jon
I said XNA.. since it integrates well with bitbucket/VS
 
that line I wrote just works like echo, it sends you back anything you send to the server
 
6:17 PM
@Lasse Oh, in the URL?
 
Jon
but you like linux
 
yeah
like index.php?hello=hi&wtf=lol
 
Ther is nothing. Solve.
O.o
 
Jon
There is one major issue for me.... Work blocked this chat room...
So I can only chat on Chat.stackoverflow.com from work now
 
@Jon I think I'm going to have to turn down a gamedev job I got offered because CryEngine didn't work right on linux
 
Jon
6:18 PM
I go to the c# chat room
 
Awww wtf lol
 
Jon
@MickLH ?? seriously
 
That's the whole point of this
@Lasse Okay, then, but then how do I receive it via Android?
 
Jon
Just get a windows box, and suck it up for the money
 
you need to output something in the PHP
 
6:18 PM
Via echo?
 
$o["something"] = "yay";
echo json_encode($o);
 
@Jon owwwww my ego, it hurts so bad
 
Jon
work is work.
not suppose to be fun
otherwise, it would be called super happy fun time
not work
 
or just echo "hello world";
but JSON is better for data transfer :P
 
I'm just playing anyways, I really need to get around to that
I even got another SSD I can install to put windows on
 
6:20 PM
@Lasse Okay, so now I have this
<?php
$_GET["wow"] = "what";
echo $_GET["wow"];
?>
 
don't write in the $_GET
you don't want to do that
 
So just take out "what"?
 
@hasherr <?="what";?>
optimized
 
Jon
@MickLH what is your programming language of choice?
 
@Jon Well I feel most comfortable in C++ or Javascript
 
Jon
6:21 PM
I guess I could learn SDL
 
But I'll work in basically anything at all, although I don't enjoy LISP style things
 
@hasherr yes, just take the whole line out, and it will output the value you send to it with GET param "wow"
index.php?wow=what
 
<?php
$_GET["wow"];
echo $_GET["wow"];
?>
 
I do actually love C# I know that sounds crazy :P
 
<?php
echo $_GET["wow"];
?>
 
Jon
6:22 PM
C# is my language of choice nowadays
 
Oh take it all out
 
Hey guys, do you see anything wrong this code? Debugging reveals that difference is for some reason becoming a NaN:

public void turnToFacePoint(Vector2 p)
{
float distanceX = p.X - position.X;
float distanceY = p.Y - position.Y;

float targetRotation = (float)Math.Atan2(distanceY, distanceX);
float difference = MathHelper.WrapAngle(targetRotation - Rotation);
//Clamp the difference to the maximum rotational speed.
difference = MathHelper.Clamp(difference, -1f, 1f);

Rotation = MathHelper.WrapAngle(Rotation + difference);
 
Jon
its what I use in my day job.. so I have the most XP in it
 
lol, ironically, PHP is what I have used most for work
but it's one of the ones I hate the most
 
Jon
What is WrapAngle @Bagofsheep
 
6:23 PM
@Lasse I think there's some confusion here
 
@MickLH same here
 
We're receiving a message from the server
 
but I totally understand the XP, I leveled so many times that I can code it faster than other languages I love lol
 
Not sending one
 
@hasherr what exactly you want to do
 
new NetworkingTask().execute("http://thisiscomputor.net16.net/index.php?wow=hi");
 
Jon
hehehe
 
yes
 
So that is just going to change the value on the site
But Android isn't getting anything back
 
Jon
@Bagofsheep probably something to do with your Rotation variable
set a watch on it, and see what happens to it
 
6:24 PM
I have no idea where the problem would be
 
Well Rotation becomes NaN as well but not until after difference has become a NaN.
Because Rotation is involved in math with the difference.
 
@Lasse What is Android getting from this?
Nothing from what I can tell
 
it should be getting "hi"
 
@Bagofsheep what is MathHelper?
 
Well, first of all, I need to figure out how to print that information out
But second of all, all it is getting is what I am telling it to get
 
6:25 PM
It is a static class in .NET.
 
Jon
not .net
 
Oh.
 
Jon
I think it is XNA
 
It isn't in base visual C#?
 
Jon
No.
 
6:26 PM
@Lasse My PHP script has a variable called "Wow" and I want for my Android app to say "Hey, I want the contents of that 'wow' variable that the PHP has."
 
Jon
Pretty sure it comes with XNA libs
 
Is it safe to assume it absolutely works?
 
Jon
Namespace: Microsoft.Xna.Framework
 
But instead, we're just saying "Oh, I already know that it says hi, so give me the contents of wow"
 
Jon
yup.
 
6:27 PM
wow maaajor lag
 
Yes, it is safe to assume that it works.
Let me try watching the Rotation variable.
 
$o["wow"] = "hello";
echo $o[$_GET["giveme"]];
index.php?giveme=wow
 
Jon
Are you altering Rotation anywhere else?
 
@Bagofsheep so what are the targetRotation and Rotation values?
 
targetRotation is the angle it wants to be at and Rotation is its current angle.
 
6:28 PM
right after the arc tangent
I mean the numerical values
 
Jon
NaN typically means Infinity
 
I don't think I am altering the player's base rotation anywhere else.
Right after the arc tangent?
 
atan2
 
Do you mean the arc tangent's parameters?
 
no, I mean insert a debugging break after the atan2 line
 
6:29 PM
Alright, one second.
 
Jon
I think Mick is on the right track.
 
Alright, targetRotation (after atan2 is passed) is equal to targetRotation -2.3561945 float
 
and regular Rotation ?
at the same spot
 
Rotation 0.0 float
The player hasn't rotated yet.
 
@Lasse Can I just say "http://thisiscomputor.net16.net/index.php?wow" instead of "http://thisiscomputor.net16.net/index.php?wow=hi"
 
6:31 PM
If I pass through a second time they become:
targetRotation NaN float
Rotation -1.0 float
And that's only having the breakpoint on the line right after atan2.
 
Jon
ah.. what is your distancxX and Y after 2nd pass?
 
^
 
Jon
probably super big
 
@hasherr you need to use $_SERVER['QUERY_STRING'] for that
google it up and check the manual how it works
 
Ugh...
 
6:32 PM
Both NaN for some reason, but if I pass a third time they go back to real numbers.
 
Jon
your problem is your Position
 
On the third pass distanceX and Y are:
distanceX -658.0 float
distanceY -492.0 float
 
Jon
Ohhhh
I know what the problem is
:)
 
What is it?
 
Jon
Look at p
 
6:33 PM
By the way, they point the player is trying to face is the world position of the mouse.
- p {X:2542 Y:2708} Microsoft.Xna.Framework.Vector2
That is P right now as of the 3rd pass.
 
Jon
what is p on second pass?
 
Let me restart it.
 
Jon
show me the code you use to call this function
 
@Lasse Okay, hold on, that was irrelevant anyways. My PHP scripts has a value, my Andorid phone has a button that when pressed, receives the value.
 
+ p {X:NaN Y:NaN} Microsoft.Xna.Framework.Vector2
 
Jon
6:34 PM
to calculate p
 
Do I even use $_GET?
 
Hmmm, that is the second pass.
 
Or do I use $_POST?
 
@hasherr eh?
 
suspicions confirmed
bad input
 
6:35 PM
@Jon Alright, this is the method call in the player's update method:
turnToFacePoint(mouse.WorldPosition);
I will get the mouse.WorldPosition code.
 
@hasherr I have no idea how the android stuff works, do you display webpages on it or are you using some other method of fetching the data from the server
 
@Lasse I'm just confused now on what we're doing. Are we sending information from Android to the server, or from the server to the Android?
 
both
 
I should've been more specific
 
Code in mouse update:
inverseViewMatrix = Matrix.Invert(camera.ViewMatrix);
WorldPosition = Vector2.Transform(new Vector2(mouse.X, mouse.Y), inverseViewMatrix);
 
6:36 PM
@hasherr it's always both with HTTP
 
you send
GET index.php?giveme=wow
and the server responds
hello
 
Request/response is a two-way thing obviously, but is Android sending a string to PHP or is PHP sending a string to Android?
 
both
 
Nooo
 
Jon
what is the difference between a quid and a pound?
 
6:37 PM
I think quid is just slang
 
British currency? nothing ... quid is slang for a pound.
 
Jon
ah ok
watching a british show... was wondering what a quid was
 
You pay a taxi in quid, you pay for a car in pounds.
 
@Lasse "http://thisiscomputor.net16.net/index.php?wow=hi"
Shit
 
Any idea why the input is becoming NaN on second pass after seeing that code?
 
Jon
6:38 PM
more code @Bagofsheep show me the call
 
That's just cheating, because we already know what the server is going to responsd with
 
The call of what?
I posted code above, not sure if you missed it.
 
@hasherr I already pasted you a script where you can give the android app what you want
11 mins ago, by Lasse
$o["wow"] = "hello";
echo $o[$_GET["giveme"]];
index.php?giveme=wow
 
$o["wow"] = "hello";
echo $o[$_GET["giveme"]];
index.php?giveme=wow
 
@Bagofsheep Can you debug these variable for us?
 
6:39 PM
The matrix or the worldPosition?
 
both
the matrix will be 4 floats, not too bad to look at manually
 
Alright, one second.
 
Jon
inverseViewMatrix = Matrix.Invert(camera.ViewMatrix);
WorldPosition = Vector2.Transform(new Vector2(mouse.X, mouse.Y), inverseViewMatrix);
reposted.. for me
 
Alright lol.
Inverse View Matrix:
+ inverseViewMatrix { {M11:NaN M12:NaN M13:NaN M14:NaN} {M21:NaN M22:NaN M23:NaN M24:NaN} {M31:NaN M32:NaN M33:NaN M34:NaN} {M41:NaN M42:NaN M43:NaN M44:NaN} } Microsoft.Xna.Framework.Matrix
 
@Lasse Okay, okay, now I understand, but now I don't know what to Google for figuring out how to get that string using apache's Http library...
 
Jon
6:41 PM
LOL
 
That looks like weird jargon.
 
@Jon lol I totally missed it too
 
Jon
ok... your camera matrix is fucked
 
@Bagofsheep lol Thurs yer prallem
 
@hasherr what? apache's http library? what is that?
 
Jon
6:41 PM
@Bagofsheep hold on
 
LOL why in the hell is it all NaN?
WorldPosition:
+ WorldPosition {X:NaN Y:NaN} Microsoft.Xna.Framework.Vector2
 
@Lasse It's a depreciated thing you should NOT use!
 
Wtf.
 
@Lasse I just need to figure out how to print out the variable that is "wow"
 
Lol.
 
6:42 PM
In android we're supposed to use URLConnection for all new and future apps
 
Jon
Vector2.Transform(pos, Matrix.Invert(camera.ViewMatrix));
 
Please do not develop new apps on depreciated APIs
 
@hasherr the script I gave you does that already
 
index.php?giveme=wow <---- I need to print the value from "wow"
 
Jon
try it like that.. in one line @Bagofsheep
 
6:42 PM
yes
that's what it does
 
We're not talking about the script anymore, we're talking about Android
I don't know what to google to print that out
I can't explain what I'm trying to say
 
Jon
If that fails.. it means your camera matrix is getting messed up.... are you multithreading here?
 
I have no idea how the android part works
 
@hasherr hold on a second, I think I've got something for you
launching eclipse :'(
 
barfs
 
Jon
6:43 PM
farts
 
@Jon Like this?
WorldPosition = Vector2.Transform(position, Matrix.Invert(camera.ViewMatrix));
 
Jon
where position is mouse position. yeah
 
Yeah, alright.
You mean the mouse's screen position right?
 
Jon
Vector2 position = new Vector2(Mouse.GetState().X, Mouse.GetState().Y);
like that
 
Yeah.
 
6:45 PM
String downloadFile(String url) {
	String out="";
	try {
	    URL url1 = new URL(url);
	    BufferedReader in = new BufferedReader(new InputStreamReader(url1.openStream()));
	    String str;
	    while ((str = in.readLine()) != null) {
	    	out+=str+"\n";
	    }
	    in.close();
	} catch (MalformedURLException e) {
	} catch (IOException e) {
		e.printStackTrace();
	}
	return out;
}
Downloads a text file from the internet lol, it's shitty but easy to use
 
Jon
@Bagofsheep are you multithreading at all?
 
@MickLH Riight...
Not really what I was looking for, I don't think
 
@hasherr You just said a fucking second ago that you don't know what you're looking fory
You just did to me, what androidmaster did to you the other day that you went ALL CAPS about lol
ttyl :D
 
I know it's not that.
Sorry :(
 
Jon
ARRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRGH
"YOU FOUND A GLINCH"
 
6:48 PM
@hasherr You've described extremely clearly that you would like to communicate with a webservice in your android app
If your webservice is hosted over HTTP, then you're going to have to poll, period
 
Right, but my webservice does not involve text documents.
 
Ok, the player's rotation is still ending up as an NaN.
 
You were talking about JSON earlier, which is a very good way to send structured data, and it's always text
 
@Jon And no, I don't think I am multithreading, I don't know how to multithread.
 
@hasherr But even with binary data, you should be using URL APIs instead of Apache APIs
Apache APIs are depreciated on android
DEPRECIATED
 
Jon
6:49 PM
@Bagofsheep Ok, so your camera is messed up.
 
(I'm confused. How many conversations are these and who's in which one?)
 
That means that one day (soon) an update is coming out that will make your app crash on everyones device
 
Jon
What is your viewMatrix code @Bagofsheep
 
@MickLH I would only need a poll if my service required it to be polling every x minutes or whatever. This service that I'm building only polls when the user hits a button
 
It seems like the matrix is only filled with NaN's with the game first starts, then goes back to normal. Could it be something to do with the mouse maybe?
 
Jon
6:50 PM
We need to go deeper
 
@Jon alright I will get the view matrix code.
 
@MickLH Fuck.
 
Lol, DEEPER.
 
beneath the surface :o
 
Jon
@Bagofsheep update your camera first
 
6:50 PM
@hasherr So what about you doing polling makes polling not what you're doing?
 
Jon
chances are you are updating your camera after
 
@MickLH Depends on what kind of polling we're talking abut
 
The polling kind
The kind where you poll for data...
 
Oh, update my camera first.
Alright, one second.
 
Jon
@Bagofsheep whatcha making anyways?
 
6:52 PM
@hasherr To be completely honest, it seems like you're not completely sure what you're trying to accomplish
What is your end goal with this webservice stuff?
 
Jon
sounds like he is winging it :)
and getting pissed off
 
I know what I'm trying to accomplish, just very new to webservice in general
@MickLH So I need a service which goes into a database and sends data to my android device
 
@Jon Hahaha it worked man, I was updating my camera last, after everything else.
@Jon Now to see if the actual method does what I want it to since I can see the damn player again.
 
Jon
good stuff bro
 
@Jon I am making a top-down shooter btw but it is so much more than that. It is kind of a secret.
 
Jon
6:53 PM
whatcha making?
 
Well I'm not closing any doors for you that were not already closed, I'm just showing you that basically with webservice over HTTP, there's only 1 main "door", and if you're lucky there's a side door too but it's a pain in the ass
 
Jon
dual stick shooter?
 
@MickLH Okay, well I'll move over to URL api
 
No, a PC game. I might make it compatible with controllers but mouse + keyboard are my priority.
 
Jon
@Bagofsheep make sure to share when you are done
 
6:54 PM
I miss alex
 
Jon
So, stumbled upon this
 
I shall, but it's a massive project. It probably won't be done for a long time.
 
Jon
 
sorry if I pulled an alex on you, @hasherr
 
Damn that's awesome pixel art.
 
Jon
6:54 PM
Game is called Ethereal
 
@MickLH You're fine, I can be kind of irritating sometimes
 
Jon
Indie dev... looking pretty interesting up to now
 
But I do appreciate the help
 
Jon
I miss alex
He had a crush on me i think
 
@hasherr When you get to the database stuff on the PHP side, make sure you use PDO even if you want mysql
 
6:55 PM
Yes, the method works! Thanks again @Jon and @MickLH.
 
Don't fall for the mysqli trap, PDO is still better
lol np @Bagofsheep I feel like @Jon did most of the work
 
Jon
PDO +1
 
So, UDP headers are 8 bytes in size. If I were to stream user input 60 timers per second, that's 480 bytes per second, requiring a ~4kbit connection, just for the headers. :P
 
Jon
UDP is like a shotgun
It'll hit the target most of the time
 
That analogy makes me want to play Halo 1 multi-player
Shotty Snipers gametype
On sidewinder
 
6:57 PM
@MickLH Now I have to figure out how to connect to the service via URL fuck >.<
 
Jon
Man.. shotgun was my weapon of choice on halo :)
shoot / smack in face
insta-death
 
yessss BANG! skeetskeet
 
Jon
teabag that bitch
 
I loved how tactical it got trying to handle FFA with 4 players on that map in that gametype
 
Jon
grocery run.. bbl
 
6:59 PM
Is something like this what I'm looking for, @MickLH ?
    try
    {
        URL destination = new URL(url[0]);
        URLConnection connection = destination.openConnection();
    }
 
It seems like it, I'm not expert on android APIs
Although, I think you can just hack my snippet from earlier
 
URL isn't even Android API
 
And use regular read instead of readLine
 

« first day (1360 days earlier)      last day (3664 days later) »