hit counter

Timeline

My development logbook

A Way to Generate Random Password in Erlang

A way to generate random password in erlang

1
2
3
4
5
6
$ erl
Erlang R14B04 (erts-5.8.5) [source] [64-bit] [smp:4:4] [rq:4] [async-threads:0] [hipe] [kernel-poll:false]

Eshell V5.8.5  (abort with ^G)
1> base64:encode_to_string(crypto:rand_bytes(16)).
"9d1L2K5ZYEyFEXCs+dVqfA=="

Delete a Row From UITableView

To enable the swipe to delete feature, one must implement this API:

1
2
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle
                                            forRowAtIndexPath:(NSIndexPath *)indexPath``

I can enable this feature, but I got this exception from this function

1
2
3
4
5
6
2012-08-11 22:30:46.286 app[76532:fb03] *** Terminating app due to uncaught exception
 'NSInternalInconsistencyException', reason: 'Invalid update: invalid number of rows in section 0.  
The number of rows contained in an existing section after the update (10) must be equal to the 
number of rows contained in that section before the update (10), plus or minus the number of rows 
inserted or deleted from that section (0 inserted, 1 deleted) and plus or minus the number of rows 
moved into or out of that section (0 moved in, 0 moved out).'

It turns out even though I removed the object from the CoreDate managed context, I did not ask the NSFetchedResultsController to refetch the data set. The UITableView is sTILl bound to the old data set and hence the internal inconsistency.

Put the Events Into Historical Perspective

Leonardo da Vinci, who was forty years old when Columbus discovered America, died in 1519 at sixty-seven. Just two years earlier, in 1517, Martin Luther had posted his Ninety-five Theses on a church door in Wittenberg, launching the Protestant Reformation the same year Ferdinand Magellan had set sail from Spain, aspiring to circumnavigate the earth.

Quoted from

Math and the Mona Lisa: The Art and Science of Leonardo da Vinci by Bulent Atalay