Wikipedia:Reference desk/Archives/Computing/2012 April 5
Computing desk | ||
---|---|---|
< April 4 | << Mar | April | May >> | April 6 > |
Welcome to the Wikipedia Computing Reference Desk Archives |
---|
The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages. |
April 5
editJava EE Issue
editI got the same error as listed in this link:
... while writing a java program using Java EE. The problem is that all the links to fix this issue by getting the required jar file are dead links. Can anyone help me fix my "Stubbed" version of EE or help solve this problem in some other way?
Thanks!
137.81.118.126 (talk) 00:51, 5 April 2012 (UTC)
- Read our reference desk FAQ on asking software questions. You haven't provided enough information to diagnose your problem.
- Your link listed an error message that could result from many different types of problems. The problem in the link was due to a corrupt or missing installation of Java EE. To remedy that problem, you should get and install the Java EE SDK from Oracle. It is impossible to know whether the linked forum-post is identical to your issue, from the information you provided. Nimur (talk) 03:05, 5 April 2012 (UTC)
Valid point. Here is the code in question. I use a full file path as the "f" (file) param.
package myircbot;
import java.util.Date;
import java.util.Properties;
import javax.activation.DataHandler;
import javax.activation.FileDataSource;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.Multipart;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;
public class mailSender
{
public static String to, subject, body, file;
mailSender(String t, String s, String b, String f)
{
to = t;
subject = s;
body = b;
file = f;
}
public void sendEmail()
{
String from = "[email protected]";
Properties properties = new Properties();
properties.put("mail.smtp.host", "smtp.gmail.com");
properties.put("mail.smtp.port", "587");
Session session = Session.getDefaultInstance(properties, null);
try
{
MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress(from));
message.setRecipient(Message.RecipientType.TO, new InternetAddress(to));
message.setSubject(subject);
message.setSentDate(new Date());
// Set the email message text.
MimeBodyPart messagePart = new MimeBodyPart();
messagePart.setText(body);
// Set the email attachment file
MimeBodyPart attachmentPart = new MimeBodyPart();
FileDataSource fileDataSource = new FileDataSource(file)
{
@Override
public String getContentType() { return "application/octet-stream"; }
};
attachmentPart.setDataHandler(new DataHandler(fileDataSource));
attachmentPart.setFileName(file);
Multipart multipart = new MimeMultipart();
multipart.addBodyPart(messagePart);
multipart.addBodyPart(attachmentPart);
message.setContent(multipart);
Transport.send(message);
}
catch (MessagingException e)
{
e.printStackTrace();
}
}
}
I hope this is much more useful. Additionally i would like to note that the libraries i am using are JDK 1.7 (Default), and "Java EE 6 API Library - javaee-api-6.0.jar".
Also here is the error:
Exception in thread "Thread-2" java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/mail/MessagingException at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:791) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) at java.net.URLClassLoader.access$100(URLClassLoader.java:71) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:423) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:356) at myircbot.myChaos.main(myChaos.java:85) at myircbot.myChaos.run(myChaos.java:18) at java.lang.Thread.run(Thread.java:722)
Line 85 of myChaos is where i instantiate an object of type mailSender.
137.81.118.126 (talk) 04:29, 5 April 2012 (UTC)
- Now we have something to go on, at least. As before, I suspect your Java EE installation is malformed, or you have both SE and EE installed, but you are inadvertantly running Java SE. Your mailSender class imports several JavaEE worker-classes (e.g. javax.mail.transport and its siblings). I assert that you can reproduce this issue with far less code than you provided (and you could provide a standalone, compile-able listing).
- How are you running your code? Is it embedded into a Java application server? Have you started the correct EE JVM, or are you using an SE JVM, or are you "not really sure how the JVM is initialized"? If it is the latter, then we need to attack that problem first, before we spend any time diagnosing a classloader problem. Nimur (talk) 15:22, 5 April 2012 (UTC)
I am using Netbeans to compile this. I guess I'm "not sure which JVM is initialized" but i dont know how this could be J2SE, as i uninstalled that in favor of J2EE with JDK7.
The Java EE6 API library comes from C:\Program Files\NetBeans 7.0.1\enterprise\modules\ext.
137.81.118.126 (talk) 15:54, 5 April 2012 (UTC)
Red alert! i somehow found a "Java Platform Manager" in netbeans and it seems that JDK 1.7 default is J2SE. The classes all come from C:\glassfish3\jdk7\jre\lib\ . So even though i installed J2EE, and glassfishi s the folder that it goes to, im running J2SE??? How do i fix this within netbeans? Surely J2EE came with J2EE components? o.0
137.81.118.126 (talk) 16:11, 5 April 2012 (UTC)
Solved! I didnt even have the java mail thing.... LOL
137.81.118.126 (talk) 19:27, 5 April 2012 (UTC)
- Excellent. The first thing you really learn, when you migrate from SE to EE, is that you always have more than one version of Java on your machine. The second thing you usually learn is, you've probably been using the wrong version of Java to run your program. Glad to see it got fixed. Nimur (talk) 01:43, 6 April 2012 (UTC)
What does this text mean please??
editlink - Kittybrewster ☎ 14:47, 5 April 2012 (UTC)
- That page is a 404 "Sorry. Something has gone wrong" error for me -- Finlay McWalterჷTalk 15:03, 5 April 2012 (UTC)
- (ec) It is a custom error-page sent in response to an HTTP 404 error. Strictly, all we know is that the server reported that it couldn't find "sse.dll" - are you sure this file is present on the server? From context of the URL, I can infer a little bit more, but with less certainty. This appears to be your website; and it looks like you attempted to install a program in your common gateway interface directory to perform a US Census lookup. The program may actually be missing on the server, so the 404 may be correct. However, if the server permissions are incorrect, i.e. you cannot launch a DLL-based CGI tool, or if something else went wrong, the server may also report 404 when it should actually send HTTP 500 ("internal server error," or a similar more specific code). I have also formatted your link text; this will not affect any subsequent efforts to diagnose the issue, but makes the Reference Desk render it better. Nimur (talk) 15:11, 5 April 2012 (UTC)
- I means the page isn't there anymore,sorry .-- 76MansliaT~ 74.163.16.52 (talk) 15:25, 5 April 2012 (UTC)
- Thanks to the IP above for ID'ing himself as a sock of a banned user. See User:Salvidrim/Tailsman67. ←Baseball Bugs What's up, Doc? carrots→ 22:58, 5 April 2012 (UTC)
- Pruning the link a bit to http://www.kittybrewster.com/cgi-bin/ I get a HTTP 403 error, which is not unusual. However, it also says: «Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.» So the 404 Error on the original full link might perhaps be related in that you redirect 403 Errors and 500 Errors (internal server error) to the 404 error page? -Laniala (talk) 15:45, 5 April 2012 (UTC)
- It is my website but the query did not come from me. Kittybrewster ☎ 17:55, 5 April 2012 (UTC)
- Hmm, so you're not wondering what the response from your server means or why you got that 404 error? But you are wondering what the text in the URL means or why you got that strange looking query? If that is the case it is trying to run
./cgi-bin/sse.dll
(if there is no such file on your server then that is of course the reason for the 404 error).
- Hmm, so you're not wondering what the response from your server means or why you got that 404 error? But you are wondering what the text in the URL means or why you got that strange looking query? If that is the case it is trying to run
- It is my website but the query did not come from me. Kittybrewster ☎ 17:55, 5 April 2012 (UTC)
http://www.kittybrewster.com/cgi-bin/sse.dll?indiv=1&rank=1&gsfn=&afsrc=%3Cscript%3Ealert%2812345678%29%3C/script%3E&gsln=Arbuthnot&sx=&f5=&f4=&f7=&f14=&f21=&Server=search&DatabaseID=6061&db=1920usfedcen&ti=0&type=p&title=1920+U.S.+Federal+Census&submit.x=68&submit.y=12&o_xid=0013174552&o_lid=0013174552&o_xt=26656834&gss=angs&fh=12&fsk=BEFk3S4IgAAB0wAgB6M=&bsk=&recid=2175256&recoff=2 indiv=1 rank=1 gsfn= afsrc=%3Cscript%3Ealert%2812345678%29%3C/script%3E = <script>alert(12345678)</script> gsln=Arbuthnot sx= f5= f4= f7= f14= f21= Server=search DatabaseID=6061 db=1920usfedcen ti=0 type=p title=1920+U.S.+Federal+Census submit.x=68 submit.y=12 o_xid=0013174552 o_lid=0013174552 o_xt=26656834 gss=angs fh=12 fsk=BEFk3S4IgAAB0wAgB6M= bsk= recid=2175256 recoff=2
- If this dll has any security vulnerabilities I have no idea. But without knowing more of what your site is actually accepting of queries, then it could perhaps (wild guess) have been a random attempt at exploiting such a thing. I'm sure somebody else has more ideas (if this is actually what you're wondering). -Laniala (talk) 11:42, 6 April 2012 (UTC)
How do you know the page number for a book in the Kindle app for the iPad or Windows?
editI want to be able to cite a book I bought on Kindle, but I can't seem to figure out what page number I'm on. It says I'm at location 1970 out of 6998. I need to know the page number. Anyone know? A Quest For Knowledge (talk) 15:36, 5 April 2012 (UTC)
- Page numbers depend on edition. There is no reason why a dynamically reflowed e-book edition would even have a page number. I suggest you cite the edition and the given location. If our citation templates are insufficient, we should adapt them to reality, not the other way round. Reality is quite hard to bend, even if Steve Jobs or James Randi may give a different impression. --Stephan Schulz (talk) 15:43, 5 April 2012 (UTC)
- At minimum, you should give a chapter/section name or number, if available. Some style guides (I think the MHRA) recommend you give a paragraph number (by counting paragraphs), but this may not be practical. One solution, which is non-standard but could be helpful, is to give the first few words of the paragraph ("Paragraph starting 'Foo bar baz'"). If it's a direct quote, someone can search the book, so you don't need to be so precise. I've no idea if location numbers are portable/consistent across devices, or between EPUB/Kindle/PDF versions, so it would be better not to rely on them. --Colapeninsula (talk) 09:08, 6 April 2012 (UTC)
- eBooks don't really have accurate page numbers due to zoom and all sorts of issues. However, I did find the citation methods for both APA and MLA. APA eBook citation MLA eBook Citation 206.131.39.6 (talk) 16:04, 9 April 2012 (UTC)
- Apparently, someone's already thought of this: WP:EBOOK. A Quest For Knowledge (talk) 21:25, 10 April 2012 (UTC)
Secret Online Ballot
editHello. From an IT point of view, is it possible to cast a secret ballot online? If voters login to confirm their eligibility, it is possible to match the ballot to the identity of the voter? Or do online voters just have to take a leap of faith in the website's privacy policy? Thanks in advance. --Mayfare (talk) 17:28, 5 April 2012 (UTC)
- Take a look at End-to-end auditable voting systems and Prêt à Voter. Some others of interest might be ThreeBallot and this blog post by Bruce Schneier. There are a number of secure voting protocols. I don't think that's what most governments are using, however. Shadowjams (talk) 21:23, 5 April 2012 (UTC)
- More basically, any "private key" encryption method can safely identify the sender of a value as paired with a public key you can store in your voting system's records. However, if you don't have a "trusted" entity that can tally your votes, then there is, of course, no practical way of securing the identities while aggregating the votes. It sounds like your situation is down to one of trust, and not of technical limitations. 162.111.235.36 (talk) 17:25, 9 April 2012 (UTC)
Intel processor in a consumer electronics device
editIf anyone of Intel's Atom processors were ever to be used in a portable media player similar to an iPod Classic, iPod Nano, or iPod touch which on be used? I am thinking an E6xx (Tunnel Creek), maybe an E620. --Melab±1 ☎ 22:55, 5 April 2012 (UTC)
Is an E620 too powerful and inefficient? --Melab±1 ☎ 01:05, 6 April 2012 (UTC)
- Does anyone care to respond? --Melab±1 ☎ 00:20, 10 April 2012 (UTC)
- What's the actual question? Are you asking people to speculate? or are you asking for specific industry "insider knowledge"? It seems Atoms are more media box rather then portable media player which seem to be sewn up at the moment by [[ARM architecture] processors. Intel seems poised to enter the mobile market and their main hurdle does indeed seem to be power consumption, but price and performance are also factors. Here is a recent article about atom v arm. Vespine (talk) 01:37, 10 April 2012 (UTC)
- I was asking for educated guesses—that's usually the kind of answer I think I receive. Sometimes a person who works with computers can synthesize an answer. --Melab±1 ☎ 20:42, 10 April 2012 (UTC)
Facebook link dead? Name change form
edithttps://www.facebook.com/help/contact_us.php?id=262629790471076
Does this link work? It did as of March 24, when I discovered it. It was a new form for changing the name of your Facebook Brand Page. Today, once my boss at the museum gives me the go ahead? Not working. Is it just me? -- Zanimum (talk) 23:31, 5 April 2012 (UTC)
- That link doesn't give me anything but a blank page. This page says that it's not possible to change the name of your business page if you have more than 100 likes. (Seems like an arbitrary number to me but it's their number) If you have more than 100 likes then you'll have to delete and recreate the page. Dismas|(talk) 23:44, 5 April 2012 (UTC)
- Thanks for clicking, and reporting. The 100 page rule existed for a year or more, but was replaced when Timelines were first made available to Pages. As soon as they've rolled all Pages over to Timeline, they've blanked the page. I don't get it. The link above [https://www.google.ca/search?source=ig&hl=en&rlz=&q=https%3A%2F%2Fwww.facebook.com%2Fhelp%2Fcontact_us.php%3Fid%3D262629790471076&btnG=Google+Search was published on 565 pages, URL exposed, and likely hundreds more just as a link. Sigh, I guess we may have to force our fans to move over to a new page. -- Zanimum (talk) 14:58, 7 April 2012 (UTC)