Recent Posts

Pages: [1] 2 3
1
Java Class / Homework #3
« Last post by Iman on September 04, 2018, 11:33:53 PM »
Hi,

Here is the last homework, this week is the final week and I am not sure about the next week but I will keep you updated. So that would be your last homework and I want you guys have a perfect and complete Java sample project, and just to quote from Tarikh-i_Bayhaqi,

"سخنی نرانم که آیندگان بگویند شرم باد این پیر را".

- The deadline would be on September 9.

- You need to complete the rest of your homework #2, going that way you will connect your web application to the database which in our case would be PostgreSql.

- You need a full registration with Email validation. It means if the user enters iman.reigmail.com, the software has to validate this input as wrong, it can be server or client side.

- You have to encrypt the password using MD5 algorithm and save it inside the database, I won't accept plain text password in any case.

- The user has to be able to edit his/her profile including first name, last name, password but the user can not change his/her email address.

- You need to make a separate folder inside the webapp which is called "protected-files", and move all the protected web files like profile and dashboard into that folder.

- You have to consider security holes, like the case that unauthorized user wants to visit protected-files (for example dashboard). In this case that unauthorized user has to go to the login page.

- You need to implement a real format of log-out. What I mean by that is, if an user clicks on log-out; then, it doesn't have permission to visit protected-files area and has to go to login page again.

- During registration, you need to make sure that the user didn't sign up before, if so you have to show the correct message.

- User has to be able to buy a product which is listed in product page. So you need a checkout page and ask for credit card information and that can be anything, and always has to be able to buy the product. and after that show a correct message format.

Please ask any question you have in this page.

And last word, unlike what all people think, programming doesn't start with code and syntax but it always starts with imagination. Before start coding you need to improve your imagination, first you need to imagine something in your mind and bring that imagination on the paper before even thinking about coding. Code and Syntax are just TOOLS that can make that imagination happen in reality. This is why it is called "the art of the programming" https://www.amazon.com/Computer-Programming-Volumes-1-4A-Boxed/dp/0321751043

At the the very first stage of the programming, you need to imagine what you want to do in a general idea and then imagine every detail of that general idea and bring it on the paper, and this step is not really about logic. It is all about the imagination.

Then you will decide what tool are you going to use to make that imagination happen. One of the tools can be Java because it can make every imagination happen in web, desktop, mobile, ...

I hope you enjoyed the class and I know that I will see you guys to be professional programmers, you always have my support and my bless. So don't hesitate to email me or call me whenever you need my help :)

Hope we can make the earth a friendlier place by teaching and helping each other :)

God bless you all
Iman
714-866-1164
2
Java Class / Re: Class Schedule
« Last post by Iman on August 26, 2018, 05:20:03 PM »
Hi Folks,

One exception: The Sunday class for the next week would be on Saturday from 2-4 PM (1 Sept).

Thanks,
Iman
4
Java Class / How to work with File in Java
« Last post by Iman on August 21, 2018, 08:33:44 PM »
Hi Folks,

Let's dive a little bit more into the concept of file stream, different processes in your machine can talk to each other using file stream and if that process is located in another machine and connected to this machine usually using the internet is called socket. There is a broad area about socket programming and that I am not going to cover that in this class, but file stream is something you need to know as I have maintained that in homework #2.

You can read/write from/to a file using java.IO.File package, but you need first to make sure that file is available and there is an option that is going to show if the file is not available; then, will make a new file.

I will cover a few use cases below, but for all use cases we have to make that connection stream to that file which is:

 File aFile = new File("C:\\User\\Iman\\file.txt");

Use case #1: we want to see does the file exist or not:

aFile.exists() ;// this will return a boolean value (true/false) to see does the file exist or not.

Use case #2: create a new file.

aFile.createNewFile(); // this will return a boolean value (true/false), if it returns a false value, it should be an error which might explain why it couldn't make that file.

Use case #2: do you have permission to read from a file?

aFIle.canRead(); // Tests whether the application can read the file denoted    by this abstract pathname.

Use case #3: do you have permission to write into a  file?

aFile.canWrite(); // Tests whether the application can modify the file denoted by this abstract pathname.

These are some use cases that you might need to complete your homework #2.

Regards,
Iman
5
Java Class / Re: Homework #2
« Last post by Iman on August 20, 2018, 10:54:32 PM »
Hi Folks,

Because you guys were off last week and had a lot of time to practice, I will add a new part to the homework #2.

- You need to save the information which had to be "hard-code" in this homework to a file; going this way, you guys need to add a registration process to the homework which will take a new step to all packages and classes, after registration user can login inside the portal, so it has to be a file that can save and retrieve information - not hard codded. What I mean by that is, if the use didn't register before, you have to show a related message and put a link inside that message which is going to redirect the user to registration page.

- Since you all know about the concept of try-catch, your web software has to be bug-free.

Just to give you a little help, you might want to use the code below:

File file = new File("C:\\Users\\Iman\\Desktop\\test.txt");

BufferedReader br = new BufferedReader(new FileReader(file));
 
String st;
while ((st = br.readLine()) != null)
     System.out.println(st);


"File" is the part of the IO package which will open a new world for the software (process) to communicate with a dynamic storage.

- Moving forward, if the file doesn't exist; then, the software has to make a file and start communicating with that file.

- You can use any structure you want to save, sort and retrieve data from the file, like:
Array
Stack
Queue
Singly-Linked List
Doubly-Linked List
Skip List
Hash Table
Binary Search Tree
Cartesian Tree
B-Tree
Red-Black Tree
Splay Tree
AVL Tree
KD Tree
Quicksort
Mergesort
Timsort
Heapsort
Bubble Sort
Insertion Sort
Selection Sort
Tree Sort
Shell Sort
Bucket Sort
Radix Sort
Counting Sort
Cubesort

- I am not picky on data structure for now, but that would be a plus point if you do that.
6
Java Class / Re: Class Schedule
« Last post by pouya.javadi.84 on August 13, 2018, 07:47:13 PM »
Hi Iman jan:

If that's ok I can make it for the Sunday class since Im working. Please confirm.

Tnx
Pouya
7
Java Class / Re: Homework #2
« Last post by marjan.sayyad@gmail.com on August 12, 2018, 07:39:14 PM »
Hi Team,
I will appreciate if anybody can explain what does exactly DashboadView does:

if user is empty, it will create new User function, and User function has different attribute as first name and .... . How come in dashboard.xhtml we just have firstname? Hhow can we show other attributes?
Also, is there any relation between firstname, lastname and email attribute in DashboardView class and same attributes in Model -> User.class ?
Thanks,
Marjan

========================================
package org.ocpc.ecommerce.view;
import javax.faces.bean.ManagedBean;
import org.ocpc.ecommerce.model.User;
@ManagedBean
public class DashboardView {
       private User user;
       public User getUser() {
             if(user == null) {               
                    user = new User();
                    user.setFirstName("iman");
                   // user.setLastName("reihanian");
                    user.setEmail("iman.reih@gmail.com");
             }
             return user;
       }
       public void setUser(User user) {
              this.user = user;
       }
 }
===============================================
8
Java Class / Re: Homework #2
« Last post by Iman on August 10, 2018, 10:07:33 PM »
Hi,

Please read my last post about multi tier programming in https://www.facebook.com/groups/socalpersianhightechcommunity/

This is exactly why you are trying to implement different packages for different classes.

This is very critical to know why we are making package separate.

Thanks,
Iman
9
Java Class / Re: Homework #2
« Last post by Iman on August 10, 2018, 02:46:12 PM »
Hi,

Here is a link to my github, you can find the source code that might help you for the homework #2. https://github.com/imanreih/eCommerce
10
Java Class / Quiz on Next Week
« Last post by Iman on August 10, 2018, 02:42:20 PM »
Hi,

There will be a quiz on next week, it means Thursday and Saturday class. It goes over everything we will work on in this week.

It is a 20 minutes quiz and If you pass it, I will continue to teach about connection to the database and save and retrieve information from database. But If you can not pass the quiz; then, I have to go back and review and explain the previous materials.

So, it is necessary that you pass the test to learn more otherwise we have to review the past materials again.

Thanks,
Iman
Pages: [1] 2 3