Tuesday, April 10, 2012

Phonegap Android Webview Video plays only audio

I've started to play around with phonegab today. When I was trying to capture video its working fine. Now I wanna show the captured video in the webview. so I was trying as below.



var captureSuccess = function(mediaFiles) {
var i, path, len;
for (i = 0, len = mediaFiles.length; i < len; i += 1) {
path = mediaFiles[i].fullPath;
videoString = "<video width='320' height='240' controls='controls'><source src="+path+" type='video/mp4' /> <source src="+path+" type='video/ogg' /> <source src="+path+" type='video/webm' />Your browser does not support the video tag.</video>";
$('#myVideo').html(videoString);
}


};

// capture error callback
var captureError = function(error) {
navigator.notification.alert('Error code: ' + error.code, null, 'Capture Error');
};

// start video capture
function takeVideo(){
navigator.device.capture.captureVideo(captureSuccess, captureError, {limit:1});
}


but in the UI I see the player being appended but it plays only the audio not the video.. wot could be the problem.??



Any help appreciated and thanks for your time in advance.





javascript how to open a exe on server

im adding some functionality´s on me site and i would like to open some exe´s i have made using vb2010 ,the exe will me on my local server but the site will be hosted in a server some were in the world .



to execute the exe i just need to add boton on the site whit the path to the location of the file on my server? like



  C:\folder\folder\myfile.exe


or there other more easy way to do this ?



thnx for any help





Can't search for all generated terms in lucene index

I'm indexing and searching code using a custom analyzer. Given text "will wi-fi work", following tokens are generated ('will' being a stop-word, is eliminated).



wi-fi {position:2 start:5 end:10}
wifi {position:2 start:5 end:10}
wi {position:2 start:5 end:7}
fi {position:2 start:8 end:10}
work {position:3 start:11 end:15}


When I search for terms wi-fi, work I get search results. However, when I issue any query (phrase/non-phrase) for wifi, wi, fi I don't get any results. Is there anything wrong with the generated tokens?



Parsed search queries:



For wi-fi (works fine)



Lucene's: +matchAllDocs:true +(alltext:wi-fi alltext:wifi alltext:wi alltext:fi)


For wifi (no results returned)



Lucene's: +matchAllDocs:true +alltext:wifi


For "will wi-fi work" (works fine)



Lucene's: +matchAllDocs:true +alltext:"(wi-fi wifi wi fi) work"


For "will wifi work" (no results returned)



Lucene's: +matchAllDocs:true +alltext:"? wifi work"




returning multiple values in web service

I am designing a web-service using java and eclipse which returns the user details who are marked as customer in the database



I was successfully able to return details for a single user (as there was only one entry in the dB) with the following code:



public class GetData {

public LoginDetails getDetails(){
Connection conn;
Statement stmt;
ResultSet rs;

try {
LoginDetails lds=new LoginDetails();
Class.forName(driver);
conn=DriverManager.getConnection(url,username,password);
stmt=conn.createStatement();
String sql="select * from login where usertype='customer'";
rs=stmt.executeQuery(sql);
while(rs.next()){
lds.setUsername(rs.getString(1));
lds.setPassword(rs.getString(2));
lds.setUsertype(rs.getString(3));
lds.setActive(rs.getString(4));

}
return lds;
}
catch(ClassNotFoundException c){
c.printStackTrace();
}
catch (SQLException e) {
e.printStackTrace();
}

return null;
}


}



What should I do if there are multiple values in dB matching the criteria and I want to display them all. Please advice.





Calling a variable from another method

i'm quite new in eclipse and having a problems with calling variables from other methods,such as:



    btnNewButton.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent arg0) {

final JFileChooser fc = new JFileChooser();
int returnVal = fc.showDialog(fc, null);

if (returnVal == JFileChooser.APPROVE_OPTION) {
File prnfile = new File(fc.getSelectedFile().toString());

}

}

});
btnNewButton.setBounds(54, 164, 89, 23);
frame.getContentPane().add(btnNewButton);

JButton btnNewButton_1 = new JButton("print");
btnNewButton_1.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {


File file = new File(prnfile);
int ch;
StringBuffer strContent = new StringBuffer("");
FileInputStream fin = null;
try {
fin = new FileInputStream(file);
while ((ch = fin.read()) != -1)
strContent.append((char) ch);
fin.close();
} catch (Exception e1) {
System.out.println(e);
}



});
btnNewButton_1.setBounds(257, 164, 89, 23


Now,how can i call "prnfile" from the other method?Normally i would create a public object in c# but it doesnt work in Eclipse,so i dunno where to go (being a complete noob :) )





How to integrate log-in credential

Thanks for previous replies,



i am doing mobile application with user log-in, i am maintaining separate database to handle the user log-in details. i want to integrate the facebook and twitter user log-in into my application.(ie) if user having facebook or twitter id, if they use that id to access my application it should be accessible.for example in our stack overflow log in we having different log-in category(facebook,Google). Can anyone guide me how to do this in our own application. I very much eager to learn this kind of knowledge, if i made anything wrong pls let me know.





iOS sending parameter to selector using NSTimers

Is there a way to send a parameter to the selector via a NSTimer ?



myTimer =[NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(removeTheNote:) userInfo:nil repeats:NO];

- (void)removeTheNote:(NSString*)note
{
NSLog(@"Note %@ ----------- REMOVED!",note);
}


I know that using :



myTimer =[NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(removeTheNote:myNote) userInfo:nil repeats:NO];


doesn't work, so I am asking, is there a way to do this?