Office Hours — Today, April 13

Thursday, April 1

Apr 13
7:55 PM
Mark M.
has entered the room
Mark M.
turned on guest access
8:15 PM
NetApex
has entered the room
NetApex
Whooo hooo!! How are ya?
8:20 PM
Mark M.
View paste
ok, and you?
NetApex
I have a few questions today
Hopefully they will be simple though
Mark M.
fire away!
NetApex
I need to send text to a URL via HTTP header
and retrieve data as a JSON object
I think I have enough code scrapped together to handle the JSON parsing, but it is the sending the data that I can't seen to verify if it is working correctly
Mark M.
uh, OK
NetApex
For example
View paste
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(1);   
			nameValuePairs.add(new BasicNameValuePair("x", "data"));
			nameValuePairs.add(new BasicNameValuePair("lat", lat));
			nameValuePairs.add(new BasicNameValuePair("lng", lng));
			nameValuePairs.add(new BasicNameValuePair("format", "json"));
			httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));   
      
			// Execute HTTP Post Request   
			HttpResponse response = httpclient.execute(httppost);
in theory that should work for me right?
Mark M.
those aren't headers, but, yes, that's a POSTed form
NetApex
Or is that not a good way to send data via a header
ahh well that is my problem lol
8:25 PM
NetApex
so basically I have been posting data which is going no where then
Mark M.
you want addHeader() to add headers
Gary A.
has entered the room
Mark M.
howdy, Gary!
Gary A.
Hi Mark!
Mark M.
NetApex: httppost.addHeader("X-Funky-Header", "This is so cool");
NetApex
I can keep the BasicNAmeValuePair part though correct?
Mark M.
sure, if you're POSTing a form
NetApex
So I don't even need that?
Oh ok, got things a bit confused there
Thank you once again
Gary, the show is all yours
Gary A.
I was wondering if you could point me in the direction of how I could create triangular buttons that would fit together (so they're not overlapping). I've got an idea to divide a rectangle into 4 triangles and from what I'm seeing every button is of rectangular shape...
Mark M.
Well, you can make buttons that look triangular
but an actual Button widget has to be rectangular at its core
you'd have to create your own widget for triangles
Gary A.
But the triangles would need to fit together, so the rectangles would overlap...
8:30 PM
Mark M.
right
which is why you would need to devise your own widget
Gary A.
Do you cover widget creation such as this in any of your books? I didn't notice that yet...
Mark M.
not to that level
the latest Advanced Android starts in on custom widgets
Gary A.
Well thanks for direction... I'll learn how to create widgets... sounds like fun!
Mark M.
but not rolling your own from scratch
you have a painful definition of "fun" :-)
you sure they have to be triangles?
and buttons?
Gary A.
I'll do some research, thanks. And yes, I do have a somewhat masochistic tendency when it comes to devising programs :)
Yes, triangular buttons. I designed the interface in photoshop and was hoping I could pull it off. In the meantime, I've been prototyping using rectangular image buttons...
8:35 PM
Gary A.
If you go here... http://www.ScoreLackey.com you'll see my prototype...
Mark M.
yeah, those aren't buttons
I think you're best off doing that using the Canvas, treating it more like a 2D game
Gary A.
I meant to say those are from photoshop...
I was thinking 2d game also using Canvas, just seemed like an overkill...
Mark M.
you can't use TextViews for your labels, either, AFAIK -- they don't render sideways, upside-down, etc.
widget-based UIs are for more "traditional" setups
Gary A.
I saw a demo that allowed rotation, but come to think of it, it did use Canvas...
Mark M.
so, while it may be overkill in the abstract, I think it is necessary to achieve your desired look
Gary A.
I really appreciate you cluing me in. Guess I was barking up the wrong widget :)
Mark M.
sorry if it complexifies your project
8:40 PM
Gary A.
That okay, remember, I'm a programming masochist :)
Have a good evening!
Mark M.
You too!
Gary A.
has left the room
Mark M.
NetApex: got any more questions?
NetApex
I don't think so at the moment
just have to figure out how the best way to rewrite this now
Mark M.
I recommend using a keyboard
:-)
NetApex
oh sure.. now I have to start all over :-P
I enjoy learning new things, and it is so much easier when there is someone to tell you "go in this direction"
8:50 PM
Mark M.
well, if you don't have any more questions, I think I'll shut the chat down for the night
8:55 PM
NetApex
ok man, have a good night
Mark M.
you too
NetApex
has left the room
Mark M.
turned off guest access

Thursday, April 1

 

Office Hours

People in this transcript

  • Gary Amundson
  • Mark Murphy
  • NetApex