|
hello first of all i want to tell you that have whatsoever no experience in this field of hardware interaction, but i have a recent client request to make a module for hardware interactions like stated above:
so i need help on these things:
a) logical explanations, tutorials if avails
b) any good book which i can buy from market
c) any third party API you know or which might can help me in this
d) online code samples
Thanks & Regards
Alok sharma
The change of world starts from within
|
|
|
|
|
|
thanks i am looking into it, anyways i found something called rxtx can you give advice on that as for windows implimentations
deep and thorough
|
|
|
|
|
|
guys please tell me why my code for searching in hash keep failing... please help me.. i don't know where i get it wrong
this is the code
private static void search(Hashtable<Long, ArrayList<Integer>> sHash) {
NumberFormat formatter = NumberFormat.getInstance();
System.out.println("\tBegin searching process...");
Hashtable<Long, ArrayList<DataPoint>> resultHash = new Hashtable<Long, ArrayList<DataPoint>>(10);
for (Long hash : sHash.keySet()) {
ArrayList<Integer> sTimes = sHash.get(hash);
ArrayList<SongTime> mHash = DBUtil.searchHash(hash);
for (SongTime st : mHash) {
ArrayList<DataPoint> al = resultHash.get(st.songId);
if (null == al)
al = new ArrayList<DataPoint>();
for (Integer time : sTimes) {
DataPoint dp = new DataPoint();
dp.hash = hash;
dp.songTimeId = st.timeId;
dp.timeId = time;
al.add(dp);
}
resultHash.put(st.songId, al);
}
}
System.out.println("\tBegin matching process...");
int top = 0;
int d = 0;
long id = 0;
for (Long songId : resultHash.keySet()) {
String songName = DBUtil.getSongName(songId);
ArrayList<DataPoint> al = resultHash.get(songId);
Hashtable<Integer, Integer> ht = new Hashtable<Integer, Integer>();
for (DataPoint dp : al) {
int diff = dp.diff();
if (diff >= 0) {
Integer count = ht.get(diff);
if (null == count)
count = 0;
ht.put(diff, new Integer(count + 1));
}
}
int sCount = 0;
for (Integer diff : ht.keySet()) {
int count = ht.get(diff);
if (count > 1) {
if ( count > top ) {
top = count;
id = songId;
d = diff;
}
if ( count > sCount ) {
sCount = count;
d = diff;
}
}
}
double percentage = ( (double)sCount / (double)sHash.size() * 100.0 );
System.out.println("\t\t" + formatter.format(percentage) + " %\t-> " +
sCount + " / " + al.size() + " / " + sHash.size() + " -> " + d + " ( " + songName + " )");
}
System.out.println("\tFinal : " + DBUtil.getSongName(id));
System.out.println();
}
}
|
|
|
|
|
What do you mean when you say it is "failing"? Are you getting an exception, is it giving the wrong result, is it not compiling? A little more detail would be useful.
|
|
|
|
|
What does eclipse say? tried to debug this? what kind of Exception is thrown?
I think we cannot tell you where the fault is without further info.
regards,
Torsten
I never finish anyth...
|
|
|
|
|
there's no error in the code just the output is always wrong.. when the program listening to song (instrumental) "a" for 20 seconds and process it, the output is always wrong..
it nevers give the "a" output.. it always give "b" or "c".. i don't know why.. because i a;ready tried it for non instrumental song and the output is correct..
|
|
|
|
|
instrumental - non instrumental
Are we talking about the posted code?
regards
Torsten
I never finish anyth...
|
|
|
|
|
I've been trying to seek out an eharmony/matchmaker/carfax Java source code. I'm trying to create a program to have scalable user input, say 1-5, on a variety of questions. From here, I need the program to take the user input and produce a best match or top two. I was just looking for something to base this off as it's been a couple years since i've coded in Java and it's making it tough to remember all of the operations. I already have my algorithm basically established, just trying to find more of base to work from. If anybody could lead me to where I could find this code or has some ideas, I am seeking any advice.
Thanks,
Turp
|
|
|
|
|
I'm not sure I understand your question or what it is you are looking for.
If you already have your algorithm defined and all you need to know is the Java operations, why do you need the eharmony source code? The only thing the eharmony source code would give you is the details of how they have implemented their own algorithms. Since that is the core of their business model and what distinguishes them from their competitors, I think it is unlikely to be publicly available. If you are after details of Java classes and methods, surely the Java language documentation is all you need? Or have I misunderstood what you mean by Java "operations". Maybe if you could be a bit more explicit we could point you at some open source software which does something similar.
|
|
|
|
|
I've an applet game which is loading some images. I've no problem in firefox but when i try this with internet explorer it can't load some of the images. Here is the load code and error.
Background load code
try{
backgroundImage = ImageIO.read(new File("background.png"));
backgroundImage1 = ImageIO.read(new File("back1.png"));
backgroundImage2 = ImageIO.read(new File("back2.png"));
playerImage = ImageIO.read(new File("player.png"));
}catch(Exception e){
e.printStackTrace();
}
Brick load code
static{
try{
imageBig = ImageIO.read(new File("brick.png"));
imageSmall = ImageIO.read(new File("brick_small.png"));
}catch (Exception e) {
e.printStackTrace();
}
}
and the error i get in java console when i try it with internet explorer
java.security.AccessControlException: access denied (java.io.FilePermission background.png read)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkRead(Unknown Source)
at java.io.File.canRead(Unknown Source)
at javax.imageio.ImageIO.read(Unknown Source)
at GameCanvas.initGame(GameCanvas.java:48)
at GameCanvas.run(GameCanvas.java:78)
at java.lang.Thread.run(Unknown Source)
java.security.AccessControlException: access denied (java.io.FilePermission brick.png read)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkRead(Unknown Source)
at java.io.File.canRead(Unknown Source)
at Brick.<clinit>(Brick.java:24)
at GameCanvas.initGame(GameCanvas.java:60)
at GameCanvas.run(GameCanvas.java:78)
at java.lang.Thread.run(Unknown Source)
Exception in thread "Thread-11" java.lang.NullPointerException
at Brick.CreateRandomBrick(Brick.java:41)
at GameCanvas.initGame(GameCanvas.java:60)
at GameCanvas.run(GameCanvas.java:78)
at java.lang.Thread.run(Unknown Source)
|
|
|
|
|
ekba89 wrote: java.security.AccessControlException: access denied (java.io.FilePermission background.png read)
I'm afraid that you're not allowed to open the file for read. There is a security policy specific to the JVM being used that is preventing it. Check for a .java.policy file somewhere[tm], editing that may help. Otherwise check here[^] for details on signing your applet.
Panic, Chaos, Destruction.
My work here is done.
or "Drink. Get drunk. Fall over." - P O'H
|
|
|
|
|
thanks i'll check it but i know the problem is that i am not allowed to read that file but the strange thing is there isn't any problem with firefox.
|
|
|
|
|
i've tried same code without applet and i am still getting same error i've done plenty of things with images in java but never experienced something like this. is there a way to make file readable?
|
|
|
|
|
ok i've found the problem. strangely java cannot load images when they are in the same folder with .java files so copying images to another folder solved the problem. if someone else have this problem ^^
|
|
|
|
|
I've read all articles in the internet, but couldn't succeed in array input. it gives me an error at System.in.read(client[i]); Can you tell me the simpliest way to input int array? Thanks.
package biznes;
import java.io.InputStream;
public class Vavejdane {
void Input() {
int[] client = new int[10];
for ( int i : client)
{
System.out.println("Vavedi masiva");
System.in.read(client[i]);
}
}
}
|
|
|
|
|
LORDA12 wrote: for ( int i : client)
You are iterating over all integers stored in the array. Which means that i will take the values of the integers currently in the array (which are not initialized), which means i will have an undertermined value. The you use this i to access elements of your array, which is wrong.
You should write your loop this way:
for ( int i=0; i<client.lenght; i++)
(not sure anymore if it is client.size or client.lenght, you have to look it up since I do not use arrays this way much often).
|
|
|
|
|
The problem is not there. Java initializes automatic to 0. The problem is in System.in.read(). I don't know what parameters I need to input the array from the keyboard.
|
|
|
|
|
LORDA12 wrote: The problem is not there. Java initializes automatic to 0.
There's certainly a problem there anyway: first you shouldn't relly on initialization, this is a very habbit, and second even if everything is initialized at 0, it means that you will always store your character in the first element of your array (all the elements of your array are initially 0, so if you iterate over them and do client[i], it will always point to the first element of your array).
Furthermore, did you look at the documentation of System.in.read ? It doesn't accept any parameter and returns a character. So, you have to write it this way:
client[i] = System.in.read();
Also, as it is returning a character, you should store the return values inside a character array. What do you want to do exactly ? Ask the user to type in numbers (so, he can enter several characters for one element of your entry) or ask the user to type in characters (one character for each element of your array) ? This makes a big difference.
|
|
|
|
|
LORDA12 wrote: I've read all articles in the internet
Really? all 24 billion of them? Wow, you should apply for an entry in the Guinness Book of Records.
Did you look in the official Java documentation? the page on System.In? that explains how Read() works.
|
|
|
|
|
Try this:
client[i] = System.in.read();
[editied so it'll work]
Panic, Chaos, Destruction.
My work here is done.
or "Drink. Get drunk. Fall over." - P O'H
modified on Monday, November 8, 2010 10:01 AM
|
|
|
|
|
" System.in.read(client[i]);" it can be compiled?
according my experience ,you may do like :
DataInputStream dIn = new DataInputStream(System.in);
for ( int i = 0; i<10; i++)
{
client[i] = dIn.readInt();
}
|
|
|
|
|
Hi,
I'm kinda new to programming and with not much knowledge on Java. But this is urgent!! I need help in research. I'm need to create a mobile application using Android and Eclipse.
Objectives:
To develop a mobile application that would be able to push help messages in the event whereby the mobile user requires assistance.
Scope of project:
Develop a mobile application that;
• A module to detect movements
• A decision making module with the intelligence to trigger an alert based on a set of rules
• A module to push an alert message to a 3rd party e.g. via the SMS
Any ideas on how I should go about doing this? Thanks in advance. Best Regards.
|
|
|
|
|
Smaini Nurbs wrote: I'm kinda new to programming and with not much knowledge on Java.
Well I would suggest you spend some time here[^] learning the language.
Smaini Nurbs wrote: But this is urgent!
Only to you I'm afraid.
Smaini Nurbs wrote: I'm need to create a mobile application using Android and Eclipse.
Based on your previous statement I would suggest you are expecting too much. Programming is a fairly complex discipline and without a good grounding in the language you want to use, and the platform you are developing for you are not likely to find this very easy. If you feel your knowledge of Java is sufficient then you will find lots of samples by looking at the articles here on CodeProject, or by doing a Google search.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|