In my asp.net page i have java script calendar,on which i want the selected date & then that date has to passed to the code behind's method. How should it be done???
are there any frameworks for php that follow the style of vaadin,
in vaadin you can define web forms using java with touching javascript or any client scripting in swing style ?
More or less I want to execute two functions in parallel.
One way as I see is doing through SetTimeOut function.
I have not completely gone through the ReactiveExentension, although it looks promising but may be overkill for my needs.
Is there any framework which supports parallelism ?
My use case is trivial, but I would like to know if anybody heavily needed parallelism in Java Script ?
Thanks, Biswanath.
In my project,I will get the coordinates of some points from an XML file,and create some visual components using this information ? I am planning to give these components to a Java swing frame or panel. However,The users are supposed to click on the figure(which I will construct using Graphics 2d libraries) and select two points and give a label to the points between those two points ? How can i get the clicks clicked on JFrame or JPanel(i.e events for this kind of actions) ?
i need the source code of an application that can upload and download automatically from the remote computer (FTP) using java langauge. if any body gey help or the code, kindly contact me through my mail address [email protected]. thanks
Hello,
I would like to know and get an implementation help, if possible,
about the best way to transfer very large amount to pure text from C
to Java using JNI.
thank you
I am looking in to learning a programming language (take a course) for image analysis and processing. Possibly Bioinformatics too. Which language should I go for? C or Java? Other languages are not an option for me. Also please explain why either of the languages is a better option for my application.
how to delete the div using java script?
for details,
I have question div one by one, each question have up and down arrows, it have multiple div, and also have a save button, once i checked some question and press save button, the checked question are display blocked, others are none, In that time i click up and down arrows, it will moved included hided div also, so please help the same,
Thnks
I cant seem to open a new view from an options menu item. The program keeps crashing as it applies the intent and listener to the item. I am just beginning, so please be nice.
The current view is mnfsms, and the view I am trying to open is mnfsms_settings. I am developing for 1.5.
Could someone please help me get the menu working.
The menu (called options_menu.xml):
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/settings_button"
android:title="Settings"
android:icon="@android:drawable/ic_menu_preferences" />
<item android:id="@+id/about_button"
android:title="About"
android:icon="@android:drawable/ic_menu_myplaces" />
</menu>
The main view (called mnfsms.java):
package com.example.mnfsms;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
public class mnfsms extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
/* OnClickListener myocl = new View.OnClickListener() {
public void onClick(View v){
Intent myi = new Intent(mnfsms.this, mnfsms_settings.class);
startActivity(myi);
}
};*/
}
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.options_menu, menu);
MenuItem mi_settings = (MenuItem)findViewById(R.id.settings_button);
mi_settings.setIntent(new Intent(this, mnfsms_settings.class));
return true;
}
}
The manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mnfsms"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".mnfsms" android:label="@string/main_window_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".mnfsms_settings" android:label="string/main_window_name">
</activity>
</application>
<uses-sdk android:minSdkVersion="3" />
</manifest>
The stacktrace:
01-06 15:07:58.045: ERROR/AndroidRuntime(2123): Uncaught handler: thread main exiting due to uncaught exception
01-06 15:07:58.055: ERROR/AndroidRuntime(2123): java.lang.NullPointerException
01-06 15:07:58.055: ERROR/AndroidRuntime(2123): at com.example.mnfsms.mnfsms.onCreateOptionsMenu(mnfsms.java:30)
01-06 15:07:58.055: ERROR/AndroidRuntime(2123): at android.app.Activity.onCreatePanelMenu(Activity.java:2038)
01-06 15:07:58.055: ERROR/AndroidRuntime(2123): at com.android.internal.policy.impl.PhoneWindow.preparePanel(PhoneWindow.java:421)
01-06 15:07:58.055: ERROR/AndroidRuntime(2123): at com.android.internal.policy.impl.PhoneWindow.onKeyDownPanel(PhoneWindow.java:664)
01-06 15:07:58.055: ERROR/AndroidRuntime(2123): at com.android.internal.policy.impl.PhoneWindow.onKeyDown(PhoneWindow.java:1278)
01-06 15:07:58.055: ERROR/AndroidRuntime(2123): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1735)
01-06 15:07:58.055: ERROR/AndroidRuntime(2123): at android.view.ViewRoot.deliverKeyEventToViewHierarchy(ViewRoot.java:2188)
01-06 15:07:58.055: ERROR/AndroidRuntime(2123): at android.view.ViewRoot.handleFinishedEvent(ViewRoot.java:2158)
01-06 15:07:58.055: ERROR/AndroidRuntime(2123): at android.view.ViewRoot.handleMessage(ViewRoot.java:1490)
01-06 15:07:58.055: ERROR/AndroidRuntime(2123): at android.os.Handler.dispatchMessage(Handler.java:99)
01-06 15:07:58.055: ERROR/AndroidRuntime(2123): at android.os.Looper.loop(Looper.java:123)
01-06 15:07:58.055: ERROR/AndroidRuntime(2123): at android.app.ActivityThread.main(ActivityThread.java:3948)
01-06 15:07:58.055: ERROR/AndroidRuntime(2123): at java.lang.reflect.Method.invokeNative(Native Method)
01-06 15:07:58.055: ERROR/AndroidRuntime(2123): at java.lang.reflect.Method.invoke(Method.java:521)
01-06 15:07:58.055: ERROR/AndroidRuntime(2123): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
01-06 15:07:58.055: ERROR/AndroidRuntime(2123): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
01-06 15:07:58.055: ERROR/AndroidRuntime(2123): at dalvik.system.NativeStart.main(Native Method)
OS name: "linux" version: "2.6.32-27-generic" arch: "i386" Family: "unix"
Apache Maven 2.2.1 (r801777; 2009-08-06 12:16:01-0700)
Java version: 1.6.0_20
I am trying to use the mysql dependency in with maven in ubuntu. If I move the "mysql-connector-java-5.1.14.jar" file that maven downloaded into my $JAVA_HOME/jre/lib/ext/ folder, everything is fine when I run the jar.
I think I should be able to just specify the dependency in the pom.xml file and maven should take care of setting the classpath for the dependency jars automatically. Is this incorrect?
My pom.xml file looks like this:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.ion.common</groupId>
<artifactId>TestPreparation</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>TestPrep</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>com.ion.common.App</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<!-- JUnit testing dependency -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<!-- MySQL database driver -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.14</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
The command "mvn package" builds it without any problems, and I can run it, but when the application attempts to access the database, this error is presented:
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:186)
at com.ion.common.Functions.databases(Functions.java:107)
at com.ion.common.App.main(App.java:31)
The line it is failing on is:
Class.forName("com.mysql.jdbc.Driver");
Can anyone tell me what I'm doing wrong or how to fix it?
My application has a SQLite database in the asset folder. When the user launches my application, the database is created and the tables too.
This works fine with a lot of devices (Nexus One, Htc Magic, SGS, X10… and even Htc Desire HD v2.2).
My application works with all versions of Android (tested on my device (1.6, 2.2, 2.2.1 Htc Magic) and on the emulator (v1,5 until v2.3).
I have just a problem with HTC DESIRE HD v2.2.1 1.72.405.3.
The logcat:
android.database.sqlite.SQLiteException: no such table: LISTE: , while compiling: select _id from LISTE
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2833)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2854)
at android.app.ActivityThread.access$2300(ActivityThread.java:136)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2179)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:143)
at android.app.ActivityThread.main(ActivityThread.java:5068)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.database.sqlite.SQLiteException: no such table: LISTE: , while compiling: select _id from LISTE
at android.database.sqlite.SQLiteCompiledSql.native_compile(Native Method)
at android.database.sqlite.SQLiteCompiledSql.compile(SQLiteCompiledSql.java:91)
at android.database.sqlite.SQLiteCompiledSql.(SQLiteCompiledSql.java:64)
at android.database.sqlite.SQLiteProgram.(SQLiteProgram.java:80)
at android.database.sqlite.SQLiteQuery.(SQLiteQuery.java:46)
at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:53)
at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1417)
at android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1387)
... 11 more
My application create the database but it doesn’t copy the tables of the file of the asset folder in data\data\packagename\databases\mydatabase.
My code:
public void createDataBase() throws IOException{
boolean dbExist = checkDataBase();
if(dbExist){
//do nothing - database already exist
}else{
//By calling this method and empty database will be created into the default system path
//of your application so we are gonna be able to overwrite that database with our database.
this.getReadableDatabase();
try {
copyDataBase();
} catch (IOException e) {
throw new Error("Error copying database");
}
}
}
private void copyDataBase() throws IOException{
//Open your local db as the input stream
InputStream myInput = myContext.getAssets().open(DB_NAME);
// Path to the just created empty db
String outFileName = DB_PATH + DB_NAME;
//Open the empty db as the output stream
OutputStream myOutput = new FileOutputStream(outFileName);
//transfer bytes from the inputfile to the outputfile
byte[] buffer = new byte[1024];
int length;
while ((length = myInput.read(buffer))!= -1){
if (length > 0){
myOutput.write(buffer, 0, length);
} }
//Close the streams
myOutput.flush();
myOutput.close();
myInput.close();
}
I think that the copydatabase function has a problem but I don't see.
This code works fine with all devices except the HTC DESIRE HD v2.2.1 1.72.405.3.
What problems might exist here for the HTC Desire with the given version above? How can this be remedied?
I think Eclipse is trying to make me miserable. A couple of hours ago, my project was working and compiling well. Suddenly that all changed. Eclipse somehow wipes out all changes I have made to my files(activity, manifest etc.) I make sure to save often but when I go to run the project, I get the error that I have a build error. I checked and there was none, so I go to close Eclipse, so I can reopen and see if the errors will go away. Instead what happens is Eclipse wipes clean all my files and I end up with a project on disk with lots of blank code files. I try to run anyway, and I get the error message below.
Failed to read the project description file (.project) for 'com.example.android.nfc.simulator.FakeTagsActivity.FakeTagsActivity'. The file has been changed on disk, and it now contains invalid information. The project will not function properly until the description file is restored to a valid state.
Anyone have an idea what in the world this is about and how I can rectify this?
In my web-application, I have various audio clips uploaded by the users in the database stored in the BLOB column. The audio files are low bit rate WAV files. The clips are secured, one can see only those clips he has uploaded. Instead of user downloading the clip and playing it in his player, I need it be steamed online in the web page itself. In the jsp I use the <audio> tag with the source mapping to the controller mappping url.
<td> <audio controls><source src="recfile/${au.id}" type="audio/mpeg" /></audio> </td>
Where, the recfile is the request mapping and the au.id is the audio id. In the controller I process the request like below
@RequestMapping(value = "/recfile/{id}", method = RequestMethod.GET,
produces = { MediaType.APPLICATION_OCTET_STREAM_VALUE })
public HttpEntity<byte[]> downloadRecipientFile(@PathVariable("id") int id,
ModelMap model, HttpServletResponse response) throws IOException,
ServletException {
LOGGER.debug("[GroupListController downloadRecipientFile]");
VoiceAudioLibrary dGroup = audioClipService.findAudioClip(id);
if (dGroup == null || dGroup.getAudioData() == null
|| dGroup.getAudioData().length <= 0) {
throw new ServletException("No clip found/clip has not data, id="
+ id);
}
HttpHeaders header = new HttpHeaders();
I tried this too
//header.setContentType(new MediaType("audio", "mp3"));
header.setContentType(new MediaType("audio", "vnd.wave");
header.setContentLength(dGroup.getAudioData().length);
return new HttpEntity<byte[]>(dGroup.getAudioData(), header);
}
When the jsp loads, the controller get the request, it serves back the audio data fetched from the database, the jsp too shows the player with the controls. But when I play it nothing happens. Why is it? Am I missing anything in the configuration? Am I doing it right?
I'm using @JsonTypeInfo to instruct Jackson to look in the @class property for concrete type information. However, sometimes I don't want to have to specify @class, particularly when the subtype can be inferred given the context. What's the best way to do that?
Here's an example of the JSON:
{
"owner": {"name":"Dave"},
"residents":[
{"@class":"jacksonquestion.Dog","breed":"Greyhound"},
{"@class":"jacksonquestion.Human","name":"Cheryl"},
{"@class":"jacksonquestion.Human","name":"Timothy"}
]
}
and I'm trying to deserialize them into these classes (all in jacksonquestion.*):
public class Household {
private Human owner;
private List<Animal> residents;
public Human getOwner() { return owner; }
public void setOwner(Human owner) { this.owner = owner; }
public List<Animal> getResidents() { return residents; }
public void setResidents(List<Animal> residents) { this.residents = residents; }
}
public class Animal {}
public class Dog extends Animal {
private String breed;
public String getBreed() { return breed; }
public void setBreed(String breed) { this.breed = breed; }
}
public class Human extends Animal {
private String name;
public String getName() { return name; }
public void setName(String name) { this.name = name; }
}
using this config:
@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY, property = "@class")
private static class AnimalMixin {
}
//...
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.getDeserializationConfig().addMixInAnnotations(Animal.class, AnimalMixin.class);
Household household = objectMapper.readValue(json, Household.class);
System.out.println(household);
As you can see, the owner is declared as a Human, not an Animal, so I want to be able to omit @class and have Jackson infer the type as it normally would.
When I run this though, I get
org.codehaus.jackson.map.JsonMappingException: Unexpected token (END_OBJECT),
expected FIELD_NAME: missing property '@class' that is to contain type id (for class jacksonquestion.Human)
Since "owner" doesn't specify @class.
Any ideas? One initial thought I had was to use @JsonTypeInfo on the property rather than the type. However, this cannot be leveraged to annotate the element type of a list.
I just upgraded to m2eclipse version 0.10 which includes an embedded Maven 3 and I'm now getting the following error when trying to run a build. I've already set Maven-Installations to my Maven 2 installation, but it had no effect. How do I resolve this?
[INFO] Scanning for projects...
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR] The project com.stuff:sutff-web:0.0.1-SNAPSHOT (C:\development\taylor\stuff\pom.xml) has 1 error
[ERROR] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: com.google.appengine:appengine-api-labs:jar -> duplicate declaration of version ${gae.version}
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
How can I set a fixed width for an Android button? Everytime I try to set a fixed width it fills the current parent (the RelativeView). Here is my XML:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout android:id="@+id/relativelayout" android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android">
<EditText android:layout_height="wrap_content" android:editable="false" android:layout_width="fill_parent" android:id="@+id/output"></EditText>
<Button android:layout_height="wrap_content" android:id="@+id/Button01" android:layout_below="@id/output" android:text="7" android:layout_width="wrap_content"></Button>
<Button android:layout_below="@id/output" android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/Button02" android:layout_toRightOf="@+id/Button01" android:text="8"></Button>
<Button android:layout_below="@id/output" android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/Button03" android:layout_toRightOf="@+id/Button02" android:text="9"></Button>
</RelativeLayout>
How would I give it a FIXED width?
Hi all,
I have a report to be printed / exported to PDF format. for that i am using jasper reports. I have 8 individual pages to be exported. so i prepared 8 separate design files. In that 6 pages are having more static text and mere direct mapping and remaining two pages consists of table like data. one page contains huge table so i filled it directly with no problem by keeping a single table in detail band. now problem is that remaining one page. that page is having more than 5 small tables (two or four column). is t possible to have more that one table in a page in jasper reports ? i am using jasper reports and for designing jasper assistant/ireports.
Hi,
I need help in setting up value and display text in spinner.
as per now I am populating my spinner by array adapter e.g
mySpinner.setAdapter(myAdapter);
and as far as I know after doing this the display text and the value of spinner at same position is same. The other attribute that I can get from spinner is the position on the item.
now in my case I want to make spinner like the drop down box, which we have in .NET.
which holds a text and value.
where as text is displayed and value is at back end.
so if I change drop down box , I can either use its selected text or value.
but its not happening in android spinner case.
For Example:
Text Value
Cat 10
Mountain 5
Stone 9
Fish 14
River 13
Loin 17
so from above array I am only displaying non-living objects text, and what i want is that when user select them I get there value i.e. like when Mountain selected i get 5
I hope this example made my question a bit more clear...
thankx
Hi,
I am trying to add some text validation to an edit text field located within an alert dialog box. It prompts a user to enter in a name.
I want to add some validation so that if what they have entered is blank or null, it does not do anything apart from creating a Toast saying error.
So far I have:
AlertDialog.Builder alert = new AlertDialog.Builder(this);
alert.setTitle("Record New Track");
alert.setMessage("Please Name Your Track:");
// Set an EditText view to get user input
final EditText trackName = new EditText(this);
alert.setView(trackName);
alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
String textString = trackName.getText().toString(); // Converts the value of getText to a string.
if (textString != null && textString.trim().length() ==0)
{
Context context = getApplicationContext();
CharSequence error = "Please enter a track name" + textString;
int duration = Toast.LENGTH_LONG;
Toast toast = Toast.makeText(context, error, duration);
toast.show();
}
else
{
SQLiteDatabase db = waypoints.getWritableDatabase();
ContentValues trackvalues = new ContentValues();
trackvalues.put(TRACK_NAME, textString);
trackvalues.put(TRACK_START_TIME,tracktimeidentifier );
insertid=db.insertOrThrow(TRACK_TABLE_NAME, null, trackvalues);
}
But this just closes the Alert Dialog and then displays the Toast. I want the Alert Dialog to still be on the screen.
Thanks
I just started working with the Android, but seem to have come across a problem that I simply can't find the answer to. I get the error "Cannot cast from View to Button" on this line :
Button myButton = (Button)findViewById(R.id.my_button);
I've tried many different things to get it going, and I've searched for the answer, but for some reason it just refuses to work right. If anybody could point me in the right direction it'd be most appreciated.
Thank you in advance.
I am trying to remove the JAXBElement wrapper from a field that was a substitution group in my schema. I have tried both
<jaxb:globalBindings generateElementProperty="false"/>
and
<jaxb:globalBindings>
<xjc:generateElementProperty>false</xjc:generateElementProperty>
</jaxb:globalBindings>
But in both cases it seems to be completely ignored.
Is there a problem trying to use this for substitution groups or am I missing something?
I'm trying to use the SmugFig SmugMug API on Android. It was designed for J2SE I would imagine, so I'm not sure it will even work on Android, but I figured it was worth trying as opposed to trying to create my own API.
When I load the project though, I get the following error:
Conversion to Dalvik format failed: Unable to execute dex: null
It doesn't say what package it fails on, just "Android Packaging Problem", but it did not do this before I added SmugFig and it's dependency JARS to the build path.
Where should I look? Or does this mainly me that it just won't work with those libraries?