File.delete() Does Not Delete File In Java
Posted by blogmeister on
February 22, 2013
There may be cases when you call the delete() method in Java and your program does not delete the file. A case like this can only mean that the file is still being used provided that the file exists.
Suggestions indicate that you need to close the stream that uses the file. However, if all else fails, a simple hack can be done to fix this problem.
Just call System.gc() and it should do the trick.
Found this useful? Donations appreciated to help keep this blog alive.tags: delete, open, system.gc, used
No Comments
How To Add Delete Functionality In JEasyUI DataGrid
Posted by blogmeister on
January 30, 2013
While JEasyUI has an extended DataGrid component called eDataGrid, I opted to still use DataGrid rather than load up another script library.
Here is the function to delete a row in a JEasyUI DataGrid table complete with a notification popup when the delete HTTP request is in progress and closes itself when it is done.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
function deleteRow(index) { if (confirm('Are you sure you want to delete this entry?')) { $('#tt').datagrid('loading'); $.ajax({ type: 'POST', url: 'delete.php', data: '', success: function (msg) { $('#tt').datagrid('loaded'); $('#tt').datagrid('deleteRow', index); }, error: function (msg) { $('#tt').datagrid('loaded'); } }); } } |
Place A Delete Action Link In A Table Row In JEasyUI DataGrid
Posted by blogmeister on
January 21, 2013
To add an action similar to the image (edit, delete, save, cancel) above, add this table header tag within the table row tag.
|
1 |
<th width="100">Action</th> |
Now, in order for delete links to appear, you need to add a custom made Javascript function that has parameters ‘value, row and index’ and returns a string that dynamically creates an HTML hyperlink for the delete functionality.
|
1 2 3 |
function formatAction(value, row, index){ return '<a href="//" onclick="deleteRow(' + index + ')>Delete</a>'; } |
Lastly, you create another custom made function so that when the delete hyperlink is clicked, that function is called.
|
1 2 3 |
function deleteRow(index) { alert('Row ' + index + ' was clicked'); } |









