15,892,746 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by GaryDoo (Top 23 by date)
GaryDoo
8-Sep-13 13:01pm
View
f anyone can help I'd greatly appreciate it. I've changed the code a little to 'float yMin = (float)levelH.getTop()+90.0f; float yMax = (float)levelH.getBottom();' & 'if(yPos<=yMin) indicator.setY(yMin); if(yPos>=yMax) indicator.setY(yMax);' The problem is if either of these conditions are met, the bubble position is set but it's not at the top or bottom of the level line. The bubble is repositioned, I don't really understand this, my assumption is there's a crossover between ypos of the screen & ypos of the relative layout. if someone can help I'd appreciate it
GaryDoo
20-Aug-13 16:09pm
View
thank you for your reply ridoy. I'm just unsure as to what you mean? In my manifest my min SDK is 8 and target is 17.
Do you mind shedding some more light on this for me? I've followed the link but it doesn't seem to clarify things any further for me
GaryDoo
26-Jul-13 10:36am
View
I finally managed to crack it...thanks for all your help!
GaryDoo
26-Jul-13 9:25am
View
thank you
GaryDoo
26-Jul-13 8:46am
View
thanks ridoy, i've checked that out already..I can't seem to get it to work as I already have an autofocuscallback for the touch focus
GaryDoo
26-Jul-13 8:34am
View
can I ask you, do you know how to set autofocus on the camera? I have set it so that if the device is running greater than Gingerbread to implement touch to focus, however, I can't get the device to autofocus if lower than that...would you have any ideas?
GaryDoo
26-Jul-13 8:28am
View
thank you ridoy!!! I set p to the camera parameters and it works...thank you, although I had noticed that I have implemented this in the correct sequence whereas with the other method I had not, I had called it after my startpreview....anyway, thank you, it's much appreciated
GaryDoo
26-Jul-13 8:13am
View
p being the camera parameters?
GaryDoo
23-Apr-13 16:54pm
View
thanks! it nearly broke my brain though!
GaryDoo
22-Apr-13 12:50pm
View
I am so sorry, I don't know if it's tiredness or looking at the code too long...of course if (happyRating.get(i - 1) < happyRating.size()) doesn't work, that is a really stupid mistake!! I'm sorry about that!! thank you for explaining the slope logic! so will the correct slope calculation be used in the weighting calculation?
Also just to ask the question differently, why are you saying i+1 in the if statement?
That's the last question! Thanks for your help
GaryDoo
22-Apr-13 11:45am
View
Hi Nira, thank you for your reply. Would you mind explaining further to me about rewriting the logic to go forward instead of backwards? I don't just want to copy and paste something and not have a full understanding of it first.
Also why would you have if ((i + 1) < happyRating.size()) instead of just i or happyRating.get(i)?
Regards,
gary
GaryDoo
22-Apr-13 11:05am
View
@Prasad, thank you for your reply, unfortunately I still get the same issue...
GaryDoo
22-Apr-13 11:03am
View
Thank you for your reply Filpe, I have set both counter and j as global, I can adjust this. In relation to the counter, I want the user to make 10 submissions, so each time the user clicks submit, the counter increases, is this not the correct way of tracking it?
by changing
if (happyRating.get(i - 1) < happyRating.size()) to if ((i - 1) < happyRating.size())
I still get the error.
GaryDoo
13-Apr-13 13:03pm
View
@Prasad, could I just put distance = child.distanceTo(parent) within the while (s.isConnected()) loop? That way, when the socket is connected is will repeatedly get checked? Or could you see any potential issues with this?
GaryDoo
13-Apr-13 9:35am
View
Hi Prasad,
Thank you for your help, I've attempted what I have under stood from your reply. Something like this? String provider = LocationManager.GPS_PROVIDER;
Location location = locationManager.getLastKnownLocation(provider);
Platitude = location.getlatitude(); Plongitude = location.getLongitude(); Location child = new Location("point A"); //INITIALIZING CHILD LOCATION
child.setLatitude(Clatitude); //SETTING CHILD LOCATION LAT & LONG
child.setLongitude(Clongitude);
Location parent = new Location("point B"); //INITIALIZING CHILD LOCATION
parent.setLatitude(Platitude); //SETTING CHILD LOCATION LAT & LONG
parent.setLongitude(Plongitude);
float distance = child.distanceTo(parent); All within my runnable rec? (apologies for the layout of my reply, it won't allow me to format my input)
Or is there another option?
GaryDoo
3-Apr-13 18:07pm
View
if I pass coordinates from a point at the other end of the country I still get a reading of 9. something. This surely can't be right?
GaryDoo
3-Apr-13 18:06pm
View
Deleted
but if I pass in coordinates from the other end of the country it still gives me 9.something...this surely could be correct?
GaryDoo
3-Apr-13 17:06pm
View
my apologies Prasad, it was an oversight on my behalf, I was testing with a simple string and had forgotten to comment it out, it was this that was causing me errors as it was trying to split a string with no ","!!!
However, if I could I would like to ask your advice, is there anyway for me to test that these 'Clatitude' and 'Clongitude' are correct? Is there any way to display them for testing purpose? I am trying to calculate the distance and display it, I am using the following code
(should I open a new discussion?)
public void onLocationChanged(Location location) {
// TODO Auto-generated method stub
Location parent = new Location("parent");
Platitude = location.getLatitude();
Plongitude = location.getLongitude();
parent.setLatitude(Platitude / 1e6);
parent.setLongitude(Plongitude / 1e6);
Location child = new Location("child");
child.setLatitude(Clatitude / 1e6);
child.setLongitude(Clongitude / 1e6);
distance = parent.distanceTo(child);
String distanceSt = String.valueOf(distance);
TextView myTextview = (TextView) findViewById(R.id.distTo);
myTextview.setText(distanceSt);
}
}
I am testing with a mobile device and an emulator. I sent test coordinates to the emulator an I got a result of 9.5 meters, so to test I input the coordinates of my mobile device and I get a distance of 9.3 meters where I'm sure this should be zero.
Can you see where I'm going wrong?
Regards,
Gary
GaryDoo
3-Apr-13 13:50pm
View
Prasad...I've tried to implement this, but I seem to get errors...
String[] Loc = location.split(",");
double Clatitude = Double.parseDouble(Loc[0]);
double Clongitude = Double.parseDouble(Loc[1]);
These are the lines of code I am using to split the string and then to parse them to doubles, does this look incorrect to you?
GaryDoo
3-Apr-13 13:50pm
View
Deleted
Prasad...I've tried to implement this, but I seem to get errors...
String[] Loc = location.split(",");
double Clatitude = Double.parseDouble(Loc[0]);
double Clongitude = Double.parseDouble(Loc[1]);
These are the lines of code I am using to split the string and then to parse them to doubles, does this look incorrect to you?
GaryDoo
17-Mar-13 15:26pm
View
Hi Prasad, thank you for your speedy reply, I had looked at parseDouble already, however, this issue I was having was that there are two doubles within the one string a latitude double and a longitude double. I'm wondering how, when I have the following line of code
double lat = double.parseDouble(location);
do I extract or parse one of the doubles? i.e. the latitude double?
I have used tcp/ip sockets to transmit the coordinates, now as I've said I'm quite inexperienced in android/java, could you explain the JSON structure method or separator method?
Regards,
Gary
GaryDoo
8-Feb-13 11:59am
View
sorry Pascal, that was an error with me posting my code across, both ports are the same.
So I declare a socket on the client side like
Socket mySocket = new Socket();
After that I'm not sure, I can't seem to find much on the connect() function. Would you mind giving me a few more pointers? I'm sorry to be such a headache!
GaryDoo
8-Feb-13 9:05am
View
@ Pascal-78
Thank you for your quick response, unfortunately I've been offline for the past few days. I have changed this, and unfortunately it still doesn't work. I've created a simple server and client in java, and it works, as both server and machine is on the same machine. So I'm wondering is there some other issue? I am very grateful for your help thus far, if you would have any thoughts I'd really appreciate it.
In this line I'm putting in the ip of the client(phone) and port number?
<pre>s = new Socket("192.168.1.3", 2001); </pre>
I just really want to make sure I'm correct on this as it's really giving me a headache and I'm not sure how to fix it :(
I'm reposting the server and client code below now that it's edited.
CLIENT
<pre>import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.net.Socket;
import java.net.UnknownHostException;
import java.util.Scanner;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
public class Client extends Activity {
private Socket s;
private PrintWriter p;
TextView display;
Button test;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
test = (Button) findViewById(R.id.test);
display = (TextView) findViewById(R.id.Sdisplay);
test.setOnClickListener(new View.OnClickListener() {
//@SuppressWarnings("unused")
public void onClick(View v) {
// TODO Auto-generated method stub
try {
s = new Socket("192.168.1.3", 2001); // connect to server
OutputStream o = s.getOutputStream();
p = new PrintWriter(o);
InputStream in = s.getInputStream();
Scanner r = new Scanner(in);
p.println("Gary");
p.flush();
} catch (UnknownHostException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
});
}
}</pre>
SERVER
<pre>import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.Scanner;
public class Additional_Server {
public static void main(String[] args) throws Exception {
Socket s;
ServerSocket ss = new ServerSocket(2012);
//serverSocket = new ServerSocket(2001); // Server socket
System.out.println("Server started. Listening to the port 2001");
while (true) {
try {
System.out.println("Server: waiting for connection ..");
s = ss.accept();
InputStream in = s.getInputStream();
Scanner r = new Scanner(in);
// OutputStream o = s.getOutputStream();
// PrintWriter p = new PrintWriter(o);
String inputLine;
inputLine = r.nextLine();
System.out.println("Hello " + inputLine + " from Gary");
// p.close();
} catch (IOException ex) {
System.out.println("Problem in message reading");
}
}
}
} </pre>
Again, my thanks for any further help you or anyone can provide to me
Regards,
Gary
Show More