|
|
I devloped one java web application for student placement agency.When particular student fill the registration form in the aplication the aplication would be able to send email of confirmation to respective student account.
I am not having email sever.can there is any option to do this functionality and how to do this??
|
|
|
|
|
|
The JavaMail API provides a platform-independent and protocol-independent framework to build mail and messaging applications. The JavaMail API is available as an optional package for use with Java SE platform and is also included in the Java EE platform.
Links:http://www.oracle.com/technetwork/java/javamail/index.html
|
|
|
|
|
|
I want to experience practical problem of threads.
suggest something..
Atul Agraawal
|
|
|
|
|
Make a swing gui program that copies a big file in background with a progressbar on the UI. Make it cancelable with a cancel button.
EDIT: This task might sound silly but I bet a lot of coders are unable to write it correctly. Complete this task and post the source as an answer to this challange, I will check whether you done well or not.
modified 26-Aug-12 11:47am.
|
|
|
|
|
Study this tutorial[^] and try to create a sample based on what you learn.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
How can i create a mobile app to read and scan barcode from Android mobile camera and show the product type. The main issue here is how to focus on the barcode lines and capture their density.
Sahil Mahajan(eMM jAY)
|
|
|
|
|
by developing the project.
Serious, do some search on google, check some library projects and create an idea on how to achieve your goal.
We can't develop a raw idea for you - unless you pay us well.
|
|
|
|
|
I have developed code for the project. but the problem i am facing is with how to focus the camera on barcode lines.
|
|
|
|
|
|
I tried to create and androip app where a user inputs a medicine, qty and hours(per day). After pressing save, the information will be stored at a file and an alarm should be created to trigger every hour (user spicified/hours). The application always stops and there seems to be a lot of error.
Here is how I create it:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_medicinereminder);
MedName = (EditText) findViewById(R.id.MedName);
Qty = (EditText) findViewById(R.id.MedQty);
NoOfHours = (EditText) findViewById(R.id.MedHours);
noh = Integer.parseInt((NoOfHours.getText()).toString());
Button SaveRem = (Button) findViewById(R.id.createRem);
SaveRem.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
try
{
String filePath = getFilesDir().getPath().toString() + "/MedRem.txt";
File myFile = new File(filePath);
myFile.createNewFile();
FileOutputStream fOut = new FileOutputStream(myFile);
OutputStreamWriter myOutWriter = new OutputStreamWriter(fOut);
myOutWriter.append(MedName.getText() + "\n");
myOutWriter.append(Qty.getText() + "\n");
myOutWriter.append(NoOfHours.getText() + "\n");
myOutWriter.close();
fOut.close();
createAlarm(noh);
}
catch (Exception e)
{
Toast.makeText(getBaseContext(), e.getMessage(),
Toast.LENGTH_SHORT).show();
}
}
});
}
public void createAlarm(int noOfHours)
{
//Create an offset from the current time in which the alarm will go off.
Calendar cal = Calendar.getInstance();
cal.add(Calendar.HOUR,noOfHours);
try{
//Create a new PendingIntent and add it to the AlarmManager
Intent alarmIntent = new Intent(this, MyAlarmService.class);
alarmIntent.putExtra("nel.example.alarms1","My message");
PendingIntent pendingAlarmIntent = PendingIntent.getService(this, 0,
alarmIntent, 0);
AlarmManager alarmManager = (AlarmManager)getSystemService(ALARM_SERVICE);
Calendar AlarmCal = Calendar.getInstance();
AlarmCal.setTimeInMillis(System.currentTimeMillis());
AlarmCal.set(Calendar.HOUR_OF_DAY, 0); // set user selection
AlarmCal.set(Calendar.MINUTE, 10); // set user selection
AlarmCal.set(Calendar.SECOND, 0);
alarmManager.setRepeating(AlarmManager.RTC_WAKEUP,
AlarmCal.getTimeInMillis(), AlarmManager.INTERVAL_FIFTEEN_MINUTES,
pendingAlarmIntent);
Toast.makeText(getBaseContext(),
"Medicine Reminder Saved'",
Toast.LENGTH_SHORT).show();
}
catch (Exception e)
{
Toast.makeText(getBaseContext(), e.getMessage(),
Toast.LENGTH_SHORT).show();
}
}
Here is the latest Catlog of my app:
08-22 05:44:29.710: E/Trace(625): error opening trace file: No such file or directory (2)
08-22 05:44:30.430: D/dalvikvm(625): GC_CONCURRENT freed 202K, 3% free 8202K/8455K, paused 28ms+11ms, total 97ms
08-22 05:44:30.430: D/dalvikvm(625): WAIT_FOR_CONCURRENT_GC blocked 70ms
08-22 05:44:30.550: D/dalvikvm(625): GC_FOR_ALLOC freed 250K, 6% free 8260K/8711K, paused 44ms, total 45ms
08-22 05:44:31.100: I/Choreographer(625): Skipped 90 frames! The application may be doing too much work on its main thread.
08-22 05:44:31.132: D/gralloc_goldfish(625): Emulator without GPU emulation detected.
08-22 05:55:55.740: D/AndroidRuntime(625): Shutting down VM
08-22 05:55:55.740: W/dalvikvm(625): threadid=1: thread exiting with uncaught exception (group=0x40a13300)
08-22 05:55:55.780: E/AndroidRuntime(625): FATAL EXCEPTION: main
08-22 05:55:55.780: E/AndroidRuntime(625): java.lang.RuntimeException: Unable to start activity ComponentInfo{dr.droid/dr.droid.MedicineReminder}: java.lang.NumberFormatException: Invalid int: ""
08-22 05:55:55.780: E/AndroidRuntime(625): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
08-22 05:55:55.780: E/AndroidRuntime(625): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
08-22 05:55:55.780: E/AndroidRuntime(625): at android.app.ActivityThread.access$600(ActivityThread.java:130)
08-22 05:55:55.780: E/AndroidRuntime(625): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
08-22 05:55:55.780: E/AndroidRuntime(625): at android.os.Handler.dispatchMessage(Handler.java:99)
08-22 05:55:55.780: E/AndroidRuntime(625): at android.os.Looper.loop(Looper.java:137)
08-22 05:55:55.780: E/AndroidRuntime(625): at android.app.ActivityThread.main(ActivityThread.java:4745)
08-22 05:55:55.780: E/AndroidRuntime(625): at java.lang.reflect.Method.invokeNative(Native Method)
08-22 05:55:55.780: E/AndroidRuntime(625): at java.lang.reflect.Method.invoke(Method.java:511)
08-22 05:55:55.780: E/AndroidRuntime(625): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
08-22 05:55:55.780: E/AndroidRuntime(625): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
08-22 05:55:55.780: E/AndroidRuntime(625): at dalvik.system.NativeStart.main(Native Method)
08-22 05:55:55.780: E/AndroidRuntime(625): Caused by: java.lang.NumberFormatException: Invalid int: ""
08-22 05:55:55.780: E/AndroidRuntime(625): at java.lang.Integer.invalidInt(Integer.java:138)
08-22 05:55:55.780: E/AndroidRuntime(625): at java.lang.Integer.parseInt(Integer.java:359)
08-22 05:55:55.780: E/AndroidRuntime(625): at java.lang.Integer.parseInt(Integer.java:332)
08-22 05:55:55.780: E/AndroidRuntime(625): at dr.droid.MedicineReminder.onCreate(MedicineReminder.java:33)
08-22 05:55:55.780: E/AndroidRuntime(625): at android.app.Activity.performCreate(Activity.java:5008)
08-22 05:55:55.780: E/AndroidRuntime(625): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
08-22 05:55:55.780: E/AndroidRuntime(625): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
08-22 05:55:55.780: E/AndroidRuntime(625): ... 11 more
08-22 05:55:57.971: I/Process(625): Sending signal. PID: 625 SIG: 9
Thanks!
|
|
|
|
|
One of the essential debugging skills is reading what's in front of you.
ljpv14 wrote: 08-22 05:55:55.780: E/AndroidRuntime(625): FATAL EXCEPTION: main
08-22 05:55:55.780: E/AndroidRuntime(625): java.lang.RuntimeException: Unable to start activity ComponentInfo{dr.droid/dr.droid.MedicineReminder}: java.lang.NumberFormatException: Invalid int: ""
tells you that your app crashed because you are trying to parse an empty string as an int.
A few lines further down,
ljpv14 wrote: 08-22 05:55:55.780: E/AndroidRuntime(625): Caused by: java.lang.NumberFormatException: Invalid int: ""
08-22 05:55:55.780: E/AndroidRuntime(625): at java.lang.Integer.invalidInt(Integer.java:138)
08-22 05:55:55.780: E/AndroidRuntime(625): at java.lang.Integer.parseInt(Integer.java:359)
08-22 05:55:55.780: E/AndroidRuntime(625): at java.lang.Integer.parseInt(Integer.java:332)
08-22 05:55:55.780: E/AndroidRuntime(625): at dr.droid.MedicineReminder.onCreate(MedicineReminder.java:33)
even tells you where in your code the problem was encountered.
That may not be the line in error, but it's the one that's blowing up.
Who ever would have thought that we could get so much information from a few lines of error messages?
Oh, by the way, you should be using code blocks when you paste your code.
Peter
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
|
|
|
|
|
I'm stuck with applying the SOLID principle in my code.
Problems:
1) I don't want to violate SRP, so I don't know if the protected members of AbstractScreen are violating this
2) My screen interface should not have this many responsibilities, I probably need to remove them
3) I decided to make a DocumentLoader class to take care of providing my screens with the input and output documents they need in order to display something on the screen. What is displayed depends on the input and output file I give it. Thus I made the DocumentLoaderInterface, with loadDocuments(List<document>).
This is my real problem: where am I going to put the implementation of loadDocuments() if it varies per screen? I can't posssibly go put this code in a screen, because that will give the screen too many responsibilities. If I implement it in the DocumentLoader class, then only one implementation will be available, unless I make several DocumentLoader objects.
Where do I instantiate them? If I call documentLoader.loadDocuments(); then where is the implementation going to be? How do I implement this?.. I'm really stuck.
Please find below my code structure:
package screens:
Screen
AbstractScreen
protected Document inputDocument, outputDocument;
protected SAXBuilder parser;
protected ComponentService componentService;
protected DocumentLoader documentLoader;
ScreenInterface:
public Document getScherm();
public void addComponents();
public Object getC(String key);
public void loadDocuments();
package ui:
TestUi
package utils:
ComponentService
UtilityFactory
package xmlio:
DocumentLoader
DocumentLoaderInterface
XmlIo
XmlIoInterface
//Application Goal:
Have a GUI draw a XAML screen depending on the input XML document. Different documents will produce different charts.
|
|
|
|
|
Working from the bottom up, you should implement all the data logic below the UI layer. Have a class that loads the document, it will know how to interpret the document and get the definitions out. Then have asingle UI class read the data to define itself. This allows different UI's to use the same data class and can make supporting multiple platforms - desktop, tablet, web - much easier as you only need to implement the UI once per UX variant.
Panic, Chaos, Destruction. My work here is done.
Drink. Get drunk. Fall over - P O'H
OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre
I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer
Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett
|
|
|
|
|
From my understanding so far from the Java tutorials, but there was a question I wanted to clarify.
When creation of a Object which isn't static, each decleration of the object with Object object = new Object() will create a new instance,
if it was static wouldn't that mean instead of creating multiple instances, instead of only existing as one instance. As a non static would they then be independent of each other?
public class One{
Object object = new Object();
public static void main(String[] args){
One.start(object);
}
}
public class Two{
Object obj = new Object();
public void start(Object obj){
this.obj = obj;
}
}
|
|
|
|
|
Your understanding is a bit off.
There is no such thing, in Java at least, as a static object. There are classes with static only methods, so no instances are required, and there are singletons, classes which only ever have a single instance.
Each class defines a type of object and how it works, it is not the object itself. Within a class, you can have items defined as static. Static members are shared by all instances of the class and do not actually require an instance to be created; a good example is the main entry method.
Panic, Chaos, Destruction. My work here is done.
Drink. Get drunk. Fall over - P O'H
OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre
I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer
Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett
|
|
|
|
|
Joshhua123 wrote: When creation of a Object which isn't static, each decleration of the object
with Object object = new Object() will create a new instance,
You can have static and non-static member variables. If you have non static member variable as per your example then for each instance of 'One' that you create then the member variable for that instance will point to a different instance of Object.
Joshhua123 wrote: if it was static wouldn't that mean instead of creating multiple instances,
instead of only existing as one instance.
If the member variable was static then there would be only one instance of Object regardless of how many new instances of 'One' you created.
Joshhua123 wrote: As a non static would they then be independent of each other?
As noted above (when it is a non-static member) there is a new Object created each time. They are different so yes they are independent.
|
|
|
|
|
In this code
int i =2;
System.out.print(" Run " + i+1 + " ");
It prints Run 21
Where I would have expected to print Run 3
Amara
'Now I understand how stupid I am, thanks for everybody's contribution.
modified 18-Aug-12 18:54pm.
|
|
|
|
|
The plus operator is left associative so I'd expect 21 as the result. 22 does not make any sense whatsoever. What happens when you put i + 1 in parenthesis like this: (i + 1).
Try that and think about associativity of operators and what it means to the process of evaluation/compilation.
Cheers!
"With sufficient thrust, pigs fly just fine."
Ross Callon, The Twelve Networking Truths, RFC1925
|
|
|
|
|
The reason you are not getting 'Run 3' is because Java is thinking about string concatination. As it is processing from left to right you would see:
"Run 2" + 1 + ""
But this is where it gets a bit strange, I would expect to see the number 1 printed next giving you:
"Run 21"
If you want to add two numbers you must use brackets to indicate priority:
System.out.print("Run "+ (i+1));
|
|
|
|
|
..if the system had these kind of "bugs" or "features", they would have been found by now, don't you think?
|
|
|
|
|
The others have already explained why it is so.
I would like to add into, that the + is an operator and is overloaded in the String class and also used different in the System.out.
Operators in Java[^]
|
|
|
|
|
int i =2;
System.out.print(" Run " +(i+1)+ " ");
This is the code. Keep the brackets.
|
|
|
|