reset password
Author Message
jadiagaurang
Posts: 53
Posted 22:50 May 23, 2009 |

I want to allow user to delete Blog Image, which was uploaded by user. I have seen few example like DeletePostAttachmentController. In this controller attachments are saved as Set of Files. This controller has something like post.getAttachments().remove( attachment ); to remove file from Set and then save object of post! (I am going to use this code to delete attachments from BlogEntries and Comments.) I have imageFile a property of Blog. I set imageFile equals to null when user delete imageFile. I guess when object has null value Garbage Collector delete from memory. It is working also, but problem is that file does not removed from physical drive! Is it OK or I am doing something wrong? Check out my screenshots?

Secondly, I have seen in most of blog applications that BlogEntry can have one category and many tags. It is useful to sort and orgnize BlogEntries. Every blog should have one calendar component to display posting dates of BlogEntries. Should we do like these to make our CSNS Blogs more realistic? Innocent

cysun
Posts: 2935
Posted 11:13 May 25, 2009 |
jadiagaurang wrote:

I want to allow user to delete Blog Image, which was uploaded by user. I have seen few example like DeletePostAttachmentController. In this controller attachments are saved as Set of Files. This controller has something like post.getAttachments().remove( attachment ); to remove file from Set and then save object of post! (I am going to use this code to delete attachments from BlogEntries and Comments.) I have imageFile a property of Blog. I set imageFile equals to null when user delete imageFile. I guess when object has null value Garbage Collector delete from memory. It is working also, but problem is that file does not removed from physical drive! Is it OK or I am doing something wrong? Check out my screenshots?

One of my design principles for CSNS is "data is important and disk space is cheap". This means that CSNS almost never really deletes anything, so we can always recover the data if necessary. Deleting attachment is an example of this approach, and there are other examples like deleting a assignment, dropping a student from a class, and so on.

Secondly, I have seen in most of blog applications that BlogEntry can have one category and many tags. It is useful to sort and orgnize BlogEntries. Every blog should have one calendar component to display posting dates of BlogEntries. Should we do like these to make our CSNS Blogs more realistic? Innocent

The main purpose of homework assignments is to practice what you learned in class. Although I try to make programming assignments more realistic (so that they are more interesting), it's not the emphasis of the assignments. With that said, I think tagging is a good feature to implement for our blogs. I'll make it an extra credit exercise in the next homework.