Posts
 
Reputation
Joined
Last Seen
0 Reputation Points
Unknown Quality Score

No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.

0 Endorsements
~15.1K People Reached
Favorite Tags

39 Posted Topics

Member Avatar for winecoding

I am trying to do some text processing tasks against a collection of files stored in a directory. The data set is just standard 20-newsgroup data. However, running the following code segement gives error message such as `UnicodeDecodeError: 'utf8' codec can't decode byte 0x80 in position 240: invalid start byte` …

Member Avatar for vegaseat
0
399
Member Avatar for winecoding
Member Avatar for winecoding

I have been using some open source software, like weka/mallet to fulfill certain data analytics works. I know how to use the APIs of these softwares and write customized code under Eclipse. Right now, I would like to learn how to make this type of data analytics work as a …

Member Avatar for winecoding
0
183
Member Avatar for winecoding

I am trying to use a Weka method, crossValidateModel, which is posted in the last. It looks like that the fifth parameter is referred to as varargs parameter. I tried the example usage given in Weka page, such as [CODE]eval.crossValidateModel(cls, data, folds, rand);[/CODE] It works just fine on one system,(eclipse+Ubuntu); …

Member Avatar for ~s.o.s~
0
213
Member Avatar for winecoding

I have the following hashed structure [CODE]$chainStorage{$R1}{$S1}{$C1}{@A1}[/CODE] [QUOTE]$chainStorage = { 'ACB' => { 'E' => '06' => [100, 200, 95] 'B' => '23' => [20, 1000, 05, 30] }, 'AFG' => { 'C' => '24' => [18, 23, 2300, 3456] }, 'HJK' => { 'A' => '12' => [24, 25, …

Member Avatar for d5e5
0
451
Member Avatar for winecoding

I happen to read the following code segment from Thinking in Java [CODE]public class PetCount3 { static class PetCounter extends LinkedHashMap<Class<? extends Pet>,Integer> { public PetCounter() { super(MapData.map(LiteralPetCreator.allTypes, 0)); } public void count(Pet pet) { // Class.isInstance() eliminates instanceofs: for(Map.Entry<Class<? extends Pet>,Integer> pair : entrySet()) if(pair.getKey().isInstance(pet)) put(pair.getKey(), pair.getValue() + 1); …

Member Avatar for JamesCherrill
0
165
Member Avatar for winecoding

I have a generic text file, which can be composed of text data and numerical values, like an article. It can have multiple paragraphs/lines and have various types of delimiters. My general purpose is to tokenize this text file into a string array. I am quite confusing on how to …

Member Avatar for JamesCherrill
0
250
Member Avatar for winecoding

I have a csv file or an excel file, which is a mix of numerical values and text information. For instance 1 Paragraph1 2 Paragraph2 In this file, the cell of (first row, first column) has a numerical value of 1; on the other hand, the cell of (first row, …

Member Avatar for WaltP
0
112
Member Avatar for winecoding
Member Avatar for winecoding

In my current program, the input information is hard coded. For instance [CODE]final String titleFieldName = "title1";[/CODE] If I want to change title1 to title2, I have to modify the source code and click "run Java application" in Eclipse. How can I change the program to allow the user dynamically …

Member Avatar for stultuske
0
232
Member Avatar for winecoding

I am trying to list all of the files including a function, e.g., matrixCal. How to do that in linux. Thanks.

Member Avatar for Go_bots
0
179
Member Avatar for winecoding

I opened the .bashrc file on a system, which includes [CODE]export JAVA_HOME=/usr/lib/jvm/java-1.6.0-sun.x86.64[/CODE] After typing [CODE]whereis java[/CODE], the system prints out [CODE]java: /usr/bin/java /etc/java /usr/lib/java /usr/share/java /usr/share/man/man1/java.1.gz [/CODE] It seems to me that none of the above path matches the JAVA_HOME set up in bashrc file. Can you let me know …

Member Avatar for stultuske
0
250
Member Avatar for winecoding

I once saw the following script in a bashrc file, which is [CODE]export PATH=.:$PATH:$M2_HOME/bin[/CODE] I don't know what does . (the first dot point after =) mean here? Then, what is the resulting path after this kind of setup?

Member Avatar for rubberman
0
120
Member Avatar for winecoding

My program includes a code segment as following: [CODE]for (int j1 =0; j1<2;j1++) { for (int j2 =0; j2<2;j2++) { System.out.println("j1="+j1+"j2="+j2+" "+temp1.get(j1)+"----"+temp2.get(j2)); if (temp1.get(j1)==temp2.get(j2)) { System.out.println("find match"); } } }[/CODE] The program prints out sth like j1=0j2=0 7698380----7698380 the difference is 0 j1=0j2=1 7698380----7726365 the difference is -27985 j1=1j2=0 7726365----7698380 …

Member Avatar for JamesCherrill
0
177
Member Avatar for winecoding

I have a string, which is read from a database. The string can be just "null". I need to decide whether it is null or not? Among the following ones, what is the appropriate way to do it? [CODE]String a = …; If (a == null) If ( a.length == …

Member Avatar for mKorbel
0
159
Member Avatar for winecoding

For the computation involving multiple types of variables, such as integer and double, is the following approach the correct way in terms of not causing any hidden error or information lost? [CODE] int a = 2; double b = 3.0; double c; c = (double)(a+b); c = (double)(a/b); [/CODE]

Member Avatar for jon.kiparsky
0
236
Member Avatar for winecoding

In the code, I have [CODE]int a = 62; int b = 132; double c; c = a/b; [/CODE] This will generate the c value in the double format as 0.469696968793869 In fact, I only need to an approximation representation of c like 0.4697 Can you let me know how …

Member Avatar for ztini
0
96
Member Avatar for winecoding

I am trying to understand one test script, which includes [CODE]if [ ! -f mahout-work/reuters21578.tar.gz ]; then echo "Downloading Reuters-21578" curl http://kdd.ics.uci.edu/databases/reuters21578/reuters21578.tar.gz \ -o mahout-work/reuters21578.tar.gz fi[/CODE] What does the condition of [CODE]! -f mahout-work/reuters21578.tar.gz [/CODE]mean? And what does [CODE]curl http://kdd.ics.uci.edu/databases/reuters21578/reuters21578.tar.gz \ -o mahout-work/reuters21578.tar.gz [/CODE]stand for? Thanks.

Member Avatar for alaa sam
0
248
Member Avatar for winecoding

For the following segment of java code, the method of “run” occurs four times. I am quite confusing about the relationships of these four occurrences of “run”. Can you explain this to me? The original code is pretty long, I just keep the part that is related to my question. …

Member Avatar for NormR1
0
193
Member Avatar for winecoding

I am learning to use mahout by starting with a example copied from the book. However, the eclipse compiler gives me the following message: [QUOTE]Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory at org.apache.mahout.cf.taste.impl.model.file.FileDataModel.<clinit>(FileDataModel.java:119) at mia.recommender.ch02.RecommenderIntro.main(RecommenderIntro.java:18) Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at …

Member Avatar for thekashyap
0
204
Member Avatar for winecoding

I am trying to save an integer matrix to the csv file. My code is listed as follows. [CODE]try { FileWriter writer = new FileWriter("test.csv"); for(int i = 0; i < row; i++) { for (int j=0; j<(column-1); j++) { writer.append(Matrix[i][j]); writer.append(','); } writer.append(Matrix[i][j]); writer.append('\n'); writer.flush(); } writer.close(); } catch(Exception …

Member Avatar for hfx642
0
120
Member Avatar for winecoding

I am learning Java, and found a code segment as follows. [CODE]public static void displayClusters(final Collection<Cluster> clusters) { displayClusters(clusters, Integer.MAX_VALUE); } public static void displayClusters(final Collection<Cluster> clusters, int maxNumberOfDocumentsToShow) { displayClusters(clusters, maxNumberOfDocumentsToShow, ClusterDetailsFormatter.INSTANCE); } public static void displayClusters(final Collection<Cluster> clusters, int maxNumberOfDocumentsToShow, ClusterDetailsFormatter clusterDetailsFormatter) { System.out.println("\n\nCreated " + clusters.size() + …

Member Avatar for JamesCherrill
0
147
Member Avatar for winecoding

I have a java project, which runs fine on eclipse. Right now, I need to run it from command prompt, like java classpath ... How to setup this classpath based on the stored ones using in Eclipse.

Member Avatar for jon.kiparsky
0
264
Member Avatar for winecoding

I have an existing Eclipse java project, and need to export it to the war file for deployment. By googling, it turns out that I need to covert it to a dynamic web project at first. But the menu item for this conversion is disabled. I would like to know …

0
83
Member Avatar for winecoding

I have implemented a jetty-based servlet under eclipse.It runs fine under eclipse. Right now, I need to deploy it as a Web application. I would like to know the procedures of transplanting these java programs from Eclipse to a real Jetty-based web application. The system is a Linux box. Thanks.

Member Avatar for peter_budo
0
107
Member Avatar for winecoding

My current work needs to do the development based on open soure software. There is a class defined as DirLocator.java The code is as follows [CODE]public final class DirLocator implements IResourceLocator { /** The folder relative to which resources are resolved. */ private File dir; /** * Initializes the locator …

Member Avatar for winecoding
0
8K
Member Avatar for winecoding

I am using Eclipse to develop an applet module, which requires a bunch of libraries. It runs correctly under the Eclipse environment. I would like to know how to embedded this code in a html page, or how to deploy this applet?

Member Avatar for NormR1
0
80
Member Avatar for winecoding

I am implementing an applet module which receiving an object sent from a servlet. The following is used to setup connection. [CODE]private URLConnection getServletConnection(String hostName) throws MalformedURLException, IOException { URL urlServlet = new URL(hostName); URLConnection con = urlServlet.openConnection(); con.setDoInput(true); con.setDoOutput(true); con.setUseCaches(false); con.setRequestProperty("Content-Type","application/x-java-serialized-object"); return con; } [/CODE] The following is the …

Member Avatar for NormR1
0
164
Member Avatar for winecoding

In servlet side, I am trying to receive an vector sent from the applet. The code is like [CODE]InputStream in = request.getInputStream(); ObjectInputStream inputFromApplet = new ObjectInputStream(in); Vector v = (Vector)inputFromApplet.readObject(); [/CODE] But the compiler specifies that the following one is wrong. [CODE]Vector v = (Vector)inputFromApplet.readObject(); [/CODE] The error message …

Member Avatar for JamesCherrill
0
145
Member Avatar for winecoding

In the main function, I have one two-dimensional array, A. I need to pass A into a function f, which takes A, may change A. f will also generate another two-dimensional array B based on some operations on A and return A. I know it is about passing pointer passing …

Member Avatar for Arbus
0
684
Member Avatar for winecoding

I am trying to learn operator overloading by working on overloading >> for a matrix class to enable the key-board based input for a matrix by calling sth such as [CODE]Matrix M1; cin >> M1; [/CODE] The operator overloading part is given in the following [CODE]istream &operator>>(istream &in, Matrix &m) …

Member Avatar for rubberman
0
229
Member Avatar for winecoding

In the following code snippet, T represents a class. This code is claimed to have problem due to the fact that "p" will be out of range after running "*p=a". Why? [CODE] void f1(T a) { T v[200]; T* p = &v[0]; p--; *p=a; ++p; *p=a; } [/CODE]

Member Avatar for Ancient Dragon
0
80
Member Avatar for winecoding

There is a code snippet [CODE]Int matchstar( char c, char *regexp, char *text) { Do { /* do sth */ } while (*text != ‘\0’ && { ‘text++ == c|| c == ‘.’}); Return 0; } [/CODE] I do not understand how does the logic in while work, in specific, …

Member Avatar for Ancient Dragon
0
110
Member Avatar for winecoding

After running the following code segment, the output is Outer. Inner. Inner. [CODE] #include <iostream> using namespace std; namespace Outer { void message( ); namespace inner { void message( ); } } int main( ) { Outer::message( ); Outer::Inner::message( ); using namespace Outer; Inner::message( ); return 0; } namespace Outer …

Member Avatar for Ancient Dragon
0
72
Member Avatar for winecoding

With respect to the following code segment, what should be the n value in different classes, e.g., what is a.n, b[2].n, and c->n How to analyze them? [CODE]#include <iostream> using namespace std; class CDummy { public: static int n; CDummy(){ n++ ;}; ~CDummy(){ n--; }; }; int CDummy::n = 0; …

Member Avatar for pseudorandom21
0
101
Member Avatar for winecoding

A C++ newbie question: I found the following function: [CODE]int &min(int &x, int &y) { return x < y ? x : y; }[/CODE] I am confused of the usage of “&”. Is that possible to re-write the above function as [CODE]int &min(int x, int y) { return x < …

Member Avatar for mike_2000_17
0
123
Member Avatar for winecoding

There is a small program. [CODE]#include <stdio.h> void f(char **p); int main() { char *argv[]={"ab", "cd", "ef", "gh"}; f(argv); } void f(char **p) { char *t; t=(p+=sizeof(int))[-1]; printf("%s\n", t); }[/CODE] Assume the size of int is 4, I was asked to give the running result of the following code segment. …

Member Avatar for burgercho
0
91
Member Avatar for winecoding

just starting to learn C++, and sort of confusing about the following section of code: [CODE]int *getCharCountArray(char *str) { int *count = (int *)calloc(sizeof(int), NO_OF_CHARS); int i; for (i = 0; *(str+i); i++) count[*(str+i)]++; return count; }[/CODE] In specific, do not quite understand how the following two work? [CODE] for …

Member Avatar for mrnutty
0
96
Member Avatar for winecoding

How many constructor (including copy constructor) and destructors will be called for test1 and test2? [CODE]#include <iostream> using namespace std; class Base{ public: Base(){cout << "Base()" << endl;} Base(const Base&){cout << "Base(const Base&)" << endl;} ~Base(){cout << "~Base()" << endl;} }; Base func(Base b){return b;} void test(){ Base a; func(a); …

Member Avatar for Lawand
0
85

The End.