Win a copy of Spring Boot in Practice this week in the Spring forum!

Panagiotis Kalogeropoulos

+ Follow
since May 27, 2011
Panagiotis likes ...
Netbeans IDE Java
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Panagiotis Kalogeropoulos

What kind of error do you get? If an exception happens somewhere, can you please provide more details such as the exception's stack trace?
9 years ago
Yes, I am using Cygwin so that I can run the Linux commands. I mentioned only Windows 7 just to tell you under which os I am trying to run hadoop. Indeed, there seems to be some problem with the Windows Classpath. As we can see, the line 320 in the bin/hadoop file is
JAVA_PLATFORM=`CLASSPATH=${CLASSPATH} ${JAVA} -Xmx32m ${HADOOP_JAVA_PLATFORM_OPTS} org.apache.hadoop.util.PlatformName | sed -e "s/ /_/g"`

The thing is that even after I quote the CLASSPATH and JAVA_HOME variables, I get the same message. And what surprises me even more is that the jars are executing correctly. Maybe there is something wrong with the version that I am working? I will try with version 0.22.0 and see how it goes.
9 years ago
I am trying to run hadoop (version 1.1.1) in Windows 7, but when I try to execute some of the jars (like the hadoop-examples-1.1.1.jar or hadoop-test-1.1.1.jar) I get the following error:
bin/hadoop: line 320: C:/Program: No such file or directory

The thing is that the jars are executing without any serious problem. For instance, this is what is shown when I execute the hadoop-examples-1.1.1.jar :

$ bin/hadoop jar hadoop-examples-1.1.1.jar
bin/hadoop: line 320: C:/Program: No such file or directory
An example program must be given as the first argument.
Valid program names are:
aggregatewordcount: An Aggregate based map/reduce program that counts the words in the input files.
aggregatewordhist: An Aggregate based map/reduce program that computes the histogram of the words in the input files.
dbcount: An example job that count the pageview counts from a database.
grep: A map/reduce program that counts the matches of a regex in the input.
join: A job that effects a join over sorted, equally partitioned datasets
multifilewc: A job that counts words from several files.
pentomino: A map/reduce tile laying program to find solutions to pentomino problems.
pi: A map/reduce program that estimates Pi using monte-carlo method.
randomtextwriter: A map/reduce program that writes 10GB of random textual data per node.
randomwriter: A map/reduce program that writes 10GB of random data per node.
secondarysort: An example defining a secondary sort to the reduce.
sleep: A job that sleeps at each map and reduce task.
sort: A map/reduce program that sorts the data written by the random writer.
sudoku: A sudoku solver.
teragen: Generate data for the terasort
terasort: Run the terasort
teravalidate: Checking results of terasort
wordcount: A map/reduce program that counts the words in the input files.

As you can see it shows correctly all available example programs. Has anyone seen something similar?
9 years ago

ive recently gotten this book
everything was going good until chapter 2 when in the examples it uses a SurveyData object that it hasnt explained and i get an error when typing it in netbeans

Aha! I've found it! Go to page 76. There is says:
"SurveyData is a very simple JavaBean with two private properties and
corresponding getters and setters. Since it is so simple, it is not shown, it
is part of this book's code download."
9 years ago

if any one out there does web development for a living then could you please tell me how you learned?,
i am just curious.

Easy. We were (and still are) writing lots and lots of code. You should do the same thing, write as much code as you can. Start slow: create a simple webpage with Jsp that says Hello World. If you have accomplished that, then add some more functionality to that page. Add a form with some textfields and a Submit button. When you press that button, show (either in the same page or in another page) what you have written in those textfields. When you have done that, add some more functionality. For instance, save what you have written in a database. Start playing with Sql queries and/or Hibernate. Then add some more functionality. And this is how it goes. Step by step.

9 years ago

ive recently gotten this book
everything was going good until chapter 2 when in the examples it uses a SurveyData object that it hasnt explained and i get an error when typing it in netbeans

I am surprised because this book is a very well written one (maybe not the best, but still a very good one). Have you checked at the source code provided with the book?
9 years ago
Since you are interested in a wide range of technologies, I do not think that providing you with a long list of books is going to be very helpful. You can start with the book I mentioned in my previous post. It will give you the basics in all major Java EE aspects, from JSF to JPA to SOAP Web Services (and some more). You will also learn how to use NetBeans effectively to get your job done faster. Later, when you feel comfortable with the basics, you can start to read more advanced books. Here in coderanch we have many forums for everything regarding Java, so searching there for more specific (and more advanced eventually) subjects is the way to go.

Hope this helped you a little bit.
9 years ago
One good way to learn about new technologies is to try to apply new solutions to applications that you have already created. For instance, if you have an application that uses MySql as the database model, why not try to do that using JPA and Hibernate? Or if you have a Java Gui app, how can you make that into a web app? This will make you practice (ultimately, the best way to learn) your way through this new knowledge.

Another great option is to pass certifications. Since you are interested in web and java enterprise, you can check the Web Component Certification or the Web Services Certification. They will help you get more expertise on this area and you will also have obtained a proof of knowledge that you can use when applying for a job (many believe that certs are not so important, but it is better than nothing). See the respective forums here in coderanch for each certification to learn more about them.

Regarding the available books, there are many great ones available. Recently I stumbled upon the "Java EE 6 Development with Netbeans 7", which will guide you through the basics of Java EE along with the use of Netbeans. Recommended, since you don't have much experience on this field. I am sure that with a quick search here in Coderanch you will find out more great books.

Good start with your "Java EE adventures" and remember that the journey is worth more than the destination (more philosophical quotes later...). And don't forget to come back for any questions that you may have!
9 years ago

And this answer has nothing to do with JavaScript.

Very true. I did not pay attention to the keyword "dojo" and thought that it referred to core java. Apologies to the topic starter if I mislead him with my answer.
Have you tried using the api? Particularly, the URL and URLConnection classes?

1.Why are we checking res==-1 ?In what case will we get the value as -1.

If you look at the API of the read(char[] buf) method of the InputStreamReader class, you will see that we get -1 if we reach the end the stream (or the end of the file in our case). In the code the you have given us, I do not see that you check somewhere if res==-1, so maybe you have some extra code that does more things. If that is the case, then post the code here to see if we miss something. You should be aware though that if everything goes well (eg no exceptions are thrown), this method will eventually return -1.

2.How can I modify the code such that the above line is read properly?

What exactly do you mean? int; is read properly, but what you do later with the res variable is what we should pay attention to. Kindly post the rest of your code so that we can see where and how we can fix it.
9 years ago
As you can read here ( a somewhat serious security vulnerabilty issue was discovered regarding Java 7 running on browsers. It seems that it is fixed as you can read here (

Hope that helped in case someone is not aware of that issue.
9 years ago
True, BoxLayout and GridBagLayout were the next alternatives, including using drawImage from Graphics class. I just wanted to know if there could be another way of achieving the same thing. I think I will try them all and see which one is more convenient.
9 years ago
I am getting a number of images from a database and then I have to show them in a gui, with a specific alignment. The alignment will be tabular-like and is based on how many images are returned from the database, meaning that if I get less than 10 images (from 1 to 9), they have to appear in columns of three. If I get more than 10, they have to appear in columns of four. Also, in case the number of images does not fully complete all the rows, the first row should show the remaining images, aligned in the center. For instance, if I get 8 images (meaning that I will need to show them in 3 columns), the first row should show 2 images (aligned in the center) and all other rows 3 images. I give you some more examples in the attached file, just to make it more clear as to how the images should appear.

The way that I have handled this so far is by using JLabels inside JLabels, using the fact that since JLabel is a Container, I can set the layout and add other components in it. At the beginning I am setting the layout inside the JLabel to be GridLayout:

Then I try to see if we have any remaining images that need to be shown in the first row.

Now, in order to align them to be in the center, I create two dummy images as placeholders:

So after I have taken care of the first row, I simply continue adding images to the next rows. This is fine. The problem is that since I am using GridLayout as the layout manager, adding dummy images to first row makes it to lose the alignment. So this approach is not feasible if I want the images to appear correctly. My question is what should be the best way to solve this? Should I use GridBagLayout (or another similar layout manager, such as BoxLayout) ? Maybe get a Graphics object and paint the images directly? Maybe another approach that I haven't thought about it? What do you think?

Thanks a lot in advance.

9 years ago
Google has released apis for many languages to retreive and/or modify data from Google Analytics, including Java. One good way to start is by using the Core Rreporting api. See here for more information:
9 years ago