|
'm doing my graduation project on RECOGNITION OF HANDWRITTEN SHORTHAND LANGUAGE STROKES .... So, please any one who is interested in it give me some guidelines...
1.thinking to implement it in MATLAB or JAVA... please suggest me which is better ...
2.will i get any module of code to build my project instead of building it from scratch..? if , from where pls specify it....
..
|
|
|
|
|
Always wrap your code in Pre tag. it will give better readability to other user to understand your code snippet.
|
|
|
|
|
thanks for ur code,,, but i decided to do it matlab.... so any thanks for posting
|
|
|
|
|
import java.util.Arrays;
import org.apache.commons.lang.time.*;
public class JavaApplication1 {
public static void main(String[] args) {
java.util.Random r = new java.util.Random();
int[] stuff = new int[100000];
System.out.println("Unordered array....:");
for (int i = 0; i < stuff.length; i++)
{
stuff[i] = r.nextInt(100000);
}
System.out.print(Arrays.toString(stuff));
StopWatch watch = new StopWatch();
watch.start();
Arrays.sort(stuff, 0, 100000);
watch.stop();
System.out.println("Ordered array....:");
System.out.print(Arrays.toString(stuff));
System.out.println();
System.out.println("executed in "+watch.getTime()+" miliseconds...");
}
}
StopWatch api download
runs 4 times slower than the .net c# code!
what am i missing? what can i do to improve performance? is this interesting? I am familiar with c# but i wand to deep dive in java
to broaden my knowledge on languages and frameworks
here is the code in c#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
namespace ConsoleApplication4
{
class Program
{
static void Main(string[] args)
{
Random r = new Random();
int[] stuff = new int[100000];
System.Console.WriteLine("Unordered array....:");
for (int i = 0; i < stuff.Length; i++)
{
stuff[i] = r.Next(100000);
System.Console.Write(stuff[i].ToString() + " ");
}
Stopwatch watch = new Stopwatch();
watch.Start();
Array.Sort(stuff);
watch.Stop();
System.Console.WriteLine("Ordered array....:");
for(int k=0;k<stuff.Length;k++)
{
System.Console.Write(stuff[k].ToString() + " ");
}
System.Console.WriteLine("executed in " + watch.ElapsedMilliseconds.ToString() + " miliseconds...");
System.Console.ReadKey();
}
}
}
|
|
|
|
|
nipsonanomimata wrote: is this interesting?
Not really.
|
|
|
|
|
how much RAM is your java-runtime allowed to access?
|
|
|
|
|
how can i check how much ram is my java-runtime allowed to access?
i just installed the jdk1.7 , and build the code using netbeans 7.01
|
|
|
|
|
SOLUTION:
This works for me but I still do not know why it was behaving like that...
if (table.getCellEditor() != null) {
table.getCellEditor().stopCellEditing();
}
Was called when deleting the row, forcing the cell that is being edited to stop editing.
PROBLEM:
I have the following CellEditor that is used to validate cells on a column:
public class CellEditor extends AbstractCellEditor implements TableCellEditor {
protected TextField source = new TextField();
private ArrayList<IValidator> validators = new ArrayList<IValidator>();
public CellEditor WithValidation(IValidator validator) {
validators.add(validator);
return this;
}
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
source.setText(String.valueOf(value));
return source;
}
public Object getCellEditorValue() {
return source.getText();
}
@Override
public boolean stopCellEditing() {
String s = ((String) this.getCellEditorValue());
if (s == null) {
this.fireEditingCanceled();
return false;
}
for (IValidator v : this.validators) {
if (!v.isValid(s)) {
JOptionPane.showMessageDialog(null, v.getErrorMessage());
this.fireEditingCanceled();
return false;
}
}
return super.stopCellEditing();
}
}
And I attach the code to my table like this:
this.jTable1.getColumnModel()
.getColumn(0)
.setCellEditor(new loyaltyapp.validation.CellEditor()
.WithValidation(new TextLengthValidator(1, 12)));
When the second snippet of code is commented everything works as intended (but of course not including any validation)...
The problem is that when I do attach the CellEditor to my table when I remove a row WHILE a cell is being edited the rest of the row gets deleted, leaving behind a rogue cell!
Image of selecting a cell:
http://www.mediafire.com/?8n999a4djacdj84[^]
Image of deleting the row while selecting the validation cell:
http://www.mediafire.com/?mozjjzc53ju12b2[^]
The only way to remove it is by pressing escape...
Any ideas?
|
|
|
|
|
The problem is that when I do attach the CellEditor to my table when I remove a row WHILE a cell is being edited the rest of the row gets deleted, leaving behind a rogue cell!
Then decide - Editing OR deleting. Can't have both. Is the system deleting the row or how is it done?
|
|
|
|
|
ecrir un programme compose une formule en sous formule
|
|
|
|
|
1. This is an English language site.
2. We do not write code to order.
3. Even translated your question makes little sense.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
|
djamelm61 wrote: ecrir un programme compose une formule en sous formule
as I guess you are using French Language. Please try to use English Language to write any thing
|
|
|
|
|
|
Please try to use English Language to write any thing.
|
|
|
|
|
I Could not understand the question. Please write it in English.
Aniket.
|
|
|
|
|
I gave same suggestion to OP. everything should be written in English that can understand by everyone
|
|
|
|
|
I recommend that you take your own advice. A few more classes in English will do you some good.
|
|
|
|
|
As if you all are not able to speak other languages
He wants to create some area or document inside another area/document. Not sure about what he's really up to.
But as he is not able to write a complete explanation, he probably does not want a complete answer.
|
|
|
|
|
More or less what I said in the first reply. I don't know why all the others had to repeat it; probably just trying to harvest rep points.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
oh, yeah, must be the reason.
oh look, 10 points again
|
|
|
|
|
hi! This is my class Roster.
public class Roster
{
int[] shift;
int length;
public Roster()
{
length=30;
shift=new int[length];
}
public Roster(int[] s)
{
shift=s;
}
public int[] getShift()
{
return shift;
}
public int getLength()
{
return shift.length;
}
public String display()
{
String out="";
for(int i=0;i<length;i++)
{
out+= shift[i] + " ";
}
return out;
}
}
i'm not sure this coding above is correct or not. Output can't display in text file.hope u all can help me fix this problem
This is main class
public class NurseMain
{ public static void main(String[] arg) throws IOException
{
try
{
FileReader reader = new FileReader("Roster.txt");
BufferedReader in = new BufferedReader(reader);
FileWriter writer1 = new FileWriter("Output.txt");
BufferedWriter bw1 = new BufferedWriter(writer1);
PrintWriter out1 = new PrintWriter(bw1);
FileWriter writer2 = new FileWriter("initialAffinity.txt");
BufferedWriter bw2 = new BufferedWriter(writer2);
PrintWriter out2 = new PrintWriter(bw2);
FileWriter writer3 = new FileWriter("initialClash.txt");
BufferedWriter bw3 = new BufferedWriter(writer3);
PrintWriter out3 = new PrintWriter(bw3);
String input=null;
ArrayList RosterList = new ArrayList();
int length=30;
Roster R = new Roster();
int[] shift=new int[length];
while ((input = in.readLine()) != null)
{
StringTokenizer st = new StringTokenizer(input,",");
for(int i=0;i<shift.length;i++)
{
shift[i]= Integer.parseInt(st.nextToken());
R=new Roster(shift);
}
RosterList.add(R);
}//end while
for(int j=0;j<RosterList.size();j++)
{
R=(Roster)RosterList.get(j);
out1.println(R.display());
}
|
|
|
|
|
the main(args[...]) is incomplete. What's your question?
The class Roster looks quite OK. I would prefer a toString() instead of the display() - that's a more common way. But that's just makeup.
regards Torsten
I never finish anyth...
|
|
|
|
|
i want to count how many shift that equal to 3 in first arraylist.. i don't know how to call it.. thanks
R=(Roster)RosterList.get(0);
{
for(int i=0;i<shift.length;i++)
{
if(R.getShift(i)==3);
{
cnt++;
}
}
System.out.println(cnt);
}
|
|
|
|
|
a bit confusing.
You have a list of roster and a roster has like 30 int values in a array.
while ((input = in.readLine()) != null) {
StringTokenizer st = new StringTokenizer(input,",");
for(int i=0;i<shift.length;i++) {
shift[i]= Integer.parseInt(st.nextToken());
R=new Roster(shift);
}
RosterList.add(R);
}
Is that correct?
You are going through that file "roster.txt". One text line presents a Roster object.
You're reading one integer and renew the Roster object "R" each time (bad - init the Roster object afterwards!).
After that you're adding the filled Roster object to a list "RosterList".
Questions:
- What happens if there are more int values in the line than the initial size of shift (fixed to 30 values)??
- What happens if one value is not valid?
- What to do with FileWriter "out2" and "out3"?
regards Torsten
I never finish anyth...
|
|
|
|