Get Ubuntu Get Ubuntu

Download Ubuntu now for free, request a free CD or buy it on DVD or CD

Get Support Get Support

Free documentation and community support, or buy professional support

Get Involved Get Involved

Share technical know-how with other users, or help to promote Ubuntu

Get Developing Get Developing

Share your development expertise and help shape the future of Ubuntu

User login

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
2 + 9 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.

Navigation

Who's new

  • xiaqinghua1989
  • pertapacilik
  • saifulfaizan
  • mayonks
  • naiimullah

Who's online

There are currently 0 users and 1 guest online.

Subscribe to Ubuntu Malaysia by e-mail

Delivered by FeedBurner

Search

Java

bizkut's picture

[Please forgive me if this is duplicated information. I did a quick search for it this morning before writing this post and didn't find it. -Peng]

One of the joys of doing a fresh install of Kubuntu 10.04 LTS “Lucid Lynx” is the fact that I needed to track down the fix for Launchpad Bug #535193: Iriverter fails to launch. For those who aren’t familiar with Iriverter it’s en open source cross-platform app for converting videos for use on various digital media players, including players from iriver, who made my E100. The bug first reared its ugly head when I upgraded my system from Ubuntu 9.10 “Karmic Koala” to 10.04 and discovered that iriverter refused to launch anymore. The bug status shows that the fix is released but for some reason when I installed Iriveter again the other day the bug was still there, thus launching my need to find the documentation on how to fix it.

As I stated in my first comment on the bug, iriverter is a critical app for me, in large part due to the fact that it’s the app I use to convert the weather forecast videos that I download daily from my local CBS affiliate so I can carry them on my media player.

(I know, the guys at WBZ would probably prefer I don’t download their videos but I don’t have the luxury of a fancier cell phone with a data plan that lets me watch web videos on it. That and I’m on the go so much every day that I really like having a full forecast at my disposal.)

I won’t give the full data on how iriverter fails, which can be seen on my bug report, but the issue is in the launcher script. As lhassall pointed out on my bug,

The issue is in the /usr/bin/iriverter script.  It refers to
/usr/lib/java/swt-gtk-3.5.jar but the distro contains -3.5.1.jar

A KDE file manager showing the two important directories for this fixYou can confirm part this information by opening /usr/lib/java in your file manager. As the screenshot on the right show I’ve opened Dolphin (one of the KDE file managers) with a split showing both /usr/bin, scrolled to the iriverter launcher file, and /usr/lib/java. As you can see on the right I’ve confirmed that the file I have installed is in fact swt.gtk-3.5.1.jar, as the comment on my bug report shows.

Now we need to open /usr/bin/iriverter for editing. Since it’s a system file you need to open it with root access. I have kde-service-menu-rootactions from Sam Rog’s PPA installed on my system so I can simply right-click the file and select Root Actions > Open as Text from the context menu but you can also open it with gksudo kate /usr/bin/iriverter (substitute your preferred text editor for kate). The iriverter launch script opened in Kate for editingProvide your root password and you should end up with a screen that looks something like the image on the left. You may or may not have line numbering and text wrapping enabled in your editor like I do but the important thing to look for is in line 4.  You will want to change

$CLASSPATH:${prefix}/share/java/iriverter.jar:/usr/lib/java/swt-gtk-3.5.jar org.thestaticvoid.iriverter.ConverterUI $*

to

$CLASSPATH:${prefix}/share/java/iriverter.jar:/usr/lib/java/swt-gtk-3.5.1.jar org.thestaticvoid.iriverter.ConverterUI $*

One you’ve made the edit save the file. Now you should be able to launch iriverter without problem.



Original Source: http://nancib.wordpress.com/2010/08/13/get-iriverter-working-with-ubuntu-lucid/
bizkut's picture

tanya siapa?

this time I am gonna teach you how to implement lucene for the first time, to be able to use it you must first download lucene here and after you had finish downloading it, then you need to find a file named lucene-core-3.0.1.jar or any version will suffice. this jar file contain all the classes that are needed to run your first lucene application. to extract jar files use this command (you can use it in your command prompt).

jar xvf lucene-core-3.0.1.jar

after all the file had been extracted and put into a folder, then you must changed your java working directory to that folder that contain all lucene classes that had been extracted beforehand. so that your program can run properly when you compile it. now open up your editplus and copy this source code.

import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.queryParser.ParseException;
import org.apache.lucene.queryParser.QueryParser;
import org.apache.lucene.search.*;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.RAMDirectory;
import org.apache.lucene.util.Version;

import java.io.IOException;

public class HelloLucene {
  public static void main(String[] args) throws IOException, ParseException {
    // 0. Specify the analyzer for tokenizing text.
    //    The same analyzer should be used for indexing and searching
    StandardAnalyzer analyzer = new StandardAnalyzer(Version.LUCENE_CURRENT);

    // 1. create the index
    Directory index = new RAMDirectory();

    // the boolean arg in the IndexWriter ctor means to
    // create a new index, overwriting any existing index
    IndexWriter w = new IndexWriter(index, analyzer, true,
        IndexWriter.MaxFieldLength.UNLIMITED);
    addDoc(w, "Lucene in Action");
    addDoc(w, "Lucene for Dummies");
    addDoc(w, "Managing Gigabytes");
    addDoc(w, "The Art of Computer Science");
    addDoc(w, "lucene itu sulit.hehe...");
    addDoc(w, "terserah lucene ajah ah");
    w.close();

    // 2. query
    String querystr = args.length > 0 ? args[0] : "lucene";

    // the "title" arg specifies the default field to use
    // when no field is explicitly specified in the query.
    Query q = new QueryParser(
    Version.LUCENE_CURRENT, "title", analyzer).parse(querystr);

    // 3. search
    int hitsPerPage = 10;
    IndexSearcher searcher = new IndexSearcher(index, true);
    TopScoreDocCollector collector =
  TopScoreDocCollector.create(hitsPerPage, true);
    searcher.search(q, collector);
    ScoreDoc[] hits = collector.topDocs().scoreDocs;

    // 4. display results
    System.out.println("Found " + hits.length + " hits.");
    for(int i=0;i<hits.length;++i) {
      int docId = hits[i].doc;
      Document d = searcher.doc(docId);
      System.out.println((i + 1) + ". " + d.get("title"));
    }

    // searcher can only be closed when there
    // is no need to access the documents any more.
    searcher.close();
  }

  private static void addDoc(IndexWriter w, String value) throws IOException {
    Document doc = new Document();
    doc.add(new Field("title", value, Field.Store.YES, Field.Index.ANALYZED));
    w.addDocument(doc);
  }
}

save it as HelloLucene.java and then run it, you will then see an output like this. you should know that beforehand we had 6 indexes in the source code but because we’re searching for the index that had “lucene” word in it then the output will only display 4 index. this means that our first lucene sample application program did work properly.

Photobucket

by using this sample application then you will know how to include lucene in your program properly. actually lucene is not a program, it’s just a collection of java classes that deals directly with searching and whatnot. so that you will find it easier to develop your first search application using lucene.

PS : I am now doing my thesis that deals with using lucene as a helper in building search application, if you had any suggestion whatsoever then feel free to tell me. :-)



Original Source: http://jacobian.web.id/2010/08/09/how-to-use-lucene-part-1/
bizkut's picture

Sheer geeky genius!!!!

Posted via email from timelady’s posterous

Enhanced by Zemanta

Share/Bookmark



Original Source: http://feedproxy.google.com/~r/ItsAboutTime/~3/PYg35pZqg_k/
bizkut's picture

If you’ve been trying to use the Android SDK on Ubuntu 10.04, you might be getting an error like:

No command line parameters provided, launching UI.
See ‘android –help’ for operations from the command line.
Exception in thread “main” java.lang.UnsatisfiedLinkError: no swt-gtk-3550 or swt-gtk in swt.library.path, java.library.path or the jar file
at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
at org.eclipse.swt.internal.C.<clinit>(Unknown Source)
at org.eclipse.swt.internal.Converter.wcsToMbcs(Unknown Source)
at org.eclipse.swt.internal.Converter.wcsToMbcs(Unknown Source)
at org.eclipse.swt.widgets.Display.<clinit>(Unknown Source)
at com.android.sdkmanager.Main.showMainWindow(Main.java:265)
at com.android.sdkmanager.Main.doAction(Main.java:249)
at com.android.sdkmanager.Main.run(Main.java:94)
at com.android.sdkmanager.Main.main(Main.java:83)

If you’re getting this, try installing libswt-gtk-3.5-java and then running the android SDK via: ANDROID_SWT=/usr/lib/java ./android

Hope this helps somebody.



Original Source: http://feedproxy.google.com/~r/PlanetGeorgia/~3/yjxPR9EVKHs/
bizkut's picture

tanya siapa?

If you are experiencing:
Caused by: java.net.SocketException: Network is unreachable

This is most likely because of the Debian bug to force all system using IPv6. According to the reference, you should do:

$ sudo sed -i ’s/net.ipv6.bindv6only\ =\ 1/net.ipv6.bindv6only\ =\ 0/’ \
/etc/sysctl.d/bindv6only.conf && sudo invoke-rc.d procps restart

REFERENCE:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=560044



Original Source: http://staff.blog.ui.ac.id/jp/2010/02/16/java-could-not-connect-to-host/
bizkut's picture

tanya siapa?

JSR268 is a Java specification for accessing Smart Card device (ISO 7816 specification). It is included in Java6 SE specification. To enable it into Debian, don’t forget to install :

# sudo apt-get install libpcsclite-dev

PCSC-lite development package.

Tested on Sun J2SE 6 and OpenJDK 6.



Original Source: http://staff.blog.ui.ac.id/jp/2010/02/11/using-jsr-268/
bizkut's picture

tanya siapa?

GLC Consulting is a trustworthy HR Consulting Firm, with a range of HR Solutions include Consulting and Executive Search utilizing a business system backed by an advanced information system.



Original Source: http://www.bigwisu.com/2010/02/07/vacancy-it-manager-pasuruan-and-sukabumi
bizkut's picture

Oracle has finally taken over Sun Microsystems. Days of darkness are here but how long will it be?
Sun is not only about hardware. What will happen to OpenOffice.org, Java and MySQL? How about the Sun and MySQL Certifications?

How will Jonathan, being the last Sun Microsystem's CEO end his career there?

All the debates are ongoing in the internet but I look forward to Oracle making clear statements on these concerns.



Original Source: http://tboxmy.blogspot.com/2010/01/oracle-has-finally-taken-over-sun.html